`sdist` fails with permission denied error after writing to a temp dir
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
Version info:
python 3.6.7, pip version 19.0.2, setuptools version v40.8.0, virtualenv v15.1.0, (ubuntu bionic)
When I use python setup.py install, an archive file dist/repro-0.0.0-py3.6.egg is created which contains repro/GITVER.txt. However (and perhaps this has to do with my misunderstanding of the semantics of data_files), when I run python setup.py sdist, I get error: could not create '../../../tmp': Permission denied.
The following minimal setup.py reproduces the problem:
from setuptools import setup
import os, tempfile
commithash = '000000'
tmpdir = tempfile.mkdtemp()
hashfile = os.path.relpath(os.path.join(tmpdir, 'GITVER.txt'))
print(hashfile) # prints something like '../../../../tmp/tmp82ywkodv/GITVER.txt'
with open(hashfile, 'w') as f :
f.write(commithash)
setup(
name='repro',
data_files=[('repro', [hashfile])],
)
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
Start with the minimal setup.py reproducer and run both python setup.py install and python setup.py sdist in the reported Ubuntu/Python environment. Trace how the relative data_files path from the temporary directory is handled; done means sdist completes without the permission error while preserving the intended GITVER.txt packaging behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100