Change lib path "/usr/lib" -> "/usr/lib64" at 64bit env 74/207474/1 submit/tizen_base/20190703.054730 submit/tizen_base/20190807.005832 submit/tizen_base/20190812.045714
authorDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 5 Jun 2019 07:05:20 +0000 (16:05 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 5 Jun 2019 07:05:20 +0000 (16:05 +0900)
python3 crashed at 64bit env
================================================================
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
================================================================

Change-Id: Id76694616dfc53cec7547619c6931cb7a47be0a8
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
packaging/python-3.7.3_lib64.patch [new file with mode: 0644]
packaging/python3-base.spec
packaging/python3.spec

diff --git a/packaging/python-3.7.3_lib64.patch b/packaging/python-3.7.3_lib64.patch
new file mode 100644 (file)
index 0000000..cd030f2
--- /dev/null
@@ -0,0 +1,90 @@
+diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py
+index 0258d3d..4b969bf 100644
+--- a/Lib/distutils/command/install.py
++++ b/Lib/distutils/command/install.py
+@@ -30,14 +30,14 @@ WINDOWS_SCHEME = {
+ 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',
+diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
+index 83160f8..7aef07c 100644
+--- a/Lib/distutils/sysconfig.py
++++ b/Lib/distutils/sysconfig.py
+@@ -142,8 +142,11 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
+             prefix = plat_specific and EXEC_PREFIX or PREFIX
+     if os.name == "posix":
+-        libpython = os.path.join(prefix,
+-                                 "lib", "python" + get_python_version())
++        if plat_specific or standard_lib:
++            lib = "lib64"
++        else:
++            lib = "lib"
++        libpython = os.path.join(prefix, lib, "python" + get_python_version())
+         if standard_lib:
+             return libpython
+         else:
+diff --git a/Lib/site.py b/Lib/site.py
+index ad11463..f4563fe 100644
+--- a/Lib/site.py
++++ b/Lib/site.py
+@@ -334,11 +334,15 @@ def getsitepackages(prefixes=None):
+         seen.add(prefix)
+         if os.sep == '/':
++            sitepackages.append(os.path.join(prefix, "lib64",
++                                        "python%d.%d" % sys.version_info[:2],
++                                        "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
+diff --git a/Modules/getpath.c b/Modules/getpath.c
+index 67ceb87..a5b32ae 100644
+--- a/Modules/getpath.c
++++ b/Modules/getpath.c
+@@ -538,7 +538,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.) */
+ }
+@@ -790,7 +790,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);
+@@ -915,7 +915,7 @@ calculate_init(PyCalculatePath *calculate,
+     if (!calculate->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);
+     }
index 7d1f4285aaecbb04da23e8aa018e6ae10c2c99e6..70d08a6fce9a861fdcf8b06622436871360a5ff7 100644 (file)
@@ -89,6 +89,7 @@ Source8:        macros.python3.py
 Source9:        import_failed.py
 Source10:       import_failed.map
 
+
 # The following files are not used in the build.
 # They are listed here to work around missing functionality in rpmbuild,
 # which would otherwise exclude them from distributed src.rpm files.
@@ -96,6 +97,7 @@ Source100:      PACKAGING-NOTES
 Source101:      python3-rpmlintrc
 Source102:      pre_checkin.sh
 Source103:      skipped_tests.py
+Source104:      python-3.7.3_lib64.patch
 
 ##### REQURES, PROVIDES, OBSOLETES #####
 #Requires:       python-rpm-macros
@@ -229,6 +231,10 @@ other applications.
 %prep
 %setup -q -n %{tarname}
 
+%ifarch x86_64 aarch64
+%{__patch} -p1 < %{SOURCE104}
+%endif
+
 ### COMMON-PREP-BEGIN ###
 
 # drop Autoconf version requirement
index 0c7405325fac277231eae78931abe92ff88abb73..4c43511009518f8f008f2ed86673f2295e21bec0 100644 (file)
@@ -68,6 +68,8 @@ Group:          Development/Languages/Python
 Url:            http://www.python.org/
 Source0:        http://www.python.org/ftp/python/%{version}/%{tarname}.tar.xz
 #Source1:        http://www.python.org/ftp/python/%{version}/%{tarname}.tar.xz.asc
+Source100:      python-3.7.3_lib64.patch
+
 BuildRequires:  automake
 BuildRequires:  fdupes
 BuildRequires:  gcc-c++
@@ -154,6 +156,10 @@ Console User Interface.
 %setup -q -n %{tarname}
 ### COMMON-PREP-BEGIN ###
 
+%ifarch x86_64 aarch64
+%{__patch} -p1 < %{SOURCE100}
+%endif
+
 # drop Autoconf version requirement
 sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac