Skip to content

Commit

Permalink
00102: Change the various install paths to use /usr/lib64/ instead or…
Browse files Browse the repository at this point in the history
… /usr/lib/

Only used when "%{_lib}" == "lib64".

Also sets sys.platlibdir to "lib64" for pypa/distutils#110

Co-authored-by: David Malcolm <dmalcolm@redhat.com>
Co-authored-by: Thomas Spura <tomspur@fedoraproject.org>
Co-authored-by: Slavek Kabrda <bkabrda@redhat.com>
Co-authored-by: Matej Stuchlik <mstuchli@redhat.com>
Co-authored-by: Tomas Orsava <torsava@redhat.com>
Co-authored-by: Charalampos Stratakis <cstratak@redhat.com>
Co-authored-by: Petr Viktorin <pviktori@redhat.com>
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: Iryna Shcherbina <shcherbina.iryna@gmail.com>
  • Loading branch information
9 people authored and hrnciar committed Dec 7, 2022
1 parent 126f5a6 commit 9d2fc95
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Lib/distutils/command/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
INSTALL_SCHEMES = {
'unix_prefix': {
'purelib': '$base/lib/python$py_version_short/site-packages',
'platlib': '$platbase/lib/python$py_version_short/site-packages',
'platlib': '$platbase/lib64/python$py_version_short/site-packages',
'headers': '$base/include/python$py_version_short$abiflags/$dist_name',
'scripts': '$base/bin',
'data' : '$base',
},
'unix_home': {
'purelib': '$base/lib/python',
'platlib': '$base/lib/python',
'platlib': '$base/lib64/python',
'headers': '$base/include/python/$dist_name',
'scripts': '$base/bin',
'data' : '$base',
Expand Down
6 changes: 5 additions & 1 deletion Lib/distutils/sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,12 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
prefix = plat_specific and EXEC_PREFIX or PREFIX

if os.name == "posix":
if plat_specific or standard_lib:
lib = "lib64"
else:
lib = "lib"
libpython = os.path.join(prefix,
"lib", "python" + get_python_version())
lib, "python" + get_python_version())
if standard_lib:
return libpython
else:
Expand Down
3 changes: 2 additions & 1 deletion Lib/distutils/tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ def check_path(got, expected):
self.assertEqual(got, expected)

libdir = os.path.join(destination, "lib", "python")
platlibdir = os.path.join(destination, "lib64", "python")
check_path(cmd.install_lib, libdir)
check_path(cmd.install_platlib, libdir)
check_path(cmd.install_platlib, platlibdir)
check_path(cmd.install_purelib, libdir)
check_path(cmd.install_headers,
os.path.join(destination, "include", "python", "foopkg"))
Expand Down
4 changes: 4 additions & 0 deletions Lib/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,15 @@ def getsitepackages(prefixes=None):
seen.add(prefix)

if os.sep == '/':
sitepackages.append(os.path.join(prefix, "lib64",
"python" + sys.version[:3],
"site-packages"))
sitepackages.append(os.path.join(prefix, "lib",
"python%d.%d" % sys.version_info[:2],
"site-packages"))
else:
sitepackages.append(prefix)
sitepackages.append(os.path.join(prefix, "lib64", "site-packages"))
sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
return sitepackages

Expand Down
12 changes: 6 additions & 6 deletions Lib/sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

_INSTALL_SCHEMES = {
'posix_prefix': {
'stdlib': '{installed_base}/lib/python{py_version_short}',
'platstdlib': '{platbase}/lib/python{py_version_short}',
'stdlib': '{installed_base}/lib64/python{py_version_short}',
'platstdlib': '{platbase}/lib64/python{py_version_short}',
'purelib': '{base}/lib/python{py_version_short}/site-packages',
'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
'platlib': '{platbase}/lib64/python{py_version_short}/site-packages',
'include':
'{installed_base}/include/python{py_version_short}{abiflags}',
'platinclude':
Expand Down Expand Up @@ -62,10 +62,10 @@
'data': '{userbase}',
},
'posix_user': {
'stdlib': '{userbase}/lib/python{py_version_short}',
'platstdlib': '{userbase}/lib/python{py_version_short}',
'stdlib': '{userbase}/lib64/python{py_version_short}',
'platstdlib': '{userbase}/lib64/python{py_version_short}',
'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
'platlib': '{userbase}/lib64/python{py_version_short}/site-packages',
'include': '{userbase}/include/python{py_version_short}',
'scripts': '{userbase}/bin',
'data': '{userbase}',
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ def test_getsitepackages(self):
dirs = site.getsitepackages()
if os.sep == '/':
# OS X, Linux, FreeBSD, etc
self.assertEqual(len(dirs), 1)
wanted = os.path.join('xoxo', 'lib',
self.assertEqual(len(dirs), 2)
wanted = os.path.join('xoxo', 'lib64',
'python%d.%d' % sys.version_info[:2],
'site-packages')
self.assertEqual(dirs[0], wanted)
Expand Down
2 changes: 1 addition & 1 deletion Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ LIBDIR= @libdir@
MANDIR= @mandir@
INCLUDEDIR= @includedir@
CONFINCLUDEDIR= $(exec_prefix)/include
SCRIPTDIR= $(prefix)/lib
SCRIPTDIR= $(prefix)/lib64
ABIFLAGS= @ABIFLAGS@

# Detailed destination directories
Expand Down
6 changes: 3 additions & 3 deletions Modules/getpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ calculate_exec_prefix(const _PyCoreConfig *core_config,
"Could not find platform dependent libraries <exec_prefix>\n");
}
wcsncpy(exec_prefix, calculate->exec_prefix, MAXPATHLEN);
joinpath(exec_prefix, L"lib/lib-dynload");
joinpath(exec_prefix, L"lib64/lib-dynload");
}
/* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */
}
Expand Down Expand Up @@ -783,7 +783,7 @@ calculate_zip_path(PyCalculatePath *calculate, const wchar_t *prefix)
else {
wcsncpy(calculate->zip_path, calculate->prefix, MAXPATHLEN);
}
joinpath(calculate->zip_path, L"lib/python00.zip");
joinpath(calculate->zip_path, L"lib64/python00.zip");

/* Replace "00" with version */
size_t bufsz = wcslen(calculate->zip_path);
Expand Down Expand Up @@ -908,7 +908,7 @@ calculate_init(PyCalculatePath *calculate,
if (!calculate->exec_prefix) {
return DECODE_LOCALE_ERR("EXEC_PREFIX define", len);
}
calculate->lib_python = Py_DecodeLocale("lib/python" VERSION, &len);
calculate->lib_python = Py_DecodeLocale("lib64/python" VERSION, &len);
if (!calculate->lib_python) {
return DECODE_LOCALE_ERR("EXEC_PREFIX define", len);
}
Expand Down
4 changes: 4 additions & 0 deletions Python/sysmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2411,6 +2411,10 @@ _PySys_BeginInit(PyObject **sysmod)
PyUnicode_FromString(ABIFLAGS));
#endif

/* platlibdir is used in pypa/distutils */
SET_SYS_FROM_STRING("platlibdir",
PyUnicode_FromString("lib64"));

/* version_info */
if (VersionInfoType.tp_name == NULL) {
if (PyStructSequence_InitType2(&VersionInfoType,
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4777,9 +4777,9 @@ AC_MSG_RESULT($LDVERSION)
dnl define LIBPL after ABIFLAGS and LDVERSION is defined.
AC_SUBST(PY_ENABLE_SHARED)
if test x$PLATFORM_TRIPLET = x; then
LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
LIBPL='$(prefix)'"/lib64/python${VERSION}/config-${LDVERSION}"
else
LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
LIBPL='$(prefix)'"/lib64/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
fi
AC_SUBST(LIBPL)

Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ def detect_modules(self):
# directories (i.e. '.' and 'Include') must be first. See issue
# 10520.
if not cross_compiling:
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib64')
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
# only change this for cross builds for 3.3, issues on Mageia
if cross_compiling:
Expand Down Expand Up @@ -891,11 +891,11 @@ def detect_modules(self):
elif curses_library:
readline_libs.append(curses_library)
elif self.compiler.find_library_file(lib_dirs +
['/usr/lib/termcap'],
['/usr/lib64/termcap'],
'termcap'):
readline_libs.append('termcap')
exts.append( Extension('readline', ['readline.c'],
library_dirs=['/usr/lib/termcap'],
library_dirs=['/usr/lib64/termcap'],
extra_link_args=readline_extra_link_args,
libraries=readline_libs) )
else:
Expand Down

0 comments on commit 9d2fc95

Please sign in to comment.