setuptools fails to install package yet returns success
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
tl;dr python setup.py install fails to build the package. Process return code is 0, should be !0
Reproduction
Given test code files
./setup.py
./setuptools_test1/code.py
./setuptools_test1/__init__.py
Where ./setup.py is
from setuptools import setup
setup(
name='setuptools_test1',
version='0.1',
packages=['setuptools_test1'],
install_requires=[]
)
Where ./setuptools_test1/code.py is
#!/usr/bin/env python3.7
print 'bad python 3 code'
Where ./setuptools_test1/__init__.py is an empty file.
Create a virtual environment (using Python 3.7). Activate it.
$ virtualenv --python=python3.7 .venv-3.7
...
$ source .venv-3.7/bin/activate
Run setuptools install. Notice failure and success return code (output abbreviated)
$ python3.7 setup.py --verbose install
running install
...
copying build/lib/setuptools_test1/__init__.py -> build/bdist.linux-x86_64/egg/setuptools_test1
byte-compiling build/bdist.linux-x86_64/egg/setuptools_test1/code.py to code.cpython-37.pyc
File "build/bdist.linux-x86_64/egg/setuptools_test1/code.py", line 2
print 'bad python 3 code'
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print('bad python 3 code')?
byte-compiling build/bdist.linux-x86_64/egg/setuptools_test1/__init__.py to __init__.cpython-37.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
Finished processing dependencies for setuptools-test1==0.1
$ echo $?
0
Return code 0 will not stop callers from continuing processing, leading to more confusing problems much later in a workflow. setuptools needs to signal failure to the caller with a non-zero return code.
Additionally, setuptools continues to process further byte-compiling operations despite the failure. By default, it should gracefully exit after any byte-compiling failure.
Some users may want setuptools to continue in spite of byte-compile failures (some users may need the current behavior)? Perhaps a flag could be added, like --ignore-compile-failures.
version tested
$ python3.7 --version
Python 3.7.1
$ python3.7 -c 'import setuptools;print(setuptools.__version__)'
41.0.1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the minimal setup.py and setuptools_test1/code.py example using Python 3.7 and python setup.py --verbose install. Trace the install entry point and byte-compiling behavior; done means a byte-compilation failure returns a non-zero status and stops by default, with any opt-out behavior explicitly defined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100