From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Fedora Python maintainers Date: Wed, 15 Jul 2020 15:18:37 +0200 Subject: [PATCH] 00102-2.7.13-lib64.patch Only used when "%%{_lib}" == "lib64" Fixup various paths throughout the build and in distutils from "lib" to "lib64", and add the /usr/lib64/pythonMAJOR.MINOR/site-packages to sitedirs, in front of /usr/lib/pythonMAJOR.MINOR/site-packages Not upstream --- Lib/distutils/command/install.py | 4 ++-- Lib/distutils/sysconfig.py | 6 +++++- Lib/site.py | 4 ++++ Lib/test/test_site.py | 11 +++++++---- Makefile.pre.in | 2 +- Modules/Setup.dist | 6 +++--- Modules/getpath.c | 4 ++-- setup.py | 10 +++++----- 8 files changed, 29 insertions(+), 18 deletions(-) diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py index b9f1c6c566f..7b237149335 100644 --- a/Lib/distutils/command/install.py +++ b/Lib/distutils/command/install.py @@ -42,14 +42,14 @@ else: 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/$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', diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py index 1a4b7926441..a485419a7e5 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -129,8 +129,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: diff --git a/Lib/site.py b/Lib/site.py index 3b51e81d4a1..9fd76c8157a 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -288,12 +288,16 @@ def getsitepackages(): if sys.platform in ('os2emx', 'riscos'): sitepackages.append(os.path.join(prefix, "Lib", "site-packages")) elif os.sep == '/': + sitepackages.append(os.path.join(prefix, "lib64", + "python" + sys.version[:3], + "site-packages")) sitepackages.append(os.path.join(prefix, "lib", "python" + sys.version[:3], "site-packages")) sitepackages.append(os.path.join(prefix, "lib", "site-python")) else: sitepackages.append(prefix) + sitepackages.append(os.path.join(prefix, "lib64", "site-packages")) sitepackages.append(os.path.join(prefix, "lib", "site-packages")) return sitepackages diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py index b4384ee2cf8..349f6885655 100644 --- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -254,17 +254,20 @@ class HelperFunctionsTests(unittest.TestCase): self.assertEqual(dirs[0], wanted) elif os.sep == '/': # OS X, Linux, FreeBSD, etc - self.assertEqual(len(dirs), 2) - wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3], + self.assertEqual(len(dirs), 3) + wanted = os.path.join('xoxo', 'lib64', 'python' + sys.version[:3], 'site-packages') self.assertEqual(dirs[0], wanted) + wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3], + 'site-packages') + self.assertEqual(dirs[1], wanted) wanted = os.path.join('xoxo', 'lib', 'site-python') - self.assertEqual(dirs[1], wanted) + self.assertEqual(dirs[2], wanted) else: # other platforms self.assertEqual(len(dirs), 2) self.assertEqual(dirs[0], 'xoxo') - wanted = os.path.join('xoxo', 'lib', 'site-packages') + wanted = os.path.join('xoxo', 'lib64', 'site-packages') self.assertEqual(dirs[1], wanted) def test_no_home_directory(self): diff --git a/Makefile.pre.in b/Makefile.pre.in index 0e6246ae055..3be3b535d3c 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -110,7 +110,7 @@ LIBDIR= @libdir@ MANDIR= @mandir@ INCLUDEDIR= @includedir@ CONFINCLUDEDIR= $(exec_prefix)/include -SCRIPTDIR= $(prefix)/lib +SCRIPTDIR= $(prefix)/lib64 # Detailed destination directories BINLIBDEST= $(LIBDIR)/python$(VERSION) diff --git a/Modules/Setup.dist b/Modules/Setup.dist index 2cf35a9640d..c4c88cbf964 100644 --- a/Modules/Setup.dist +++ b/Modules/Setup.dist @@ -231,7 +231,7 @@ crypt cryptmodule.c # -lcrypt # crypt(3); needs -lcrypt on some systems # Some more UNIX dependent modules -- off by default, since these # are not supported by all UNIX systems: -nis nismodule.c -lnsl -ltirpc -I/usr/include/tirpc -I/usr/include/nsl -L/usr/lib/nsl +nis nismodule.c -lnsl -ltirpc -I/usr/include/tirpc -I/usr/include/nsl -L/usr/lib64/nsl termios termios.c # Steen Lumholt's termios module resource resource.c # Jeremy Hylton's rlimit interface @@ -416,7 +416,7 @@ gdbm gdbmmodule.c -lgdbm # Edit the variables DB and DBLIBVERto point to the db top directory # and the subdirectory of PORT where you built it. DBINC=/usr/include/libdb -DBLIB=/usr/lib +DBLIB=/usr/lib64 _bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb # Historical Berkeley DB 1.85 @@ -462,7 +462,7 @@ cPickle cPickle.c # Andrew Kuchling's zlib module. # This require zlib 1.1.3 (or later). # See http://www.gzip.org/zlib/ -zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz +zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib64 -lz # Interface to the Expat XML parser # More information on Expat can be found at www.libexpat.org. diff --git a/Modules/getpath.c b/Modules/getpath.c index 092ccc712f9..20d1779d937 100644 --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -108,7 +108,7 @@ static char prefix[MAXPATHLEN+1]; static char exec_prefix[MAXPATHLEN+1]; static char progpath[MAXPATHLEN+1]; static char *module_search_path = NULL; -static char lib_python[] = "lib/python" VERSION; +static char lib_python[] = "lib64/python" VERSION; static void reduce(char *dir) @@ -530,7 +530,7 @@ calculate_path(void) fprintf(stderr, "Could not find platform dependent libraries \n"); strncpy(exec_prefix, EXEC_PREFIX, MAXPATHLEN); - joinpath(exec_prefix, "lib/lib-dynload"); + joinpath(exec_prefix, "lib64/lib-dynload"); } /* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */ diff --git a/setup.py b/setup.py index f764223d062..ca48b11c278 100644 --- a/setup.py +++ b/setup.py @@ -502,7 +502,7 @@ class PyBuildExt(build_ext): def detect_modules(self): # Ensure that /usr/local is always used 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') if cross_compiling: self.add_gcc_paths() @@ -828,11 +828,11 @@ class PyBuildExt(build_ext): 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: @@ -867,8 +867,8 @@ class PyBuildExt(build_ext): if krb5_h: ssl_incs += krb5_h ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, - ['/usr/local/ssl/lib', - '/usr/contrib/ssl/lib/' + ['/usr/local/ssl/lib64', + '/usr/contrib/ssl/lib64/' ] ) if (ssl_incs is not None and