This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: sysconfig's posix_home scheme has different platlib value to distutils's unix_home
Type: Stage: resolved
Components: Distutils, Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: DiddiLeija, dstufft, eric.araujo, hroncok, miss-islington, pablogsal, petr.viktorin, uranusjr, vstinner
Priority: normal Keywords: patch

Created on 2021-08-28 06:43 by uranusjr, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 28011 merged uranusjr, 2021-08-28 06:54
PR 28196 closed miss-islington, 2021-09-07 10:27
PR 28201 merged pablogsal, 2021-09-07 11:17
PR 28204 closed vstinner, 2021-09-07 13:16
Messages (16)
msg400463 - (view) Author: Tzu-ping Chung (uranusjr) * Date: 2021-08-28 06:43
This is similar to bpo-44860, but in the other direction:

    $ docker run -it --rm -h=p fedora:34 bash
    ...
    [root@p /]# yum install python3 -y
    ...
    [root@p /]# type python3
    python3 is hashed (/usr/bin/python3)
    [root@p /]# python3 -V
    Python 3.9.6
    [root@p /]# python3.9 -q
    >>> from distutils.command.install import install
    >>> from distutils.dist import Distribution
    >>> c = install(Distribution())
    >>> c.home = '/foo'
    >>> c.finalize_options()
    >>> c.install_platlib
    '/foo/lib64/python'
    >>> import sysconfig
    >>> sysconfig.get_path('platlib', 'posix_home', vars={'home': '/root'})
    '/foo/lib/python'

sysconfig’s scheme should use `{platlib}` instead of hardcoding 'lib'.

Note that on Python 3.10+ the platlib values from distutils and sysconfig do match (since the distutils scheme is automatically generated from sysconfig), but the issue remains; sysconfig’s scheme should likely include `{platlib}` (adding Victor and Miro to confirm this).
msg401222 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-09-07 10:28
New changeset 4f88161f07538dfb24a43189fd59bf966cb40817 by Tzu-ping Chung in branch 'main':
bpo-45035: Make sysconfig posix_home depend on platlibdir (GH-28011)
https://github.com/python/cpython/commit/4f88161f07538dfb24a43189fd59bf966cb40817
msg401228 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2021-09-07 10:35
Here, I'm not sure. What do people use --home for?

I don't think we need to match the `/usr/` scheme here. For Python software that's not part of a distro, I think just `lib/` is fine.
msg401230 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-09-07 10:38
Hummmmm, I reviewed PR 38011 and the change made sense to me, but If you think we should reconsider PR 28011, please say so ASAP because the 3.10 backport is close to be merged
msg401234 - (view) Author: Miro Hrončok (hroncok) * Date: 2021-09-07 11:01
> I don't think we need to match the `/usr/` scheme here. For Python software that's not part of a distro, I think just `lib/` is fine.

I agree.
msg401235 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-09-07 11:06
Miro, Petr, do you think then that we should revert PR 28011
msg401236 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2021-09-07 11:07
The use case is a "personal stash of Python modules", described here: https://docs.python.org/3/install/#alternate-installation-the-home-scheme

We don't need the lib/lib64 distinction here.  I'd revert the 3.11 change and go with /lib/ only.
msg401238 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-09-07 11:17
Ok, I am reverting PR 28011. Someone should check it again and decide what to do, but this won't enter 3.10
msg401249 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-09-07 11:46
New changeset 97b754d4b46ad9dd63f68906484f805931578c81 by Pablo Galindo Salgado in branch 'main':
Revert "bpo-45035: Make sysconfig posix_home depend on platlibdir (GH-28011)" (GH-28201)
https://github.com/python/cpython/commit/97b754d4b46ad9dd63f68906484f805931578c81
msg401262 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-09-07 13:19
See also the email on python-dev:
https://mail.python.org/archives/list/python-dev@python.org/thread/5UU6V2B3KBS4Z7OG5T7D6YQZASFNSBJM/
msg401265 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-09-07 13:22
I wrote the PR 28204 to change the unix_home used by the distutils install command. Previous code:

        if sys.version_info >= (3, 9) and key == "platlib":
            # platlibdir is available since 3.9: bpo-1294959
            value = value.replace("/lib/", "/$platlibdir/")
        INSTALL_SCHEMES[main_key][key] = value

This code was added by:

commit 341e8a939aca6e9f59ffb0e6daee5888933694ed
Author: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
Date:   Wed Apr 14 17:12:34 2021 +0200

    bpo-41282: (PEP 632) Load install schemes from sysconfig (GH-24549)

Modifying the unix_home was not the intended behavior.
msg401267 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-09-07 13:35
I'm doing the release of 3.10.0rc2 as we speak. Please, review this ASAP or otherwise this PR will not be backported to 3.10.0 and will have to wait to 3.10.1 as per the devguide.
msg401268 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2021-09-07 13:41
AFAICS: this is a bug, but in deprecated code. Not worth fixing in 3.11, and definitely not worth fixing in a RC, and .

People should stop using distutils, and those who can't won't be happy with changes to it. Consider that existing distutils issues on bpo were already auto-closed.
msg401270 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2021-09-07 13:42
(Sorry for the extra `and`; I hit Submit too soon)
msg402384 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-09-21 22:12
Should we simply close the issue and leave distutils as it is?
msg406847 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2021-11-23 15:46
Yes. This is a minor bug in the deprecated distutils module.
History
Date User Action Args
2022-04-11 14:59:49adminsetgithub: 89198
2021-11-23 15:46:54petr.viktorinsetstatus: open -> closed
resolution: wont fix
messages: + msg406847

stage: patch review -> resolved
2021-09-21 22:12:31vstinnersetmessages: + msg402384
2021-09-07 14:11:23DiddiLeijasetnosy: + DiddiLeija
2021-09-07 13:42:51petr.viktorinsetmessages: + msg401270
2021-09-07 13:41:37petr.viktorinsetmessages: + msg401268
2021-09-07 13:35:59pablogsalsetmessages: + msg401267
2021-09-07 13:22:50vstinnersetmessages: + msg401265
2021-09-07 13:19:04vstinnersetmessages: + msg401262
2021-09-07 13:16:54vstinnersetpull_requests: + pull_request26628
2021-09-07 11:46:29pablogsalsetmessages: + msg401249
2021-09-07 11:17:56pablogsalsetmessages: + msg401238
2021-09-07 11:17:16pablogsalsetpull_requests: + pull_request26626
2021-09-07 11:07:31petr.viktorinsetmessages: + msg401236
2021-09-07 11:06:28pablogsalsetmessages: + msg401235
2021-09-07 11:01:44hroncoksetmessages: + msg401234
2021-09-07 10:38:40pablogsalsetmessages: + msg401230
2021-09-07 10:35:18petr.viktorinsetnosy: + petr.viktorin
messages: + msg401228
2021-09-07 10:28:21pablogsalsetnosy: + pablogsal
messages: + msg401222
2021-09-07 10:27:58miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request26621
2021-08-28 06:54:08uranusjrsetkeywords: + patch
stage: patch review
pull_requests: + pull_request26454
2021-08-28 06:43:22uranusjrcreate