[issue43976] Allow Python distributors to add custom site install schemes

Filipe Laíns report at bugs.python.org
Mon May 3 14:12:28 EDT 2021


Filipe Laíns <lains at riseup.net> added the comment:

FYI, I have change the implementation to split the extra install schemes and extra schemes activated on site. This still makes sense over sitecustomize because we want the packages to be included in site.getsitepackages -- we want the vendor packages to essentially be the same as site-packages.

I have also moved sysconfig._get_preferred_schemes to the vendor config, instead of asking distributors to patch sysconfig -- this is why I prefer having it as executable code, we customize using functions, etc.
https://docs.python.org/3.10/library/sysconfig.html#sysconfig._get_preferred_schemes

A config taking advantage of all these mechanisms should look like this:

```
EXTRA_INSTALL_SCHEMES = {
    'vendor': {
        'stdlib': '{installed_base}/{platlibdir}/python{py_version_short}',
        'platstdlib': '{platbase}/{platlibdir}/python{py_version_short}',
        'purelib': '{base}/lib/python{py_version_short}/vendor-packages',
        'platlib': '{platbase}/{platlibdir}/python{py_version_short}/vendor-packages',
        'include':
            '{installed_base}/include/python{py_version_short}{abiflags}',
        'platinclude':
            '{installed_platbase}/include/python{py_version_short}{abiflags}',
        'scripts': '{base}/bin',
        'data': '{base}',
    },
}

EXTRA_SITE_INSTALL_SCHEMES = [
    'vendor',
]

def get_preferred_schemes(...):
    ...
```

Do you have any thoughts on this?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43976>
_______________________________________


More information about the Python-bugs-list mailing list