Move requirements.txt contents into setup.py

The use of requirements.txt is resulting in an incorrectly packaged
source distribution (sdist) for west. This is because while setup.py
is copied into the sdist archive, requirements.txt is not, so using
"pip install <sdist>.tar.gz" fails like so (shown with the 0.1.0
sdist):

    $ wget 77593677335ba03c2b7122c07c5b4d/west-0.1.0.tar.gz
    $ pip install west-0.1.0.tar.gz
    [...]
	FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
    [...]

I didn't notice this when uploading 0.1.0 because pip prefers to
install wheels over sdists, our 0.1.0 wheel works, and I never tested
installing the sdist.

Further review of the way requirements.txt is meant to be used
(https://packaging.python.org/discussions/install-requires-vs-requirements/)
seems to indicate that the two are not meant to be used together.

Work towards fixing the sdist by inlining the requirements.txt
contents into setup.py. (Another issue with tests_requirements.txt is
next).

Signed-off-by: Marti Bolivar <marti@foundries.io>
This commit is contained in:
Marti Bolivar 2018-09-20 12:25:15 -06:00 committed by Carles Cufí
parent 4e889e4b81
commit 867f01243e
2 changed files with 5 additions and 7 deletions

View File

@ -1,3 +0,0 @@
colorama
PyYAML
pykwalify

View File

@ -7,9 +7,6 @@ import setuptools
with open('README.rst', 'r') as f:
long_description = f.read()
with open('requirements.txt', 'r') as f:
install_requires = f.readlines()
with open('tests_requirements.txt', 'r') as f:
tests_require = f.readlines()
@ -32,7 +29,11 @@ setuptools.setup(
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
],
install_requires=install_requires,
install_requires=[
'colorama',
'PyYAML',
'pykwalify',
],
python_requires='>=3.4',
tests_require=tests_require,
setup_requires=('pytest-runner',),