From f4d1d659df64cb505cbe3442e38b44013d1bbf9f Mon Sep 17 00:00:00 2001 From: Ulrich Petri Date: Tue, 14 May 2019 18:55:19 +0200 Subject: [PATCH] Fix sdist package Setuptools_scm forcibly includes all files under version control into the sdist package, ignoring `MANIFEST.in` and `find_packages`. This fixes this by replacing the `find_files` function with a dummy one (`see setup.py::EggInfo.__init__()`). See pypa/setuptools_scm#190 --- MANIFEST.in | 1 + Makefile | 2 +- raiden/network/resolver/__init__.py | 0 raiden/storage/migrations/__init__.py | 0 setup.py | 86 ++++++++++++++++----------- 5 files changed, 52 insertions(+), 37 deletions(-) create mode 100644 raiden/network/resolver/__init__.py create mode 100644 raiden/storage/migrations/__init__.py diff --git a/MANIFEST.in b/MANIFEST.in index 5e28dc925f..d332d2ed64 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,3 @@ include README.rst include requirements.txt +include constraints.txt diff --git a/Makefile b/Makefile index 15800255cc..9290a77dd1 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ clean-test: LINT_PATHS = raiden/ tools/ ISORT_PARAMS = --ignore-whitespace --settings-path ./ --skip-glob '*/node_modules/*' --recursive $(LINT_PATHS) -BLACK_PATHS = raiden/ tools/ +BLACK_PATHS = raiden/ tools/ setup.py lint: mypy mypy-all flake8 raiden/ tools/ diff --git a/raiden/network/resolver/__init__.py b/raiden/network/resolver/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/raiden/storage/migrations/__init__.py b/raiden/storage/migrations/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/setup.py b/setup.py index 8a88dd1759..337efb3d4f 100755 --- a/setup.py +++ b/setup.py @@ -1,10 +1,10 @@ #!/usr/bin/env python from setuptools import find_packages, setup +from setuptools.command.egg_info import egg_info from setuptools.command.test import test as TestCommand class PyTest(TestCommand): - def finalize_options(self): TestCommand.finalize_options(self) self.test_args = [] @@ -13,61 +13,75 @@ def finalize_options(self): def run_tests(self): # import here, cause outside the eggs aren't loaded import pytest + errno = pytest.main(self.test_args) raise SystemExit(errno) -with open('README.rst') as readme_file: +class EggInfo(egg_info): + def __init__(self, *args, **kwargs) -> None: + super().__init__(*args, **kwargs) + # FFS, setuptools_scm forcibly includes all files under version control into the sdist + # package, ignoring `MANIFEST.in` and `find_packages`. + # See https://github.com/pypa/setuptools_scm/issues/190 + # We 'fix' this by replacing the `find_files` function with a dummy one. + # The reason this is done here and not on the top level is that setuptools_scm is a + # setup time requirement so it may not have been installed when this setup.py is initially + # executed. + try: + import setuptools_scm.integration + + setuptools_scm.integration.find_files = lambda _: [] + except ImportError: + pass + + +with open("README.rst") as readme_file: readme = readme_file.read() -history = '' +history = "" -with open('constraints.txt') as req_file: - install_requires = list({ - requirement - for requirement in req_file - if requirement.strip() and not requirement.lstrip().startswith('#') - }) +with open("constraints.txt") as req_file: + install_requires = list( + { + requirement + for requirement in req_file + if requirement.strip() and not requirement.lstrip().startswith("#") + } + ) test_requirements = [] # Do not edit: this is maintained by bumpversion (see .bumpversion_client.cfg) -version = '0.100.3-rc5' +version = "0.100.3-rc5" setup( - name='raiden', - description='', - long_description=readme + '\n\n' + history, - author='Brainbot Labs Est.', - author_email='contact@brainbot.li', - url='https://github.com/raiden-network/raiden', - packages=find_packages(exclude=('tools',)), + name="raiden", + description="", + long_description=readme + "\n\n" + history, + author="Brainbot Labs Est.", + author_email="contact@brainbot.li", + url="https://github.com/raiden-network/raiden", + packages=find_packages(include=("raiden", "raiden.*")), package_data={"raiden": ["py.typed"]}, - include_package_data=True, - license='MIT', + license="MIT", zip_safe=False, - keywords='raiden', + keywords="raiden", classifiers=[ - 'Development Status :: 3 - Alpha', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Natural Language :: English', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", ], - cmdclass={ - 'test': PyTest, - }, + cmdclass={"test": PyTest, "egg_info": EggInfo}, use_scm_version=True, - setup_requires=['setuptools_scm'], + setup_requires=["setuptools_scm"], install_requires=install_requires, tests_require=test_requirements, - python_requires='>=3.7', - entry_points={ - 'console_scripts': [ - 'raiden = raiden.__main__:main', - ], - }, + python_requires=">=3.7", + entry_points={"console_scripts": ["raiden = raiden.__main__:main"]}, )