python3: Fix dependencies. Remove extra code

This commit is contained in:
Alexey Pavlov
2018-07-06 11:01:45 +03:00
parent edc01d04d6
commit 2ee64da925
3 changed files with 6 additions and 60 deletions

View File

@@ -1,15 +1,13 @@
diff -Naur Python-3.7.0-orig/Include/pylifecycle.h Python-3.7.0/Include/pylifecycle.h
--- Python-3.7.0-orig/Include/pylifecycle.h 2018-06-27 06:07:35.000000000 +0300
+++ Python-3.7.0/Include/pylifecycle.h 2018-06-30 11:16:58.992697600 +0300
@@ -36,6 +36,12 @@
@@ -36,6 +36,10 @@
#endif
+PyAPI_FUNC(wchar_t) Py_GetSepW(wchar_t *);
+PyAPI_FUNC(char) Py_GetSepA(char *);
+
+PyAPI_FUNC(void) Py_NormalizeSepsW(wchar_t *);
+PyAPI_FUNC(void) Py_NormalizeSepsA(char *);
+
PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *);
@@ -344,7 +342,7 @@ diff -Naur Python-3.7.0-orig/Modules/posixmodule.c Python-3.7.0/Modules/posixmod
diff -Naur Python-3.7.0-orig/Python/pathconfig.c Python-3.7.0/Python/pathconfig.c
--- Python-3.7.0-orig/Python/pathconfig.c 2018-06-27 06:07:35.000000000 +0300
+++ Python-3.7.0/Python/pathconfig.c 2018-06-30 11:16:59.023897600 +0300
@@ -9,6 +9,114 @@
@@ -9,6 +9,62 @@
extern "C" {
#endif
@@ -353,58 +351,6 @@ diff -Naur Python-3.7.0-orig/Python/pathconfig.c Python-3.7.0/Python/pathconfig.
+#include <windows.h>
+#endif
+
+char
+Py_GetSepA(char *name)
+{
+ char* msystem = (char*)2; /* So that non Windows use / as sep */
+ static char sep = '\0';
+#ifdef _WIN32
+ /* https://msdn.microsoft.com/en-gb/library/windows/desktop/aa365247%28v=vs.85%29.aspx
+ * The "\\?\" prefix .. indicate that the path should be passed to the system with minimal
+ * modification, which means that you cannot use forward slashes to represent path separators
+ */
+ if (name != NULL && memcmp(name, "\\\\?\\", sizeof("\\\\?\\") - sizeof(char)) == 0)
+ {
+ return '\\';
+ }
+#endif
+ if (sep != '\0')
+ return sep;
+#if defined(__MINGW32__)
+ msystem = Py_GETENV("MSYSTEM");
+#endif
+ if (msystem != NULL)
+ sep = '/';
+ else
+ sep = '\\';
+ return sep;
+}
+
+static wchar_t
+Py_GetAltSepA(char *name)
+{
+ char sep = Py_GetSepA(name);
+ if (sep == '/')
+ return '\\';
+ return '/';
+}
+
+void
+Py_NormalizeSepsA(char *name)
+{
+ char sep = Py_GetSepA(name);
+ char altsep = Py_GetAltSepA(name);
+ char* seps;
+ if (strlen(name) > 1 && name[1] == ':') {
+ name[0] = toupper(name[0]);
+ }
+ seps = strchr(name, altsep);
+ while(seps) {
+ *seps = sep;
+ seps = strchr(seps, altsep);
+ }
+}
+
+wchar_t
+Py_GetSepW(wchar_t *name)
+{

View File

@@ -197,7 +197,7 @@ diff -Naur Python-3.7.0-orig/Modules/getpath.c Python-3.7.0/Modules/getpath.c
}
- calculate->lib_python = Py_DecodeLocale("lib/python" VERSION, &len);
+ Py_NormalizeSepsW(calculate->exec_prefix);
+ const char *lib_python_VERSION = (Py_GetSepA(NULL) == '/') ? "lib/python" VERSION : "lib\\python" VERSION;
+ const char *lib_python_VERSION = (Py_GetSepW(NULL) == L'/') ? "lib/python" VERSION : "lib\\python" VERSION;
+ calculate->lib_python = Py_DecodeLocale(lib_python_VERSION, &len);
if (!calculate->lib_python) {
return DECODE_LOCALE_ERR("EXEC_PREFIX define", len);

View File

@@ -27,7 +27,7 @@ depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
"${MINGW_PACKAGE_PREFIX}-expat"
"${MINGW_PACKAGE_PREFIX}-bzip2"
"${MINGW_PACKAGE_PREFIX}-libffi"
"${MINGW_PACKAGE_PREFIX}-libmpcdec"
"${MINGW_PACKAGE_PREFIX}-mpdecimal"
"${MINGW_PACKAGE_PREFIX}-ncurses"
"${MINGW_PACKAGE_PREFIX}-openssl"
"${MINGW_PACKAGE_PREFIX}-readline"
@@ -464,8 +464,8 @@ sha256sums=('0382996d1ee6aafe59763426cf0139ffebe36984474d0ec4126dd1c40a8b3549'
'10701638d3cc24ee58351cfeb7fc51cf73876f1377344eb805172c55c7d6bbda'
'63d75a9b2e70c209c24037b28365ee82da5b8895b68877443c551c08e565e035'
'4675f4245861062b6b797173eb0351b60a9ef0fb616e72afa2c1577e231ca36b'
'c12865395f185b0e08196bfcc1a458a819bfea3fa4e4ad3459d3413b92c30f59'
'609866ecdd1da7108d2d2451482370d80ed8fd382f1f86c21e9f4d98652078fd'
'558b780999e9ae591ac665e44df49bae36778da8d61e3c7a38b52ead24b98d04'
'fa0ace0f24e4458b720952edad41d6acb14b161ee7cf90c8e129288a97c338d2'
'f31f8b180db2d3c6b2160cb127aa96f10162d8c88b67d5f31e0d838a9346218a'
'd73760ff429ec8203933a17dc541c28f7798ee9696ab57148bf4bcb83934fbd8'
'098f4f1dfbfb548a77f08bf226478527565a38fe56a45c7cae4fe52513f87620'