Skip to content

Commit

Permalink
Fix sdist package
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ulope committed May 14, 2019
1 parent 26519a2 commit f4d1d65
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 37 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include README.rst
include requirements.txt
include constraints.txt
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
Empty file.
Empty file.
86 changes: 50 additions & 36 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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 = []
Expand All @@ -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"]},
)

0 comments on commit f4d1d65

Please sign in to comment.