--prefix doesn't work for OSX Framework Python
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
If a user provides --prefix to setuptools, setuptools adds a site directory for ${prefix}/lib/python{version}/site-packages on OSX -
Problem is, for OSX Framework Python this isn't true. The site-packages wind up being at ${prefix}/lib/python/site-packages -https://github.com/python/cpython/blob/b505c47044fb5b8f03b9708ee1f210a4c935baf5/Lib/site.py#L267 (which then calls into https://github.com/python/cpython/blob/a6431f2c8cf4783c2fd522b2f6ee04c3c204237f/Lib/sysconfig.py#L75)
This is causing setuptools to fail when installing packages into a prefixed directory. For example (on OSX 10.11.15, python 2.7 installed via brew)
export PYTHONUSERBASE=$(mktemp -d)
export PYTHONPATH="$(python -m site --user-site)/"
wget https://pypi.python.org/packages/1b/4f/e52b81c47396668deb139b628f4ebb499b3cd39fc05382851fa985d0b642/setuptools-24.3.0.tar.gz#md5=55d77ca2b1f783a71e330b0878da29ec
tar xzf setuptools-24.3.0.tar.gz
(cd setuptools* && python setup.py --quiet install --prefix=$PYTHONUSERBASE)
.
.
.
error: bad install directory or PYTHONPATH
You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from. The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
.
.
.
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 in setuptools/command/easy_install.py at the linked prefix site-directory logic, then compare it with the linked CPython Lib/site.py and Lib/sysconfig.py behavior for macOS Framework Python. Reproduce the failure with the provided PYTHONUSERBASE, PYTHONPATH, and setup.py install command; done means installation into a prefixed directory no longer reports a bad install directory or PYTHONPATH.
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
- 45/100