import setuptools import subprocess import os import shutil try: git_describe = subprocess.check_output( ['git', 'describe', '--tags', '--long']).decode('utf-8').strip() git_branch = subprocess.check_output( ['git', 'rev-parse', '--abbrev-ref', 'HEAD']).decode('utf-8').strip() version = f'{git_describe}-{git_branch}' with open('petrel_client/version.py', 'w') as f: f.write(f"version = '{version}'\n") f.truncate() except Exception: from importlib.machinery import SourceFileLoader version_module = SourceFileLoader( 'version_module', 'petrel_client/version.py').load_module() version = version_module.version dist_path = 'dist' if os.path.exists(dist_path): shutil.rmtree(dist_path) setuptools.setup( name='petrel-oss-sdk', version=version, description='Ceph S3 storage API for Pytorch, Parrots', url="http://gitlab.bj.sensetime.com/platform/StorageSystem/petrel-oss-python-sdk", packages=setuptools.find_packages(), package_data={'': ['**/*.so']}, install_requires=['boto3', 'environs', 'coloredlogs', 'humanize', 'multiprocessing-logging'], python_requires='>=3.6', zip_safe=False, )