Prefix is not exactly honored when installing with --prefix
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python3-setuptools (Ubuntu) |
New
|
Medium
|
Unassigned | ||
setuptools (Debian) |
New
|
Unknown
|
Bug Description
In a simple distutils project:
$ cat hello
#!/usr/bin/env python3 print("Hello world")
$ cat setup.py
from distutils.core import setup
setup(name='hello', scripts=['hello'])
Installing it with --prefix is not fully honored, as "local" is always
added (--root is optional, used just to make the reproducer easier):
$ python3 setup.py install --root=/tmp/py-root --prefix=
$ find /tmp/py-root/
/tmp/py-root/
/tmp/py-root/opt
/tmp/py-
/tmp/py-
/tmp/py-
/tmp/py-
/tmp/py-
/tmp/py-
/tmp/py-
/tmp/py-
/tmp/py-
/tmp/py-
/tmp/py-
/tmp/py-
In fact in such case everything should be installed in
/tmp/py-
/tmp/py-
and so there's no point to add an extra "/local" subpath.
---
In between the others, this breaks jhbuild builds as a test fails for
this specific reason (see bug #2066193 where the missing file is due to
the fact that it gets installed to $PREFIX/local/bin instead of $PREFIX/bin).
---
After some debugging of it, this related to the default scheme change
happened with python3.10 [1] which meant to always use /usr/local as
default and ensure that one should explicitly require for /usr prefix,
but in the case that --prefix= is used, the user request is now ignored because:
- /usr/lib/
1. Selects the scheme `posix_prefix` since we've requested a prefix explicitly
- /usr/lib/
1. Calls sysconfig.
change would return by default `posix_local` unless we're building a
debian package.
2. Replaces the variables to use the `posix_local` scheme
So, in order to fix this we may in theory change python3 packages to
make 1. to select another defined prefix say `posix_
then making `sysconfig.
instead return `posix_prefix`, but that would not be correct, because
being that a public API it should only support the allowed input
arguments for it ("prefix", "home" or "user").
As per this, I feel the best way to handle this is instead in the
setuptools module so that we can check once again if --prefix has been
used and react accordingly.
[1] https:/
[2] https:/
Changed in setuptools (Debian): | |
status: | Unknown → New |