[FR] Throw clear error when empty files are specified as scripts via a setup.py
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
What's the problem this feature will solve?
Looks like when empty python files are specified as scripts, they are skipped when being moved to the build directory. But, then when pip wants to copy over the script into the bin, it cant find it and throws the error error: [Errno 2] No such file or directory:
Describe the solution you'd like
When I specify an empty file as a script, I want an error to throw saying that specifying an empty file as a script is not allowed.
Alternative Solutions
No response
Additional context
Minimal example:
setup.py
from setuptools import setup
setup(
name='test',
scripts=["foo/bar.py", "foo/empty.py"],
)
Install attempt and error
% pip install .
Processing /Users/test/test
Preparing metadata (setup.py) ... done
Building wheels for collected packages: test
Building wheel for test (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [10 lines of output]
running bdist_wheel
running build
running build_scripts
creating build
creating build/scripts-3.7
copying and adjusting foo/bar.py -> build/scripts-3.7
warning: build_scripts: foo/empty.py is an empty file (skipping)
changing mode of build/scripts-3.7/bar.py from 644 to 755
error: [Errno 2] No such file or directory: 'build/scripts-3.7/empty.py'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for test
Running setup.py clean for test
Failed to build test
Installing collected packages: test
Running setup.py install for test ... error
error: subprocess-exited-with-error
× Running setup.py install for test did not run successfully.
│ exit code: 1
╰─> [10 lines of output]
running install
running build
running build_scripts
creating build
creating build/scripts-3.7
copying and adjusting foo/bar.py -> build/scripts-3.7
warning: build_scripts: foo/empty.py is an empty file (skipping)
changing mode of build/scripts-3.7/bar.py from 644 to 755
error: [Errno 2] No such file or directory: 'build/scripts-3.7/empty.py'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> test
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
This error requires me to understand the file movement process and put 2 and 2 together. I would rather have an error that stated something isn't allowed.
Code of Conduct
- I agree to follow the PSF Code of Conduct
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 setup.py example and trace the build_scripts step shown in the installation output, focusing on how empty script files are handled before they are copied into the build directory. Done means an empty file listed in scripts produces a clear, intentional error instead of the later missing-file failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100