# python setup.py --dry-run --verbose install import os.path import pathlib import shutil import subprocess from setuptools import setup, find_packages, Command, Extension from setuptools.command.build_ext import build_ext #from medashare.magic_wrap import compile_file class file_ext(build_ext): def __init__(self, dist): super().__init__(dist) def run(self): # do the building #print(repr(self.distribution)) fnames = [ (x, pathlib.Path(self.build_lib) / 'medashare' / x) for x in self.get_source_files() ] oldcwd = os.getcwd() for src, dst in fnames: os.chdir(oldcwd) shutil.copyfile(src, dst) os.chdir(dst.parent) cmd = [ 'file', '-C', '-m' ] + [ str(dst) for src, dst in fnames ] #print('running:', cmd) r = subprocess.run(cmd) os.chdir(oldcwd) r.check_returncode() def get_outputs(self): return [ '%s.mgc' % i for i in self.get_source_files() ] # method build_extension not needed, in run setup( name='medashare', version='0.1.1', author='John-Mark Gurney', author_email='jmg@funkthat.com', packages=find_packages(), #url='', license='BSD', description='File Metadata sharing, query and storing utility.', #download_url='', long_description=open('README.md').read(), python_requires='>=3.8', # This isn't needed till magic_wrap.py can use it #cmdclass=dict(build_ext=file_ext), #ext_modules=[ Extension(name='magic', sources=['medashare/magic']) ], install_requires=[ 'alembic', 'base58', 'edgold @ git+https://www.funkthat.com/gitea/jmg/ed448goldilocks.git@pyupdate#egg=edgold&subdirectory=python', 'databases[sqlite]', 'fastapi', 'fastapi_restful', 'httpx', 'SQLAlchemy', 'hypercorn', # option, for server only? 'orm', 'pasn1 @ git+https://www.funkthat.com/gitea/jmg/pasn1.git@c6c64510b42292557ace2b77272eb32cb647399d#egg=pasn1', 'python-libarchive @ git+https://www.funkthat.com/gitea/jmg/python-libarchive.git#egg=python-libarchive', 'pydantic[dotenv]', ], include_package_data=True, package_data={ 'medashare': [ 'alembic/**/*.py', 'alembic.ini', ], }, extras_require = { # requests needed for fastpi.testclient.TestClient 'dev': [ 'coverage', 'requests' ], }, entry_points={ 'console_scripts': [ 'medashare = medashare.cli:main', ] } )