@@ -40,6 +40,11 @@ function build_conf_python() { | |||
local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}" | |||
if [ "${CROSS_COMPILING}" -eq 1 ]; then | |||
extraconfrules+=" --host=${TOOLCHAIN_PREFIX} --build=x86_64-linux-gnu" | |||
export PYTHON_FOR_BUILD=python3 | |||
fi | |||
_prebuild "${name}" "${pkgdir}" | |||
# remove flags not compatible with python | |||
@@ -49,6 +54,13 @@ function build_conf_python() { | |||
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,-dead_strip -Wl,-dead_strip_dylibs//')" | |||
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-fdata-sections -ffunction-sections//')" | |||
if [ ! -f "${pkgdir}/.stamp_preconfigured" ] && [ "${WIN32}" -eq 1 ]; then | |||
pushd "${pkgdir}" | |||
autoreconf -vfi | |||
touch .stamp_preconfigured | |||
popd | |||
fi | |||
if [ ! -f "${pkgdir}/.stamp_configured" ]; then | |||
pushd "${pkgdir}" | |||
./configure ${extraconfrules} | |||
@@ -58,6 +70,11 @@ function build_conf_python() { | |||
if [ ! -f "${pkgdir}/.stamp_built" ]; then | |||
pushd "${pkgdir}" | |||
if [ "${WIN32}" -eq 1 ]; then | |||
sed -i -e 's|./Programs/_freeze_importlib zipimport|./Programs/_freeze_importlib$(EXE) zipimport|' Makefile | |||
sed -i -e 's|\twindres|\tx86_64-w64-mingw32-windres|' Makefile | |||
make regen-importlib | |||
fi | |||
make ${MAKE_ARGS} ${EXTRA_MAKE_ARGS} | |||
touch .stamp_built | |||
popd | |||
@@ -133,6 +150,29 @@ fi | |||
if [ "${MACOS_UNIVERSAL}" -eq 1 ]; then | |||
PYTHON_EXTRAFLAGS="--enable-optimizations" | |||
elif [ "${WIN32}" -eq 1 ]; then | |||
export EXTRA_CFLAGS=" -fwrapv -D__USE_MINGW_ANSI_STDIO=1 -D_WIN32_WINNT=0x0601" | |||
export EXTRA_CXXFLAGS=" -fwrapv -D__USE_MINGW_ANSI_STDIO=1 -D_WIN32_WINNT=0x0601" | |||
PYTHON_EXTRAFLAGS="--with-nt-threads" | |||
PYTHON_EXTRAFLAGS+=" --without-ensurepip" | |||
PYTHON_EXTRAFLAGS+=" --without-c-locale-coercion" | |||
# PYTHON_EXTRAFLAGS+=" --enable-optimizations" | |||
# Workaround for conftest error on 64-bit builds | |||
PYTHON_EXTRAFLAGS+=" ac_cv_working_tzset=no" | |||
# Workaround for when dlfcn exists on Windows, which causes | |||
# some conftests to succeed when they shouldn't (we don't use dlfcn). | |||
PYTHON_EXTRAFLAGS+=" ac_cv_header_dlfcn_h=no" | |||
PYTHON_EXTRAFLAGS+=" ac_cv_lib_dl_dlopen=no" | |||
PYTHON_EXTRAFLAGS+=" ac_cv_have_decl_RTLD_GLOBAL=no" | |||
PYTHON_EXTRAFLAGS+=" ac_cv_have_decl_RTLD_LAZY=no" | |||
PYTHON_EXTRAFLAGS+=" ac_cv_have_decl_RTLD_LOCAL=no" | |||
PYTHON_EXTRAFLAGS+=" ac_cv_have_decl_RTLD_NOW=no" | |||
PYTHON_EXTRAFLAGS+=" ac_cv_have_decl_RTLD_DEEPBIND=no" | |||
PYTHON_EXTRAFLAGS+=" ac_cv_have_decl_RTLD_MEMBER=no" | |||
PYTHON_EXTRAFLAGS+=" ac_cv_have_decl_RTLD_NODELETE=no" | |||
PYTHON_EXTRAFLAGS+=" ac_cv_have_decl_RTLD_NOLOAD=no" | |||
PYTHON_EXTRAFLAGS+=" OPT=" | |||
export MSYSTEM=MINGW | |||
fi | |||
download Python "${PYTHON_VERSION}" "https://www.python.org/ftp/python/${PYTHON_VERSION}" "tgz" | |||
@@ -141,6 +181,10 @@ if [ "${PYTHON_VERSION}" = "3.7.4" ]; then | |||
fi | |||
build_conf_python Python "${PYTHON_VERSION}" "--prefix=${PAWPAW_PREFIX} --enable-shared ${PYTHON_EXTRAFLAGS}" | |||
if [ "${WIN32}" -eq 1 ]; then | |||
unset MSYSTEM | |||
endif | |||
# --------------------------------------------------------------------------------------------------------------------- | |||
# sip | |||
@@ -0,0 +1,41 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/sysconfig.py Python-3.8.0/Lib/sysconfig.py | |||
--- Python-3.8.0-orig/Lib/sysconfig.py 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Lib/sysconfig.py 2019-10-22 10:00:17.317067000 +0300 | |||
@@ -2,6 +2,7 @@ | |||
import os | |||
import sys | |||
+import textwrap | |||
from os.path import pardir, realpath | |||
__all__ = [ | |||
@@ -405,11 +406,29 @@ | |||
os.makedirs(pybuilddir, exist_ok=True) | |||
destfile = os.path.join(pybuilddir, name + '.py') | |||
+ replacement = """ | |||
+ keys_to_replace = [ | |||
+ 'BINDIR', 'BINLIBDEST', 'CONFINCLUDEDIR', | |||
+ 'CONFINCLUDEPY', 'DESTDIRS', 'DESTLIB', 'DESTSHARED', | |||
+ 'INCLDIRSTOMAKE', 'INCLUDEDIR', 'INCLUDEPY', | |||
+ 'LIBDEST', 'LIBDIR', 'LIBPC', 'LIBPL', 'MACHDESTLIB', | |||
+ 'MANDIR', 'SCRIPTDIR', 'datarootdir', 'exec_prefix', | |||
+ ] | |||
+ | |||
+ prefix = build_time_vars['BINDIR'][:-4] | |||
+ | |||
+ for key in keys_to_replace: | |||
+ value = build_time_vars[key] | |||
+ build_time_vars[key] = value.replace(prefix, sys.prefix) | |||
+ """ | |||
+ | |||
with open(destfile, 'w', encoding='utf8') as f: | |||
+ f.write('import sys\n') | |||
f.write('# system configuration generated and used by' | |||
' the sysconfig module\n') | |||
f.write('build_time_vars = ') | |||
pprint.pprint(vars, stream=f) | |||
+ f.write('\n%s' % textwrap.dedent(replacement)) | |||
# Create file used for sys.path fixup -- see Modules/getpath.c | |||
with open('pybuilddir.txt', 'w', encoding='utf8') as f: |
@@ -0,0 +1,50 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/spawn.py Python-3.8.0/Lib/distutils/spawn.py | |||
--- Python-3.8.0-orig/Lib/distutils/spawn.py 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Lib/distutils/spawn.py 2019-10-22 10:00:23.260677500 +0300 | |||
@@ -12,6 +12,7 @@ | |||
from distutils.errors import DistutilsPlatformError, DistutilsExecError | |||
from distutils.debug import DEBUG | |||
from distutils import log | |||
+from subprocess import list2cmdline | |||
def spawn(cmd, search_path=1, verbose=0, dry_run=0): | |||
"""Run another program, specified as a command list 'cmd', in a new process. | |||
@@ -43,17 +44,13 @@ | |||
def _nt_quote_args(args): | |||
"""Quote command-line arguments for DOS/Windows conventions. | |||
- Just wraps every argument which contains blanks in double quotes, and | |||
- returns a new argument list. | |||
+ Defer to subprocess module's list2cmdline as the logic is | |||
+ complex. The previous implementation here failed to handle | |||
+ -DG_LOG_DOMAIN="GEGL-"__FILE__ which was encountered in MSYS2 | |||
+ while building the gobject-introspection part of GEGL 0.3.4. | |||
""" | |||
- # XXX this doesn't seem very robust to me -- but if the Windows guys | |||
- # say it'll work, I guess I'll have to accept it. (What if an arg | |||
- # contains quotes? What other magic characters, other than spaces, | |||
- # have to be escaped? Is there an escaping mechanism other than | |||
- # quoting?) | |||
for i, arg in enumerate(args): | |||
- if ' ' in arg: | |||
- args[i] = '"%s"' % arg | |||
+ args[i] = list2cmdline([args[i]]) | |||
return args | |||
def _spawn_nt(cmd, search_path=1, verbose=0, dry_run=0): | |||
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py | |||
--- Python-3.8.0-orig/setup.py 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/setup.py 2019-10-22 10:00:23.666278200 +0300 | |||
@@ -1421,11 +1421,7 @@ | |||
'_sqlite/statement.c', | |||
'_sqlite/util.c', ] | |||
- sqlite_defines = [] | |||
- if not MS_WINDOWS: | |||
- sqlite_defines.append(('MODULE_NAME', '"sqlite3"')) | |||
- else: | |||
- sqlite_defines.append(('MODULE_NAME', '\\"sqlite3\\"')) | |||
+ sqlite_defines = [('MODULE_NAME', '"sqlite3"')] | |||
# Enable support for loadable extensions in the sqlite3 module | |||
# if --enable-loadable-sqlite-extensions configure option is used. |
@@ -0,0 +1,62 @@ | |||
diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac | |||
--- Python-3.8.0-orig/configure.ac 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-22 10:00:26.817483700 +0300 | |||
@@ -5624,7 +5624,7 @@ | |||
# generate output files | |||
-AC_CONFIG_FILES(Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh) | |||
+AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc Misc/python-embed.pc Misc/python-config.sh) | |||
AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix]) | |||
AC_OUTPUT | |||
@@ -5636,7 +5636,7 @@ | |||
echo "creating Makefile" >&AS_MESSAGE_FD | |||
$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \ | |||
- -s Modules \ | |||
+ -s Modules Modules/Setup.config \ | |||
Modules/Setup.local $srcdir/Modules/Setup | |||
mv config.c Modules | |||
diff -Naur Python-3.8.0-orig/Makefile.pre.in Python-3.8.0/Makefile.pre.in | |||
--- Python-3.8.0-orig/Makefile.pre.in 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Makefile.pre.in 2019-10-22 10:00:27.207484400 +0300 | |||
@@ -683,10 +683,12 @@ | |||
Makefile Modules/config.c: Makefile.pre \ | |||
$(srcdir)/Modules/config.c.in \ | |||
$(MAKESETUP) \ | |||
+ Modules/Setup.config \ | |||
$(srcdir)/Modules/Setup \ | |||
Modules/Setup.local | |||
$(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \ | |||
-s Modules \ | |||
+ Modules/Setup.config \ | |||
Modules/Setup.local \ | |||
$(srcdir)/Modules/Setup | |||
@mv config.c Modules | |||
@@ -1574,6 +1576,7 @@ | |||
$(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile | |||
$(INSTALL_DATA) $(srcdir)/Modules/Setup $(DESTDIR)$(LIBPL)/Setup | |||
$(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local | |||
+ $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config | |||
$(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc | |||
$(INSTALL_DATA) Misc/python-embed.pc $(DESTDIR)$(LIBPC)/python-$(VERSION)-embed.pc | |||
$(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup | |||
@@ -1789,6 +1792,7 @@ | |||
if test "$$file" != "$(srcdir)/Lib/test/data/README"; then rm "$$file"; fi; \ | |||
done | |||
-rm -f core Makefile Makefile.pre config.status Modules/Setup.local \ | |||
+ Modules/Setup.config \ | |||
Modules/ld_so_aix Modules/python.exp Misc/python.pc \ | |||
Misc/python-embed.pc Misc/python-config.sh | |||
-rm -f python*-gdb.py | |||
diff -Naur Python-3.8.0-orig/Modules/Setup.config.in Python-3.8.0/Modules/Setup.config.in | |||
--- Python-3.8.0-orig/Modules/Setup.config.in 1970-01-01 03:00:00.000000000 +0300 | |||
+++ Python-3.8.0/Modules/Setup.config.in 2019-10-22 10:00:27.613085100 +0300 | |||
@@ -0,0 +1,5 @@ | |||
+# This file is transmogrified into Setup.config by config.status. | |||
+ | |||
+# The purpose of this file is to conditionally enable certain modules | |||
+# based on configure-time options. | |||
+ |
@@ -0,0 +1,211 @@ | |||
diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac | |||
--- Python-3.8.0-orig/configure.ac 2019-10-22 10:00:29.329088100 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-22 10:00:31.778292400 +0300 | |||
@@ -1960,6 +1960,46 @@ | |||
BASECFLAGS="$BASECFLAGS $ac_arch_flags" | |||
fi | |||
+dnl NOTE: | |||
+dnl - GCC 4.4+ for mingw* require and use posix threads(pthreads-w32) | |||
+dnl - Host may contain installed pthreads-w32. | |||
+dnl - On windows platform only NT-thread model is supported. | |||
+dnl To avoid miss detection scipt first will check for NT-thread model | |||
+dnl and if is not found will try to detect build options for pthread | |||
+dnl model. Autodetection could be overiden if variable with_nt_threads | |||
+dnl is set in "Site Configuration" (see autoconf manual). | |||
+dnl If NT-thread model is enabled script skips some checks that | |||
+dnl impact build process. When a new functionality is added, developers | |||
+dnl are responsible to update configure script to avoid thread models | |||
+dnl to be mixed. | |||
+ | |||
+AC_MSG_CHECKING([for NT threads]) | |||
+AC_ARG_WITH(nt-threads, | |||
+ AS_HELP_STRING([--with-nt-threads], [build with windows threads]), | |||
+[ | |||
+ case $withval in | |||
+ no) with_nt_threads=no;; | |||
+ yes) with_nt_threads=yes;; | |||
+ *) with_nt_threads=yes;; | |||
+ esac], [ | |||
+ with_nt_threads=no]) | |||
+if test $with_nt_threads = yes ; then | |||
+AC_LINK_IFELSE([ | |||
+ AC_LANG_PROGRAM([[]],[[_beginthread(0, 0, 0);]]) | |||
+ ], | |||
+ [with_nt_threads=yes], | |||
+ [with_nt_threads=no]) | |||
+fi | |||
+AC_MSG_RESULT([$with_nt_threads]) | |||
+ | |||
+if test $with_nt_threads = yes ; then | |||
+ dnl temporary default flag to avoid additional pthread checks | |||
+ dnl and initilize other ac..thread flags to no | |||
+ ac_cv_pthread_is_default=no | |||
+ ac_cv_kthread=no | |||
+ ac_cv_pthread=no | |||
+ dnl ac_cv_kpthread is set to no if default is yes (see below) | |||
+else | |||
# On some compilers, pthreads are available without further options | |||
# (e.g. MacOS X). On some of these systems, the compiler will not | |||
# complain if unaccepted options are passed (e.g. gcc on Mac OS X). | |||
@@ -2078,6 +2118,8 @@ | |||
AC_MSG_RESULT($ac_cv_pthread) | |||
fi | |||
+fi | |||
+ | |||
# If we have set a CC compiler flag for thread support then | |||
# check if it works for CXX, too. | |||
ac_cv_cxx_thread=no | |||
@@ -2098,6 +2140,10 @@ | |||
then | |||
CXX="$CXX -pthread" | |||
ac_cv_cxx_thread=yes | |||
+elif test $with_nt_threads = yes | |||
+then | |||
+ dnl set to always to skip extra pthread check below | |||
+ ac_cv_cxx_thread=always | |||
fi | |||
if test $ac_cv_cxx_thread = yes | |||
@@ -2130,8 +2176,8 @@ | |||
AC_HEADER_STDC | |||
AC_CHECK_HEADERS(asm/types.h crypt.h conio.h direct.h dlfcn.h errno.h \ | |||
fcntl.h grp.h \ | |||
-ieeefp.h io.h langinfo.h libintl.h process.h pthread.h \ | |||
-sched.h shadow.h signal.h stropts.h termios.h \ | |||
+ieeefp.h io.h langinfo.h libintl.h process.h \ | |||
+shadow.h signal.h stropts.h termios.h \ | |||
utime.h \ | |||
poll.h sys/devpoll.h sys/epoll.h sys/poll.h \ | |||
sys/audioio.h sys/xattr.h sys/bsdtty.h sys/event.h sys/file.h sys/ioctl.h \ | |||
@@ -2145,6 +2191,14 @@ | |||
AC_HEADER_DIRENT | |||
AC_HEADER_MAJOR | |||
+# If using nt threads, don't look for pthread.h or thread.h | |||
+if test "x$with_nt_threads" = xno ; then | |||
+AC_HEADER_STDC | |||
+AC_CHECK_HEADERS(pthread.h sched.h thread.h) | |||
+AC_HEADER_DIRENT | |||
+AC_HEADER_MAJOR | |||
+fi | |||
+ | |||
# bluetooth/bluetooth.h has been known to not compile with -std=c99. | |||
# http://permalink.gmane.org/gmane.linux.bluez.kernel/22294 | |||
SAVE_CFLAGS=$CFLAGS | |||
@@ -2342,6 +2396,10 @@ | |||
AC_MSG_CHECKING(for pthread_t) | |||
have_pthread_t=no | |||
+if test $with_nt_threads = yes ; then | |||
+ dnl skip check for pthread_t if NT-thread model is enabled | |||
+ have_pthread_t=skip | |||
+else | |||
AC_COMPILE_IFELSE([ | |||
AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t x; x = *(pthread_t*)0;]]) | |||
],[have_pthread_t=yes],[]) | |||
@@ -2372,6 +2430,7 @@ | |||
else | |||
AC_MSG_RESULT(no) | |||
fi | |||
+fi | |||
CC="$ac_save_cc" | |||
AC_SUBST(OTHER_LIBTOOL_OPT) | |||
@@ -2814,10 +2873,15 @@ | |||
[AC_MSG_RESULT(no)] | |||
) | |||
+if test $with_nt_threads = yes ; then | |||
+ dnl do not search for sem_init if NT-thread model is enabled | |||
+ : | |||
+else | |||
# 'Real Time' functions on Solaris | |||
# posix4 on Solaris 2.6 | |||
# pthread (first!) on Linux | |||
AC_SEARCH_LIBS(sem_init, pthread rt posix4) | |||
+fi | |||
# check if we need libintl for locale functions | |||
AC_CHECK_LIB(intl, textdomain, | |||
@@ -3087,6 +3151,11 @@ | |||
CXX="$CXX -pthread" | |||
fi | |||
posix_threads=yes | |||
+elif test $with_nt_threads = yes | |||
+then | |||
+ posix_threads=no | |||
+ AC_DEFINE(NT_THREADS, 1, | |||
+ [Define to 1 if you want to use native NT threads]) | |||
else | |||
if test ! -z "$withval" -a -d "$withval" | |||
then LDFLAGS="$LDFLAGS -L$withval" | |||
@@ -3538,6 +3607,15 @@ | |||
fi | |||
# checks for library functions | |||
+if test $with_nt_threads = yes ; then | |||
+ dnl GCC(mingw) 4.4+ require and use posix threads(pthreads-w32) | |||
+ dnl and host may contain installed pthreads-w32. | |||
+ dnl Skip checks for some functions declared in pthreads-w32 if | |||
+ dnl NT-thread model is enabled. | |||
+ ac_cv_func_pthread_kill=skip | |||
+ ac_cv_func_sem_open=skip | |||
+ ac_cv_func_sched_setscheduler=skip | |||
+fi | |||
AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \ | |||
clock confstr copy_file_range ctermid dup3 execv explicit_bzero explicit_memset \ | |||
faccessat fchmod fchmodat fchown fchownat \ | |||
@@ -4462,6 +4540,10 @@ | |||
# the kernel module that provides POSIX semaphores | |||
# isn't loaded by default, so an attempt to call | |||
# sem_open results in a 'Signal 12' error. | |||
+if test $with_nt_threads = yes ; then | |||
+ dnl skip posix semaphores test if NT-thread model is enabled | |||
+ ac_cv_posix_semaphores_enabled=no | |||
+fi | |||
AC_MSG_CHECKING(whether POSIX semaphores are enabled) | |||
AC_CACHE_VAL(ac_cv_posix_semaphores_enabled, | |||
AC_RUN_IFELSE([AC_LANG_SOURCE([[ | |||
@@ -4495,6 +4577,14 @@ | |||
# Multiprocessing check for broken sem_getvalue | |||
AC_MSG_CHECKING(for broken sem_getvalue) | |||
+if test $with_nt_threads = yes ; then | |||
+ dnl Skip test if NT-thread model is enabled. | |||
+ dnl NOTE the test case below fail for pthreads-w32 as: | |||
+ dnl - SEM_FAILED is not defined; | |||
+ dnl - sem_open is a stub; | |||
+ dnl - sem_getvalue work(!). | |||
+ ac_cv_broken_sem_getvalue=skip | |||
+fi | |||
AC_CACHE_VAL(ac_cv_broken_sem_getvalue, | |||
AC_RUN_IFELSE([AC_LANG_SOURCE([[ | |||
#include <unistd.h> | |||
diff -Naur Python-3.8.0-orig/Modules/_multiprocessing/multiprocessing.h Python-3.8.0/Modules/_multiprocessing/multiprocessing.h | |||
--- Python-3.8.0-orig/Modules/_multiprocessing/multiprocessing.h 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Modules/_multiprocessing/multiprocessing.h 2019-10-22 10:00:32.168293100 +0300 | |||
@@ -21,6 +21,9 @@ | |||
# endif | |||
# define SEM_HANDLE HANDLE | |||
# define SEM_VALUE_MAX LONG_MAX | |||
+# if defined(HAVE_SEM_OPEN) && defined(_POSIX_THREADS) | |||
+# include <semaphore.h> | |||
+# endif | |||
#else | |||
# include <fcntl.h> /* O_CREAT and O_EXCL */ | |||
# if defined(HAVE_SEM_OPEN) && !defined(POSIX_SEMAPHORES_NOT_ENABLED) | |||
diff -Naur Python-3.8.0-orig/pyconfig.h.in Python-3.8.0/pyconfig.h.in | |||
--- Python-3.8.0-orig/pyconfig.h.in 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/pyconfig.h.in 2019-10-22 10:00:32.558293800 +0300 | |||
@@ -1352,6 +1352,9 @@ | |||
/* Define if mvwdelch in curses.h is an expression. */ | |||
#undef MVWDELCH_IS_EXPRESSION | |||
+/* Define to 1 if you want to use native NT threads */ | |||
+#undef NT_THREADS | |||
+ | |||
/* Define to the address where bug reports for this package should be sent. */ | |||
#undef PACKAGE_BUGREPORT | |||
@@ -0,0 +1,25 @@ | |||
diff -Naur Python-3.8.0-orig/Include/pyport.h Python-3.8.0/Include/pyport.h | |||
--- Python-3.8.0-orig/Include/pyport.h 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Include/pyport.h 2019-10-22 10:00:36.224300300 +0300 | |||
@@ -26,6 +26,21 @@ | |||
#endif | |||
+#ifdef __MINGW32__ | |||
+/* Translate GCC[mingw*] platform specific defines to those | |||
+ * used in python code. | |||
+ */ | |||
+#if !defined(MS_WIN64) && defined(_WIN64) | |||
+# define MS_WIN64 | |||
+#endif | |||
+#if !defined(MS_WIN32) && defined(_WIN32) | |||
+# define MS_WIN32 | |||
+#endif | |||
+#if !defined(MS_WINDOWS) && defined(MS_WIN32) | |||
+# define MS_WINDOWS | |||
+#endif | |||
+#endif /* __MINGW32__*/ | |||
+ | |||
/************************************************************************** | |||
Symbols and macros to supply platform-independent interfaces to basic | |||
C language & library operations whose spellings vary across platforms. |
@@ -0,0 +1,61 @@ | |||
diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac | |||
--- Python-3.8.0-orig/configure.ac 2019-10-22 10:00:34.321096900 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-22 10:00:39.843506600 +0300 | |||
@@ -362,6 +362,17 @@ | |||
# Set name for machine-dependent library files | |||
AC_ARG_VAR([MACHDEP], [name for machine-dependent library files]) | |||
AC_MSG_CHECKING(MACHDEP) | |||
+case $host in | |||
+ *-*-mingw*) | |||
+ # On those hosts MACHDEP is 'win', as platform specific files | |||
+ # go in plat-$(MACHDEP), but runtime platform is 'win32' | |||
+ test -z "$MACHDEP" && MACHDEP=win | |||
+ | |||
+ dnl Configuration will be based only on "host triplet" as build | |||
+ dnl must not depend from posix compatible environement. | |||
+ ac_sys_system=ignore | |||
+ ;; | |||
+esac | |||
if test -z "$MACHDEP" | |||
then | |||
# avoid using uname for cross builds | |||
@@ -431,12 +442,23 @@ | |||
*-*-vxworks*) | |||
_host_cpu=$host_cpu | |||
;; | |||
+ *-*-mingw*) | |||
+ _host_cpu= | |||
+ ;; | |||
*) | |||
# for now, limit cross builds to known configurations | |||
MACHDEP="unknown" | |||
AC_MSG_ERROR([cross build not supported for $host]) | |||
esac | |||
_PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}" | |||
+ | |||
+ case "$host_os" in | |||
+ mingw*) | |||
+ # As sys.platform() return 'win32' to build python and extantions | |||
+ # we will use 'mingw' (in setup.py and etc.) | |||
+ _PYTHON_HOST_PLATFORM=mingw | |||
+ ;; | |||
+ esac | |||
fi | |||
# Some systems cannot stand _XOPEN_SOURCE being defined at all; they | |||
diff -Naur Python-3.8.0-orig/Python/getplatform.c Python-3.8.0/Python/getplatform.c | |||
--- Python-3.8.0-orig/Python/getplatform.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Python/getplatform.c 2019-10-22 10:00:40.249107300 +0300 | |||
@@ -1,6 +1,12 @@ | |||
#include "Python.h" | |||
+#ifdef __MINGW32__ | |||
+# undef PLATFORM | |||
+/* see PC/pyconfig.h */ | |||
+# define PLATFORM "win32" | |||
+#endif | |||
+ | |||
#ifndef PLATFORM | |||
#define PLATFORM "unknown" | |||
#endif |
@@ -0,0 +1,63 @@ | |||
diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac | |||
--- Python-3.8.0-orig/configure.ac 2019-10-22 10:00:41.996310400 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-22 10:00:43.025912200 +0300 | |||
@@ -893,6 +893,28 @@ | |||
fi | |||
AC_SUBST(MULTIARCH_CPPFLAGS) | |||
+# initialize default configuration | |||
+py_config= | |||
+case $host in | |||
+ *-*-mingw*) py_config=mingw ;; | |||
+esac | |||
+if test -n "$py_config" ; then | |||
+ AC_MSG_NOTICE([loading configure defaults from .../Misc/config_$py_config"]) | |||
+ . "$srcdir/Misc/config_$py_config" | |||
+fi | |||
+ | |||
+# initialize defaults for cross-builds | |||
+if test "$cross_compiling" = yes; then | |||
+ py_config=$host_os | |||
+ case $py_config in | |||
+ mingw32*) py_config=mingw32 ;; | |||
+ esac | |||
+ if test -f "$srcdir/Misc/cross_$py_config" ; then | |||
+ AC_MSG_NOTICE([loading cross defaults from .../Misc/cross_$py_config"]) | |||
+ . "$srcdir/Misc/cross_$py_config" | |||
+ fi | |||
+fi | |||
+ | |||
AC_MSG_CHECKING([for -Wl,--no-as-needed]) | |||
save_LDFLAGS="$LDFLAGS" | |||
LDFLAGS="$LDFLAGS -Wl,--no-as-needed" | |||
diff -Naur Python-3.8.0-orig/Misc/config_mingw Python-3.8.0/Misc/config_mingw | |||
--- Python-3.8.0-orig/Misc/config_mingw 1970-01-01 03:00:00.000000000 +0300 | |||
+++ Python-3.8.0/Misc/config_mingw 2019-10-22 10:00:43.415912900 +0300 | |||
@@ -0,0 +1,12 @@ | |||
+# configure defaults for mingw* hosts | |||
+ | |||
+# mingw functions to ignore | |||
+ac_cv_func_ftruncate=ignore # implement it as _chsize | |||
+ | |||
+# mingw-w64 functions to ignore | |||
+ac_cv_func_truncate=ignore | |||
+ac_cv_func_alarm=ignore | |||
+ | |||
+# files to ignore | |||
+ac_cv_file__dev_ptmx=ignore #NOTE: under MSYS environment device exist | |||
+ac_cv_file__dev_ptc=no | |||
diff -Naur Python-3.8.0-orig/Misc/cross_mingw32 Python-3.8.0/Misc/cross_mingw32 | |||
--- Python-3.8.0-orig/Misc/cross_mingw32 1970-01-01 03:00:00.000000000 +0300 | |||
+++ Python-3.8.0/Misc/cross_mingw32 2019-10-22 10:00:43.837113600 +0300 | |||
@@ -0,0 +1,11 @@ | |||
+# configure defaults for mingw32 host if cross-build | |||
+ | |||
+ac_cv_little_endian_double=yes | |||
+ac_cv_big_endian_double=no | |||
+ac_cv_mixed_endian_double=no | |||
+ | |||
+ac_cv_tanh_preserves_zero_sign=yes | |||
+ | |||
+ac_cv_wchar_t_signed=no | |||
+ | |||
+ac_cv_have_size_t_format=no |
@@ -0,0 +1,24 @@ | |||
diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac | |||
--- Python-3.8.0-orig/configure.ac 2019-10-22 10:00:45.568716700 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-22 10:00:47.456320000 +0300 | |||
@@ -2407,8 +2407,20 @@ | |||
]) | |||
AC_MSG_CHECKING(whether to enable large file support) | |||
+have_largefile_support=no | |||
if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \ | |||
"$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then | |||
+ have_largefile_support=yes | |||
+else | |||
+ case $host in | |||
+ *) | |||
+ dnl Activate on windows platforms (32&64-bit) where off_t(4) < fpos_t(8) | |||
+ have_largefile_support=yes | |||
+ ;; | |||
+ esac | |||
+fi | |||
+ | |||
+if test $have_largefile_support = yes ; then | |||
AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1, | |||
[Defined to enable large file support when an off_t is bigger than a long | |||
and long long is at least as big as an off_t. You may need |
@@ -0,0 +1,25 @@ | |||
diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac | |||
--- Python-3.8.0-orig/configure.ac 2019-10-22 10:00:49.172323000 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-22 10:00:50.295525000 +0300 | |||
@@ -5450,8 +5450,21 @@ | |||
THREADHEADERS="$THREADHEADERS \$(srcdir)/$h" | |||
done | |||
+case $host in | |||
+ *) | |||
+ dnl Required for windows builds as Objects/exceptions.c require | |||
+ dnl "errmap.h" from $srcdir/PC. | |||
+ dnl Note we cannot use BASECPPFLAGS as autogenerated pyconfig.h | |||
+ dnl has to be before customized located in ../PC. | |||
+ CPPFLAGS="-I\$(srcdir)/PC $CPPFLAGS" | |||
+ ;; | |||
+esac | |||
+ | |||
AC_SUBST(SRCDIRS) | |||
SRCDIRS="Parser Objects Python Modules Modules/_io Programs" | |||
+case $host in | |||
+ *) SRCDIRS="$SRCDIRS PC";; | |||
+esac | |||
AC_MSG_CHECKING(for build directories) | |||
for dir in $SRCDIRS; do | |||
if test ! -d $dir; then |
@@ -0,0 +1,99 @@ | |||
diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac | |||
--- Python-3.8.0-orig/configure.ac 2019-10-22 10:00:52.028128100 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-22 10:00:53.198130100 +0300 | |||
@@ -574,6 +574,14 @@ | |||
AC_DEFINE(_INCLUDE__STDC_A1_SOURCE, 1, Define to include mbstate_t for mbrtowc) | |||
fi | |||
+AC_MSG_CHECKING([for init system calls]) | |||
+AC_SUBST(INITSYS) | |||
+case $host in | |||
+ *-*-mingw*) INITSYS=nt;; | |||
+ *) INITSYS=posix;; | |||
+esac | |||
+AC_MSG_RESULT([$INITSYS]) | |||
+ | |||
# Record the configure-time value of MACOSX_DEPLOYMENT_TARGET, | |||
# it may influence the way we can build extensions, so distutils | |||
# needs to check it | |||
--- Python-3.8.1/Modules/posixmodule.c.orig 2019-12-18 18:21:23.000000000 +0100 | |||
+++ Python-3.8.1/Modules/posixmodule.c 2019-12-23 10:35:51.095967700 +0100 | |||
@@ -193,6 +193,27 @@ | |||
#define HAVE_CWAIT 1 | |||
#define HAVE_FSYNC 1 | |||
#define fsync _commit | |||
+#elif defined(__MINGW32__) /* GCC for windows hosts */ | |||
+/* getlogin is detected by configure on mingw-w64 */ | |||
+#undef HAVE_GETLOGIN | |||
+/*#define HAVE_GETCWD 1 - detected by configure*/ | |||
+#define HAVE_GETPPID 1 | |||
+#define HAVE_GETLOGIN 1 | |||
+#define HAVE_SPAWNV 1 | |||
+#define HAVE_WSPAWNV 1 | |||
+#define HAVE_WEXECV 1 | |||
+/*#define HAVE_EXECV 1 - detected by configure*/ | |||
+#define HAVE_PIPE 1 | |||
+#define HAVE_POPEN 1 | |||
+#define HAVE_SYSTEM 1 | |||
+#define HAVE_CWAIT 1 | |||
+#define HAVE_FSYNC 1 | |||
+#define fsync _commit | |||
+#include <windows.h> | |||
+#include <winioctl.h> | |||
+#ifndef _MAX_ENV | |||
+#define _MAX_ENV 32767 | |||
+#endif | |||
#else | |||
/* Unix functions that the configure script doesn't check for */ | |||
#ifndef __VXWORKS__ | |||
@@ -292,7 +313,7 @@ | |||
#endif | |||
#endif | |||
-#ifdef _MSC_VER | |||
+#ifdef MS_WINDOWS | |||
#ifdef HAVE_DIRECT_H | |||
#include <direct.h> | |||
#endif | |||
@@ -314,7 +335,7 @@ | |||
#include <shellapi.h> /* for ShellExecute() */ | |||
#include <lmcons.h> /* for UNLEN */ | |||
#define HAVE_SYMLINK | |||
-#endif /* _MSC_VER */ | |||
+#endif /* MS_WINDOWS */ | |||
#ifndef MAXPATHLEN | |||
#if defined(PATH_MAX) && PATH_MAX > 1024 | |||
@@ -1372,9 +1393,9 @@ | |||
** man environ(7). | |||
*/ | |||
#include <crt_externs.h> | |||
-#elif !defined(_MSC_VER) && (!defined(__WATCOMC__) || defined(__QNX__) || defined(__VXWORKS__)) | |||
+#elif !defined(MS_WINDOWS) && (!defined(__WATCOMC__) || defined(__QNX__) || defined(__VXWORKS__)) | |||
extern char **environ; | |||
-#endif /* !_MSC_VER */ | |||
+#endif /* !MS_WINDOWS */ | |||
static PyObject * | |||
convertenviron(void) | |||
diff -Naur Python-3.8.0-orig/Modules/Setup Python-3.8.0/Modules/Setup | |||
--- Python-3.8.0-orig/Modules/Setup 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Modules/Setup 2019-10-22 10:00:54.430532300 +0300 | |||
@@ -101,7 +101,6 @@ | |||
# This only contains the minimal set of modules required to run the | |||
# setup.py script in the root of the Python source tree. | |||
-posix -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal posixmodule.c # posix (UNIX) system calls | |||
errno errnomodule.c # posix (UNIX) errno values | |||
pwd pwdmodule.c # this is needed to find out the user's home dir | |||
# if $HOME is not set | |||
diff -Naur Python-3.8.0-orig/Modules/Setup.config.in Python-3.8.0/Modules/Setup.config.in | |||
--- Python-3.8.0-orig/Modules/Setup.config.in 2019-10-22 10:00:30.171489600 +0300 | |||
+++ Python-3.8.0/Modules/Setup.config.in 2019-10-22 10:00:54.009331600 +0300 | |||
@@ -3,3 +3,6 @@ | |||
# The purpose of this file is to conditionally enable certain modules | |||
# based on configure-time options. | |||
+# init system calls(posix/nt/...) for INITFUNC (used by makesetup) | |||
+@INITSYS@ -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal posixmodule.c | |||
+ |
@@ -0,0 +1,56 @@ | |||
diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac | |||
--- Python-3.8.0-orig/configure.ac 2019-10-22 10:00:56.583336100 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-22 10:00:58.938940200 +0300 | |||
@@ -3181,6 +3181,13 @@ | |||
fi]) | |||
AC_MSG_RESULT($with_dbmliborder) | |||
+# Determine if windows modules should be used. | |||
+AC_SUBST(USE_WIN32_MODULE) | |||
+USE_WIN32_MODULE='#' | |||
+case $host in | |||
+ not_this_one) USE_WIN32_MODULE=;; | |||
+esac | |||
+ | |||
# Templates for things AC_DEFINEd more than once. | |||
# For a single AC_DEFINE, no template is needed. | |||
AH_TEMPLATE(_REENTRANT, | |||
diff -Naur Python-3.8.0-orig/Modules/Setup.config.in Python-3.8.0/Modules/Setup.config.in | |||
--- Python-3.8.0-orig/Modules/Setup.config.in 2019-10-22 10:00:57.800138200 +0300 | |||
+++ Python-3.8.0/Modules/Setup.config.in 2019-10-22 10:00:59.328940900 +0300 | |||
@@ -6,3 +6,6 @@ | |||
# init system calls(posix/nt/...) for INITFUNC (used by makesetup) | |||
@INITSYS@ -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal posixmodule.c | |||
+# build-in modules for windows platform: | |||
+@USE_WIN32_MODULE@winreg ../PC/winreg.c | |||
+ | |||
diff -Naur Python-3.8.0-orig/PC/winreg.c Python-3.8.0/PC/winreg.c | |||
--- Python-3.8.0-orig/PC/winreg.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/PC/winreg.c 2019-10-22 10:00:59.734541600 +0300 | |||
@@ -17,6 +17,25 @@ | |||
#include "structmember.h" | |||
#include "windows.h" | |||
+#ifndef SIZEOF_HKEY | |||
+/* used only here */ | |||
+#if defined(MS_WIN64) | |||
+# define SIZEOF_HKEY 8 | |||
+#elif defined(MS_WIN32) | |||
+# define SIZEOF_HKEY 4 | |||
+#else | |||
+# error "SIZEOF_HKEY is not defined" | |||
+#endif | |||
+#endif | |||
+ | |||
+#ifndef REG_LEGAL_CHANGE_FILTER | |||
+#define REG_LEGAL_CHANGE_FILTER (\ | |||
+ REG_NOTIFY_CHANGE_NAME |\ | |||
+ REG_NOTIFY_CHANGE_ATTRIBUTES |\ | |||
+ REG_NOTIFY_CHANGE_LAST_SET |\ | |||
+ REG_NOTIFY_CHANGE_SECURITY ) | |||
+#endif | |||
+ | |||
static BOOL PyHKEY_AsHKEY(PyObject *ob, HKEY *pRes, BOOL bNoneOK); | |||
static BOOL clinic_HKEY_converter(PyObject *ob, void *p); | |||
static PyObject *PyHKEY_FromHKEY(HKEY h); |
@@ -0,0 +1,42 @@ | |||
diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac | |||
--- Python-3.8.0-orig/configure.ac 2019-10-22 10:01:01.887345400 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-22 10:01:03.821748800 +0300 | |||
@@ -3188,6 +3188,13 @@ | |||
*-*-mingw*) USE_WIN32_MODULE=;; | |||
esac | |||
+# Determine if pwdmodule should be used. | |||
+AC_SUBST(USE_PWD_MODULE) | |||
+USE_PWD_MODULE= | |||
+case $host in | |||
+ *-*-mingw*) USE_PWD_MODULE='#';; | |||
+esac | |||
+ | |||
# Templates for things AC_DEFINEd more than once. | |||
# For a single AC_DEFINE, no template is needed. | |||
AH_TEMPLATE(_REENTRANT, | |||
diff -Naur Python-3.8.0-orig/Modules/Setup Python-3.8.0/Modules/Setup | |||
--- Python-3.8.0-orig/Modules/Setup 2019-10-22 10:00:57.394537500 +0300 | |||
+++ Python-3.8.0/Modules/Setup 2019-10-22 10:01:04.227349500 +0300 | |||
@@ -102,8 +102,6 @@ | |||
# setup.py script in the root of the Python source tree. | |||
errno errnomodule.c # posix (UNIX) errno values | |||
-pwd pwdmodule.c # this is needed to find out the user's home dir | |||
- # if $HOME is not set | |||
_sre _sre.c # Fredrik Lundh's new regular expressions | |||
_codecs _codecsmodule.c # access to the builtin codecs and codec registry | |||
_weakref _weakref.c # weak references | |||
diff -Naur Python-3.8.0-orig/Modules/Setup.config.in Python-3.8.0/Modules/Setup.config.in | |||
--- Python-3.8.0-orig/Modules/Setup.config.in 2019-10-22 10:01:02.292946100 +0300 | |||
+++ Python-3.8.0/Modules/Setup.config.in 2019-10-22 10:01:05.038550900 +0300 | |||
@@ -6,6 +6,9 @@ | |||
# init system calls(posix/nt/...) for INITFUNC (used by makesetup) | |||
@INITSYS@ -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal posixmodule.c | |||
+# This is needed to find out the user's home dir if $HOME is not set | |||
+@USE_PWD_MODULE@pwd pwdmodule.c | |||
+ | |||
# build-in modules for windows platform: | |||
@USE_WIN32_MODULE@winreg ../PC/winreg.c | |||
@@ -0,0 +1,36 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/sysconfig.py Python-3.8.0/Lib/distutils/sysconfig.py | |||
--- Python-3.8.0-orig/Lib/distutils/sysconfig.py 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Lib/distutils/sysconfig.py 2019-10-22 10:01:09.125758100 +0300 | |||
@@ -170,7 +170,23 @@ | |||
Mainly needed on Unix, so we can plug in the information that | |||
varies across Unices and is stored in Python's Makefile. | |||
""" | |||
- if compiler.compiler_type == "unix": | |||
+ global _config_vars | |||
+ if compiler.compiler_type in ["cygwin", "mingw32"]: | |||
+ # Note that cygwin use posix build and 'unix' compiler. | |||
+ # If build is not based on posix then we must predefine | |||
+ # some environment variables corresponding to posix | |||
+ # build rules and defaults. | |||
+ if not 'GCC' in sys.version: | |||
+ _config_vars['CC'] = "gcc" | |||
+ _config_vars['CXX'] = "g++" | |||
+ _config_vars['OPT'] = "-fwrapv -O3 -Wall -Wstrict-prototypes" | |||
+ _config_vars['CFLAGS'] = "" | |||
+ _config_vars['CCSHARED'] = "" | |||
+ _config_vars['LDSHARED'] = "gcc -shared -Wl,--enable-auto-image-base" | |||
+ _config_vars['AR'] = "ar" | |||
+ _config_vars['ARFLAGS'] = "rc" | |||
+ | |||
+ if compiler.compiler_type in ["unix", "cygwin", "mingw32"]: | |||
if sys.platform == "darwin": | |||
# Perform first-time customization of compiler-related | |||
# config vars on OS X now that we know we need a compiler. | |||
@@ -180,7 +196,6 @@ | |||
# that Python itself was built on. Also the user OS | |||
# version and build tools may not support the same set | |||
# of CPU architectures for universal builds. | |||
- global _config_vars | |||
# Use get_config_var() to ensure _config_vars is initialized. | |||
if not get_config_var('CUSTOMIZED_OSX_COMPILER'): | |||
import _osx_support |
@@ -0,0 +1,19 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/unixccompiler.py Python-3.8.0/Lib/distutils/unixccompiler.py | |||
--- Python-3.8.0-orig/Lib/distutils/unixccompiler.py 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Lib/distutils/unixccompiler.py 2019-10-22 10:01:11.964963100 +0300 | |||
@@ -248,9 +248,13 @@ | |||
# -Wl whenever gcc was used in the past it is probably | |||
# safest to keep doing so. | |||
if sysconfig.get_config_var("GNULD") == "yes": | |||
- # GNU ld needs an extra option to get a RUNPATH | |||
+ # GNU ELF ld needs an extra option to get a RUNPATH | |||
# instead of just an RPATH. | |||
- return "-Wl,--enable-new-dtags,-R" + dir | |||
+ if sys.platform in ["win32", "cygwin"] or \ | |||
+ "mingw" in compiler: | |||
+ return [] | |||
+ else: | |||
+ return "-Wl,--enable-new-dtags,-R" + dir | |||
else: | |||
return "-Wl,-R" + dir | |||
else: |
@@ -0,0 +1,62 @@ | |||
diff -Naur Python-3.8.0-orig/Include/pyport.h Python-3.8.0/Include/pyport.h | |||
--- Python-3.8.0-orig/Include/pyport.h 2019-10-22 10:00:37.955903300 +0300 | |||
+++ Python-3.8.0/Include/pyport.h 2019-10-22 10:01:14.850968200 +0300 | |||
@@ -651,12 +651,12 @@ | |||
*/ | |||
/* | |||
- All windows ports, except cygwin, are handled in PC/pyconfig.h. | |||
+ Only MSVC windows ports is handled in PC/pyconfig.h. | |||
- Cygwin is the only other autoconf platform requiring special | |||
+ Cygwin and Mingw is the only other autoconf platform requiring special | |||
linkage handling and it uses __declspec(). | |||
*/ | |||
-#if defined(__CYGWIN__) | |||
+#if defined(__CYGWIN__) || defined(__MINGW32__) | |||
# define HAVE_DECLSPEC_DLL | |||
#endif | |||
@@ -667,21 +667,23 @@ | |||
# define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE | |||
# define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE | |||
/* module init functions inside the core need no external linkage */ | |||
- /* except for Cygwin to handle embedding */ | |||
-# if defined(__CYGWIN__) | |||
+ /* except for Cygwin/Mingw to handle embedding */ | |||
+# if defined(__CYGWIN__) || defined(__MINGW32__) | |||
# define PyMODINIT_FUNC __declspec(dllexport) PyObject* | |||
-# else /* __CYGWIN__ */ | |||
+# else /* __CYGWIN__ || __MINGW32__*/ | |||
# define PyMODINIT_FUNC PyObject* | |||
-# endif /* __CYGWIN__ */ | |||
+# endif /* __CYGWIN__ || __MINGW32__*/ | |||
# else /* Py_BUILD_CORE */ | |||
/* Building an extension module, or an embedded situation */ | |||
/* public Python functions and data are imported */ | |||
/* Under Cygwin, auto-import functions to prevent compilation */ | |||
/* failures similar to those described at the bottom of 4.1: */ | |||
/* http://docs.python.org/extending/windows.html#a-cookbook-approach */ | |||
-# if !defined(__CYGWIN__) | |||
+# if defined(__CYGWIN__) || defined(__MINGW32__) | |||
+# define PyAPI_FUNC(RTYPE) RTYPE | |||
+# else | |||
# define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE | |||
-# endif /* !__CYGWIN__ */ | |||
+# endif /* __CYGWIN__ || __MINGW32__*/ | |||
# define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE | |||
/* module init functions outside the core must be exported */ | |||
# if defined(__cplusplus) | |||
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py | |||
--- Python-3.8.0-orig/setup.py 2019-10-22 10:00:25.787881900 +0300 | |||
+++ Python-3.8.0/setup.py 2019-10-22 10:01:15.256568900 +0300 | |||
@@ -316,6 +316,9 @@ | |||
raise ValueError("No source directory; cannot proceed.") | |||
self.srcdir = os.path.abspath(self.srcdir) | |||
+ if MS_WINDOWS: | |||
+ self.compiler.define_macro("Py_BUILD_CORE_MODULE") | |||
+ | |||
# Detect which modules should be compiled | |||
self.detect_modules() | |||
@@ -0,0 +1,51 @@ | |||
diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac | |||
--- Python-3.8.0-orig/configure.ac 2019-10-22 10:01:07.206954700 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-22 10:01:18.470174500 +0300 | |||
@@ -1204,6 +1204,13 @@ | |||
;; | |||
esac | |||
+ case $host in | |||
+ *) | |||
+ LDLIBRARY='libpython$(LDVERSION).dll.a' | |||
+ DLLLIBRARY='libpython$(LDVERSION).dll' | |||
+ BLDLIBRARY='-L. -lpython$(LDVERSION)' | |||
+ ;; | |||
+ esac | |||
else # shared is disabled | |||
PY_ENABLE_SHARED=0 | |||
case $ac_sys_system in | |||
@@ -1212,6 +1219,10 @@ | |||
LDLIBRARY='libpython$(LDVERSION).dll.a' | |||
;; | |||
esac | |||
+ case $host in | |||
+ *) | |||
+ LDLIBRARY='libpython$(LDVERSION).a';; | |||
+ esac | |||
fi | |||
if test "$cross_compiling" = yes; then | |||
@@ -2760,6 +2771,12 @@ | |||
LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";; | |||
*) LDSHARED="ld";; | |||
esac | |||
+ case $host in | |||
+ *) | |||
+ LDSHARED='$(CC) -shared -Wl,--enable-auto-image-base' | |||
+ LDCXXSHARED='$(CXX) -shared -Wl,--enable-auto-image-base' | |||
+ ;; | |||
+ esac | |||
fi | |||
AC_MSG_RESULT($LDSHARED) | |||
LDCXXSHARED=${LDCXXSHARED-$LDSHARED} | |||
@@ -5478,7 +5495,8 @@ | |||
dnl "errmap.h" from $srcdir/PC. | |||
dnl Note we cannot use BASECPPFLAGS as autogenerated pyconfig.h | |||
dnl has to be before customized located in ../PC. | |||
- CPPFLAGS="-I\$(srcdir)/PC $CPPFLAGS" | |||
+ dnl (-I. at end is workaround for setup.py logic) | |||
+ CPPFLAGS="-I\$(srcdir)/PC $CPPFLAGS -I." | |||
;; | |||
esac | |||
@@ -0,0 +1,81 @@ | |||
diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac | |||
--- Python-3.8.0-orig/configure.ac 2019-10-22 10:01:20.201777600 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-22 10:01:21.340579600 +0300 | |||
@@ -2635,6 +2635,9 @@ | |||
CYGWIN*) SHLIB_SUFFIX=.dll;; | |||
*) SHLIB_SUFFIX=.so;; | |||
esac | |||
+ case $host_os in | |||
+ *) SHLIB_SUFFIX=.dll;; | |||
+ esac | |||
fi | |||
AC_MSG_RESULT($SHLIB_SUFFIX) | |||
@@ -3677,6 +3680,12 @@ | |||
fi | |||
;; | |||
esac | |||
+ case $host in | |||
+ *) | |||
+ DYNLOADFILE="dynload_win.o" | |||
+ extra_machdep_objs="$extra_machdep_objs PC/dl_nt.o" | |||
+ ;; | |||
+ esac | |||
fi | |||
AC_MSG_RESULT($DYNLOADFILE) | |||
if test "$DYNLOADFILE" != "dynload_stub.o" | |||
@@ -4837,6 +4846,12 @@ | |||
*) | |||
EXT_SUFFIX=${SHLIB_SUFFIX};; | |||
esac | |||
+case $host_os in | |||
+ *) | |||
+ dnl Synchronized with _PyImport_DynLoadFiletab (dynload_win.c) | |||
+ dnl Do not use more then one dot on this platform ! | |||
+ EXT_SUFFIX=-$SOABI$SHLIB_SUFFIX;; | |||
+esac | |||
AC_MSG_CHECKING(LDVERSION) | |||
LDVERSION='$(VERSION)$(ABIFLAGS)' | |||
diff -Naur Python-3.8.0-orig/Makefile.pre.in Python-3.8.0/Makefile.pre.in | |||
--- Python-3.8.0-orig/Makefile.pre.in 2019-10-22 10:00:29.734688900 +0300 | |||
+++ Python-3.8.0/Makefile.pre.in 2019-10-22 10:01:21.746180300 +0300 | |||
@@ -784,6 +784,12 @@ | |||
-DSHLIB_EXT='"$(EXT_SUFFIX)"' \ | |||
-o $@ $(srcdir)/Python/dynload_hpux.c | |||
+Python/dynload_win.o: $(srcdir)/Python/dynload_win.c Makefile | |||
+ $(CC) -c $(PY_CORE_CFLAGS) \ | |||
+ -DSHLIB_SUFFIX='"$(SHLIB_SUFFIX)"' \ | |||
+ -DEXT_SUFFIX='"$(EXT_SUFFIX)"' \ | |||
+ -o $@ $(srcdir)/Python/dynload_win.c | |||
+ | |||
Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile $(srcdir)/Include/pydtrace.h | |||
$(CC) -c $(PY_CORE_CFLAGS) \ | |||
-DABIFLAGS='"$(ABIFLAGS)"' \ | |||
diff -Naur Python-3.8.0-orig/Python/dynload_win.c Python-3.8.0/Python/dynload_win.c | |||
--- Python-3.8.0-orig/Python/dynload_win.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Python/dynload_win.c 2019-10-22 10:01:22.151781000 +0300 | |||
@@ -33,6 +33,12 @@ | |||
#define PYD_UNTAGGED_SUFFIX PYD_DEBUG_SUFFIX ".pyd" | |||
const char *_PyImport_DynLoadFiletab[] = { | |||
+#ifdef EXT_SUFFIX | |||
+ EXT_SUFFIX, /* include SOABI flags where is encoded debug */ | |||
+#endif | |||
+#ifdef SHLIB_SUFFIX | |||
+ "-abi" PYTHON_ABI_STRING SHLIB_SUFFIX, | |||
+#endif | |||
PYD_TAGGED_SUFFIX, | |||
PYD_UNTAGGED_SUFFIX, | |||
NULL | |||
@@ -203,8 +209,7 @@ | |||
ensure DLLs adjacent to the PYD are preferred. */ | |||
Py_BEGIN_ALLOW_THREADS | |||
hDLL = LoadLibraryExW(wpathname, NULL, | |||
- LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | | |||
- LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR); | |||
+ LOAD_WITH_ALTERED_SEARCH_PATH); | |||
Py_END_ALLOW_THREADS | |||
#if HAVE_SXS | |||
_Py_DeactivateActCtx(cookie); |
@@ -0,0 +1,32 @@ | |||
diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac | |||
--- Python-3.8.0-orig/configure.ac 2019-10-22 10:01:23.898984100 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-22 10:01:25.833387400 +0300 | |||
@@ -5515,6 +5515,16 @@ | |||
;; | |||
esac | |||
+dnl Python interpreter main program for frozen scripts | |||
+AC_SUBST(PYTHON_OBJS_FROZENMAIN) | |||
+PYTHON_OBJS_FROZENMAIN="Python/frozenmain.o" | |||
+case $host in | |||
+ *-*-mingw*) | |||
+ dnl 'PC/frozen_dllmain.c' - not yet | |||
+ PYTHON_OBJS_FROZENMAIN= | |||
+ ;; | |||
+esac | |||
+ | |||
AC_SUBST(SRCDIRS) | |||
SRCDIRS="Parser Objects Python Modules Modules/_io Programs" | |||
case $host in | |||
diff -Naur Python-3.8.0-orig/Makefile.pre.in Python-3.8.0/Makefile.pre.in | |||
--- Python-3.8.0-orig/Makefile.pre.in 2019-10-22 10:01:24.304584800 +0300 | |||
+++ Python-3.8.0/Makefile.pre.in 2019-10-22 10:01:26.238988200 +0300 | |||
@@ -327,7 +327,7 @@ | |||
Python/context.o \ | |||
Python/dynamic_annotations.o \ | |||
Python/errors.o \ | |||
- Python/frozenmain.o \ | |||
+ @PYTHON_OBJS_FROZENMAIN@ \ | |||
Python/future.o \ | |||
Python/getargs.o \ | |||
Python/getcompiler.o \ |
@@ -0,0 +1,16 @@ | |||
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py | |||
--- Python-3.8.0-orig/setup.py 2019-10-22 10:01:17.378172600 +0300 | |||
+++ Python-3.8.0/setup.py 2019-10-22 10:01:29.904994600 +0300 | |||
@@ -1667,7 +1667,12 @@ | |||
libraries=libs, | |||
include_dirs=["Modules/_multiprocessing"])) | |||
+ multiprocessing_libs = [] | |||
+ if MS_WINDOWS: | |||
+ multiprocessing_libs += ['ws2_32'] | |||
self.add(Extension('_multiprocessing', multiprocessing_srcs, | |||
+ define_macros={}, | |||
+ libraries=multiprocessing_libs, | |||
include_dirs=["Modules/_multiprocessing"])) | |||
def detect_uuid(self): |
@@ -0,0 +1,40 @@ | |||
diff -Naur Python-3.8.0-orig/Modules/selectmodule.c Python-3.8.0/Modules/selectmodule.c | |||
--- Python-3.8.0-orig/Modules/selectmodule.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Modules/selectmodule.c 2019-10-22 10:01:32.759799600 +0300 | |||
@@ -134,9 +134,9 @@ | |||
v = PyObject_AsFileDescriptor( o ); | |||
if (v == -1) goto finally; | |||
-#if defined(_MSC_VER) | |||
+#if defined(MS_WIN32) | |||
max = 0; /* not used for Win32 */ | |||
-#else /* !_MSC_VER */ | |||
+#else /* !MS_WIN32 */ | |||
if (!_PyIsSelectable_fd(v)) { | |||
PyErr_SetString(PyExc_ValueError, | |||
"filedescriptor out of range in select()"); | |||
@@ -144,7 +144,7 @@ | |||
} | |||
if (v > max) | |||
max = v; | |||
-#endif /* _MSC_VER */ | |||
+#endif /* MS_WIN32 */ | |||
FD_SET(v, set); | |||
/* add object and its file descriptor to the list */ | |||
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py | |||
--- Python-3.8.0-orig/setup.py 2019-10-22 10:01:31.636597600 +0300 | |||
+++ Python-3.8.0/setup.py 2019-10-22 10:01:33.181000400 +0300 | |||
@@ -817,7 +817,11 @@ | |||
self.missing.append('spwd') | |||
# select(2); not on ancient System V | |||
- self.add(Extension('select', ['selectmodule.c'])) | |||
+ select_libs = [] | |||
+ if MS_WINDOWS: | |||
+ select_libs += ['ws2_32'] | |||
+ self.add(Extension('select', ['selectmodule.c'], | |||
+ libraries=select_libs)) | |||
# Fred Drake's interface to the Python parser | |||
self.add(Extension('parser', ['parsermodule.c'])) |
@@ -0,0 +1,26 @@ | |||
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py | |||
--- Python-3.8.0-orig/setup.py 2019-10-22 10:01:35.318204100 +0300 | |||
+++ Python-3.8.0/setup.py 2019-10-22 10:01:36.394606000 +0300 | |||
@@ -2043,9 +2043,12 @@ | |||
self.add(ext) | |||
if TEST_EXTENSIONS: | |||
# function my_sqrt() needs libm for sqrt() | |||
+ ffi_test_libs = ['m'] | |||
+ if MS_WINDOWS: | |||
+ ffi_test_libs += ['oleaut32'] | |||
self.add(Extension('_ctypes_test', | |||
sources=['_ctypes/_ctypes_test.c'], | |||
- libraries=['m'])) | |||
+ libraries=ffi_test_libs)) | |||
ffi_inc_dirs = self.inc_dirs.copy() | |||
if MACOS: | |||
@@ -2073,6 +2076,8 @@ | |||
if ffi_inc and ffi_lib: | |||
ext.include_dirs.extend(ffi_inc) | |||
ext.libraries.append(ffi_lib) | |||
+ if MS_WINDOWS: | |||
+ ext.libraries.extend(['ole32', 'oleaut32', 'uuid']) | |||
self.use_system_libffi = True | |||
if sysconfig.get_config_var('HAVE_LIBDL'): |
@@ -0,0 +1,144 @@ | |||
diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac | |||
--- Python-3.8.0-orig/configure.ac 2019-10-22 10:01:27.970591200 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-22 10:01:39.327411100 +0300 | |||
@@ -4291,21 +4291,36 @@ | |||
],[]) | |||
AC_MSG_RESULT($was_it_defined) | |||
+AC_CHECK_HEADERS([ws2tcpip.h]) | |||
AC_MSG_CHECKING(for addrinfo) | |||
AC_CACHE_VAL(ac_cv_struct_addrinfo, | |||
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[struct addrinfo a]])], | |||
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |||
+#ifdef HAVE_WS2TCPIP_H | |||
+# include <ws2tcpip.h> | |||
+#else | |||
+# include <netdb.h> | |||
+#endif]], | |||
+ [[struct addrinfo a]])], | |||
[ac_cv_struct_addrinfo=yes], | |||
[ac_cv_struct_addrinfo=no])) | |||
AC_MSG_RESULT($ac_cv_struct_addrinfo) | |||
if test $ac_cv_struct_addrinfo = yes; then | |||
- AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)]) | |||
+ AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo]) | |||
fi | |||
AC_MSG_CHECKING(for sockaddr_storage) | |||
AC_CACHE_VAL(ac_cv_struct_sockaddr_storage, | |||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |||
-# include <sys/types.h> | |||
-# include <sys/socket.h>]], [[struct sockaddr_storage s]])], | |||
+#ifdef HAVE_WS2TCPIP_H | |||
+#include <ws2tcpip.h> | |||
+#endif | |||
+#ifdef HAVE_SYS_TYPES_H | |||
+#include <sys/types.h> | |||
+#endif | |||
+#ifdef HAVE_SYS_SOCKET_H | |||
+#include <sys/socket.h> | |||
+#endif]], | |||
+ [[struct sockaddr_storage s]])], | |||
[ac_cv_struct_sockaddr_storage=yes], | |||
[ac_cv_struct_sockaddr_storage=no])) | |||
AC_MSG_RESULT($ac_cv_struct_sockaddr_storage) | |||
@@ -5411,7 +5426,10 @@ | |||
AC_CHECK_TYPE(socklen_t,, | |||
AC_DEFINE(socklen_t,int, | |||
- [Define to `int' if <sys/socket.h> does not define.]),[ | |||
+ [Define to `int' if <sys/socket.h> or <ws2tcpip.h> does not define.]),[ | |||
+#ifdef HAVE_WS2TCPIP_H | |||
+#include <ws2tcpip.h> | |||
+#endif | |||
#ifdef HAVE_SYS_TYPES_H | |||
#include <sys/types.h> | |||
#endif | |||
diff -Naur Python-3.8.0-orig/Misc/config_mingw Python-3.8.0/Misc/config_mingw | |||
--- Python-3.8.0-orig/Misc/config_mingw 2019-10-22 10:00:45.989917400 +0300 | |||
+++ Python-3.8.0/Misc/config_mingw 2019-10-22 10:01:39.733011900 +0300 | |||
@@ -10,3 +10,6 @@ | |||
# files to ignore | |||
ac_cv_file__dev_ptmx=ignore #NOTE: under MSYS environment device exist | |||
ac_cv_file__dev_ptc=no | |||
+ | |||
+# force detection of winsock2 functionality - require wxp or newer | |||
+ac_cv_func_getpeername=yes | |||
diff -Naur Python-3.8.0-orig/Modules/socketmodule.c Python-3.8.0/Modules/socketmodule.c | |||
--- Python-3.8.0-orig/Modules/socketmodule.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Modules/socketmodule.c 2019-10-22 10:01:40.123012500 +0300 | |||
@@ -310,7 +310,7 @@ | |||
# endif | |||
/* Macros based on the IPPROTO enum, see: https://bugs.python.org/issue29515 */ | |||
-#ifdef MS_WINDOWS | |||
+#ifdef _MSC_VER | |||
#define IPPROTO_ICMP IPPROTO_ICMP | |||
#define IPPROTO_IGMP IPPROTO_IGMP | |||
#define IPPROTO_GGP IPPROTO_GGP | |||
@@ -341,7 +341,7 @@ | |||
#define IPPROTO_PGM IPPROTO_PGM // WinSock2 only | |||
#define IPPROTO_L2TP IPPROTO_L2TP // WinSock2 only | |||
#define IPPROTO_SCTP IPPROTO_SCTP // WinSock2 only | |||
-#endif /* MS_WINDOWS */ | |||
+#endif /* _MSC_VER */ | |||
/* Provides the IsWindows7SP1OrGreater() function */ | |||
#include <versionhelpers.h> | |||
@@ -434,6 +434,10 @@ | |||
/* Do not include addrinfo.h for MSVC7 or greater. 'addrinfo' and | |||
* EAI_* constants are defined in (the already included) ws2tcpip.h. | |||
*/ | |||
+#elif defined(__MINGW32__) | |||
+ /* Do not include addrinfo.h as minimum supported version is | |||
+ * _WIN32_WINNT >= WindowsXP(0x0501) | |||
+ */ | |||
#else | |||
# include "addrinfo.h" | |||
#endif | |||
diff -Naur Python-3.8.0-orig/pyconfig.h.in Python-3.8.0/pyconfig.h.in | |||
--- Python-3.8.0-orig/pyconfig.h.in 2019-10-22 10:00:35.132298300 +0300 | |||
+++ Python-3.8.0/pyconfig.h.in 2019-10-22 10:01:40.513013200 +0300 | |||
@@ -54,7 +54,7 @@ | |||
/* Define to 1 if you have the `acosh' function. */ | |||
#undef HAVE_ACOSH | |||
-/* struct addrinfo (netdb.h) */ | |||
+/* struct addrinfo */ | |||
#undef HAVE_ADDRINFO | |||
/* Define to 1 if you have the `alarm' function. */ | |||
@@ -1335,6 +1335,9 @@ | |||
/* Define if libssl has X509_VERIFY_PARAM_set1_host and related function */ | |||
#undef HAVE_X509_VERIFY_PARAM_SET1_HOST | |||
+/* Define to 1 if you have the <ws2tcpip.h> header file. */ | |||
+#undef HAVE_WS2TCPIP_H | |||
+ | |||
/* Define if the zlib library has inflateCopy */ | |||
#undef HAVE_ZLIB_COPY | |||
@@ -1644,7 +1647,7 @@ | |||
/* Define to `unsigned int' if <sys/types.h> does not define. */ | |||
#undef size_t | |||
-/* Define to `int' if <sys/socket.h> does not define. */ | |||
+/* Define to `int' if <sys/socket.h> or <ws2tcpip.h> does not define. */ | |||
#undef socklen_t | |||
/* Define to `int' if <sys/types.h> doesn't define. */ | |||
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py | |||
--- Python-3.8.0-orig/setup.py 2019-10-22 10:01:38.141809100 +0300 | |||
+++ Python-3.8.0/setup.py 2019-10-22 10:01:40.934214000 +0300 | |||
@@ -1050,7 +1050,11 @@ | |||
def detect_socket(self): | |||
# socket(2) | |||
if not VXWORKS: | |||
+ socket_libs = [] | |||
+ if MS_WINDOWS: | |||
+ socket_libs += ['ws2_32', 'iphlpapi'] | |||
self.add(Extension('_socket', ['socketmodule.c'], | |||
+ libraries = socket_libs, | |||
depends=['socketmodule.h'])) | |||
elif self.compiler.find_library_file(self.lib_dirs, 'net'): | |||
libs = ['net'] |
@@ -0,0 +1,76 @@ | |||
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py | |||
--- Python-3.8.0-orig/setup.py 2019-10-22 10:01:44.336020000 +0300 | |||
+++ Python-3.8.0/setup.py 2019-10-22 10:01:45.428021900 +0300 | |||
@@ -800,13 +800,21 @@ | |||
if (self.config_h_vars.get('FLOCK_NEEDS_LIBBSD', False)): | |||
# May be necessary on AIX for flock function | |||
libs = ['bsd'] | |||
- self.add(Extension('fcntl', ['fcntlmodule.c'], | |||
- libraries=libs)) | |||
+ if not MS_WINDOWS: | |||
+ self.add(Extension('fcntl', ['fcntlmodule.c'], | |||
+ libraries=libs)) | |||
+ else: | |||
+ self.missing.append('fcntl') | |||
# pwd(3) | |||
- self.add(Extension('pwd', ['pwdmodule.c'])) | |||
+ if not MS_WINDOWS: | |||
+ self.add(Extension('pwd', ['pwdmodule.c'])) | |||
+ else: | |||
+ self.missing.append('pwd') | |||
# grp(3) | |||
- if not VXWORKS: | |||
+ if not VXWORKS and not MS_WINDOWS: | |||
self.add(Extension('grp', ['grpmodule.c'])) | |||
+ else: | |||
+ self.missing.append('grp') | |||
# spwd, shadow passwords | |||
if (self.config_h_vars.get('HAVE_GETSPNAM', False) or | |||
self.config_h_vars.get('HAVE_GETSPENT', False)): | |||
@@ -831,7 +839,10 @@ | |||
# Lance Ellinghaus's syslog module | |||
# syslog daemon interface | |||
- self.add(Extension('syslog', ['syslogmodule.c'])) | |||
+ if not MS_WINDOWS: | |||
+ self.add(Extension('syslog', ['syslogmodule.c'])) | |||
+ else: | |||
+ self.missing.append('syslog') | |||
# Python interface to subinterpreter C-API. | |||
self.add(Extension('_xxsubinterpreters', ['_xxsubinterpretersmodule.c'])) | |||
@@ -857,7 +868,10 @@ | |||
self.add(Extension('_csv', ['_csv.c'])) | |||
# POSIX subprocess module helper. | |||
- self.add(Extension('_posixsubprocess', ['_posixsubprocess.c'])) | |||
+ if not MS_WINDOWS: | |||
+ self.add(Extension('_posixsubprocess', ['_posixsubprocess.c'])) | |||
+ else: | |||
+ self.missing.append('_posixsubprocess') | |||
def detect_test_extensions(self): | |||
# Python C API test module | |||
@@ -1039,13 +1053,16 @@ | |||
# the encryption. | |||
return | |||
- if self.compiler.find_library_file(self.lib_dirs, 'crypt'): | |||
- libs = ['crypt'] | |||
- else: | |||
- libs = [] | |||
+ if not MS_WINDOWS: | |||
+ if self.compiler.find_library_file(self.lib_dirs, 'crypt'): | |||
+ libs = ['crypt'] | |||
+ else: | |||
+ libs = [] | |||
- self.add(Extension('_crypt', ['_cryptmodule.c'], | |||
- libraries=libs)) | |||
+ self.add(Extension('_crypt', ['_cryptmodule.c'], | |||
+ libraries=libs)) | |||
+ else: | |||
+ self.missing.append('_crypt') | |||
def detect_socket(self): | |||
# socket(2) |
@@ -0,0 +1,69 @@ | |||
diff -Naur Python-3.8.0-orig/Modules/_winapi.c Python-3.8.0/Modules/_winapi.c | |||
--- Python-3.8.0-orig/Modules/_winapi.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Modules/_winapi.c 2019-10-22 10:01:48.485627300 +0300 | |||
@@ -39,7 +39,9 @@ | |||
#define WINDOWS_LEAN_AND_MEAN | |||
#include "windows.h" | |||
+#if defined(Py_DEBUG) | |||
#include <crtdbg.h> | |||
+#endif | |||
#include "winreparse.h" | |||
#if defined(MS_WIN32) && !defined(MS_WIN64) | |||
diff -Naur Python-3.8.0-orig/PC/msvcrtmodule.c Python-3.8.0/PC/msvcrtmodule.c | |||
--- Python-3.8.0-orig/PC/msvcrtmodule.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/PC/msvcrtmodule.c 2019-10-22 10:01:48.891228000 +0300 | |||
@@ -21,7 +21,9 @@ | |||
#include <io.h> | |||
#include <conio.h> | |||
#include <sys/locking.h> | |||
+#ifdef _DEBUG | |||
#include <crtdbg.h> | |||
+#endif | |||
#include <windows.h> | |||
#ifdef _MSC_VER | |||
diff -Naur Python-3.8.0-orig/Python/dynamic_annotations.c Python-3.8.0/Python/dynamic_annotations.c | |||
--- Python-3.8.0-orig/Python/dynamic_annotations.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Python/dynamic_annotations.c 2019-10-22 10:01:49.296828700 +0300 | |||
@@ -27,7 +27,7 @@ | |||
* Author: Kostya Serebryany | |||
*/ | |||
-#ifdef _MSC_VER | |||
+#ifdef MS_WINDOWS | |||
# include <windows.h> | |||
#endif | |||
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py | |||
--- Python-3.8.0-orig/setup.py 2019-10-22 10:01:47.378025300 +0300 | |||
+++ Python-3.8.0/setup.py 2019-10-22 10:01:49.702429400 +0300 | |||
@@ -1540,6 +1540,27 @@ | |||
'-framework', 'SystemConfiguration', | |||
'-framework', 'CoreFoundation'])) | |||
+ # Modules with some Windows dependencies: | |||
+ if MS_WINDOWS: | |||
+ srcdir = sysconfig.get_config_var('srcdir') | |||
+ pc_srcdir = os.path.abspath(os.path.join(srcdir, 'PC')) | |||
+ | |||
+ self.add(Extension('msvcrt', [os.path.join(pc_srcdir, p) | |||
+ for p in ['msvcrtmodule.c']])) | |||
+ | |||
+ self.add(Extension('_winapi', ['_winapi.c'])) | |||
+ | |||
+ self.add(Extension('_msi', [os.path.join(pc_srcdir, p) | |||
+ for p in ['_msi.c']], | |||
+ libraries=['msi','cabinet','rpcrt4'])) # To link with lib(msi|cabinet|rpcrt4).a | |||
+ | |||
+ self.add(Extension('winsound', [os.path.join(pc_srcdir, p) | |||
+ for p in ['winsound.c']], | |||
+ libraries=['winmm'])) | |||
+ | |||
+ self.add(Extension('_overlapped', ['overlapped.c'], | |||
+ libraries=['ws2_32'])) | |||
+ | |||
def detect_compress_exts(self): | |||
# Andrew Kuchling's zlib module. Note that some versions of zlib | |||
# 1.1.3 have security problems. See CERT Advisory CA-2002-07: |
@@ -0,0 +1,57 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/command/build_ext.py Python-3.8.0/Lib/distutils/command/build_ext.py | |||
--- Python-3.8.0-orig/Lib/distutils/command/build_ext.py 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Lib/distutils/command/build_ext.py 2019-10-22 10:01:53.789636600 +0300 | |||
@@ -186,7 +186,7 @@ | |||
# for extensions under windows use different directories | |||
# for Release and Debug builds. | |||
# also Python's library directory must be appended to library_dirs | |||
- if os.name == 'nt': | |||
+ if False: | |||
# the 'libs' directory is for binary installs - we assume that | |||
# must be the *native* platform. But we don't really support | |||
# cross-compiling via a binary install anyway, so we let it go. | |||
@@ -703,6 +703,20 @@ | |||
# pyconfig.h that MSVC groks. The other Windows compilers all seem | |||
# to need it mentioned explicitly, though, so that's what we do. | |||
# Append '_d' to the python import library on debug builds. | |||
+ | |||
+ # Use self.plat_name as it works even in case of | |||
+ # cross-compilation (at least for mingw build). | |||
+ if True: | |||
+ from distutils import sysconfig | |||
+ extra = [] | |||
+ for lib in ( | |||
+ sysconfig.get_config_var('BLDLIBRARY').split() | |||
+ + sysconfig.get_config_var('SHLIBS').split() | |||
+ ): | |||
+ if lib.startswith('-l'): | |||
+ extra.append(lib[2:]) | |||
+ return ext.libraries + extra | |||
+ | |||
if sys.platform == "win32": | |||
from distutils._msvccompiler import MSVCCompiler | |||
if not isinstance(self.compiler, MSVCCompiler): | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/util.py Python-3.8.0/Lib/distutils/util.py | |||
--- Python-3.8.0-orig/Lib/distutils/util.py 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Lib/distutils/util.py 2019-10-22 10:01:54.210837300 +0300 | |||
@@ -36,6 +36,8 @@ | |||
""" | |||
if os.name == 'nt': | |||
+ if True: | |||
+ return 'mingw' | |||
if 'amd64' in sys.version.lower(): | |||
return 'win-amd64' | |||
if '(arm)' in sys.version.lower(): | |||
diff -Naur Python-3.8.0-orig/Lib/sysconfig.py Python-3.8.0/Lib/sysconfig.py | |||
--- Python-3.8.0-orig/Lib/sysconfig.py 2019-10-22 10:00:21.731874800 +0300 | |||
+++ Python-3.8.0/Lib/sysconfig.py 2019-10-22 10:01:54.600838000 +0300 | |||
@@ -643,6 +643,8 @@ | |||
""" | |||
if os.name == 'nt': | |||
+ if True: | |||
+ return 'mingw' | |||
if 'amd64' in sys.version.lower(): | |||
return 'win-amd64' | |||
if '(arm)' in sys.version.lower(): |
@@ -0,0 +1,52 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/ccompiler.py Python-3.8.0/Lib/distutils/ccompiler.py | |||
--- Python-3.8.0-orig/Lib/distutils/ccompiler.py 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Lib/distutils/ccompiler.py 2019-10-22 10:01:58.266844500 +0300 | |||
@@ -9,7 +9,7 @@ | |||
from distutils.file_util import move_file | |||
from distutils.dir_util import mkpath | |||
from distutils.dep_util import newer_pairwise, newer_group | |||
-from distutils.util import split_quoted, execute | |||
+from distutils.util import split_quoted, execute, get_platform | |||
from distutils import log | |||
class CCompiler: | |||
@@ -948,6 +948,8 @@ | |||
osname = os.name | |||
if platform is None: | |||
platform = sys.platform | |||
+ if True: | |||
+ return 'mingw32' | |||
for pattern, compiler in _default_compilers: | |||
if re.match(pattern, platform) is not None or \ | |||
re.match(pattern, osname) is not None: | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/cygwinccompiler.py Python-3.8.0/Lib/distutils/cygwinccompiler.py | |||
--- Python-3.8.0-orig/Lib/distutils/cygwinccompiler.py 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Lib/distutils/cygwinccompiler.py 2019-10-22 10:01:58.656845200 +0300 | |||
@@ -255,11 +255,16 @@ | |||
output_dir = '' | |||
obj_names = [] | |||
for src_name in source_filenames: | |||
- # use normcase to make sure '.rc' is really '.rc' and not '.RC' | |||
- base, ext = os.path.splitext(os.path.normcase(src_name)) | |||
+ base, ext = os.path.splitext(src_name) | |||
+ # use 'normcase' only for resource suffixes | |||
+ ext_normcase = os.path.normcase(ext) | |||
+ if ext_normcase in ['.rc','.res']: | |||
+ ext = ext_normcase | |||
if ext not in (self.src_extensions + ['.rc','.res']): | |||
raise UnknownFileError("unknown file type '%s' (from '%s')" % \ | |||
(ext, src_name)) | |||
+ base = os.path.splitdrive(base)[1] # Chop off the drive | |||
+ base = base[os.path.isabs(base):] # If abs, chop off leading / | |||
if strip_dir: | |||
base = os.path.basename (base) | |||
if ext in ('.res', '.rc'): | |||
@@ -315,7 +320,7 @@ | |||
# Include the appropriate MSVC runtime library if Python was built | |||
# with MSVC 7.0 or later. | |||
- self.dll_libraries = get_msvcr() | |||
+ self.dll_libraries = get_msvcr() or [] | |||
# Because these compilers aren't configured in Python's pyconfig.h file by | |||
# default, we should at least warn the user if he is using an unmodified |
@@ -0,0 +1,11 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/cygwinccompiler.py Python-3.8.0/Lib/distutils/cygwinccompiler.py | |||
--- Python-3.8.0-orig/Lib/distutils/cygwinccompiler.py 2019-10-22 10:02:00.856449000 +0300 | |||
+++ Python-3.8.0/Lib/distutils/cygwinccompiler.py 2019-10-22 10:02:01.979651000 +0300 | |||
@@ -93,6 +93,7 @@ | |||
obj_extension = ".o" | |||
static_lib_extension = ".a" | |||
shared_lib_extension = ".dll" | |||
+ dylib_lib_extension = ".dll.a" | |||
static_lib_format = "lib%s%s" | |||
shared_lib_format = "%s%s" | |||
exe_extension = ".exe" |
@@ -0,0 +1,12 @@ | |||
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py | |||
--- Python-3.8.0-orig/setup.py 2019-10-22 10:01:52.635234600 +0300 | |||
+++ Python-3.8.0/setup.py 2019-10-22 10:02:04.772055900 +0300 | |||
@@ -2257,6 +2257,8 @@ | |||
openssl_includes = split_var('OPENSSL_INCLUDES', '-I') | |||
openssl_libdirs = split_var('OPENSSL_LDFLAGS', '-L') | |||
openssl_libs = split_var('OPENSSL_LIBS', '-l') | |||
+ if MS_WINDOWS: | |||
+ openssl_libs += ['ws2_32'] | |||
if not openssl_libs: | |||
# libssl and libcrypto not found | |||
self.missing.extend(['_ssl', '_hashlib']) |
@@ -0,0 +1,61 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/sysconfig.py Python-3.8.0/Lib/sysconfig.py | |||
--- Python-3.8.0-orig/Lib/sysconfig.py 2019-10-22 10:01:57.159242500 +0300 | |||
+++ Python-3.8.0/Lib/sysconfig.py 2019-10-22 10:02:07.580060800 +0300 | |||
@@ -97,6 +97,9 @@ | |||
_CONFIG_VARS = None | |||
_USER_BASE = None | |||
+# GCC[mingw*] use posix build system | |||
+_POSIX_BUILD = os.name == 'posix' or \ | |||
+ True | |||
def _safe_realpath(path): | |||
try: | |||
@@ -180,7 +183,7 @@ | |||
def _get_default_scheme(): | |||
- if os.name == 'posix': | |||
+ if _POSIX_BUILD: | |||
# the default scheme for posix is posix_prefix | |||
return 'posix_prefix' | |||
return os.name | |||
@@ -196,7 +199,7 @@ | |||
def joinuser(*args): | |||
return os.path.expanduser(os.path.join(*args)) | |||
- if os.name == "nt": | |||
+ if os.name == "nt" and not _POSIX_BUILD: | |||
base = os.environ.get("APPDATA") or "~" | |||
return joinuser(base, "Python") | |||
@@ -493,7 +496,7 @@ | |||
def get_config_h_filename(): | |||
"""Return the path of pyconfig.h.""" | |||
if _PYTHON_BUILD: | |||
- if os.name == "nt": | |||
+ if os.name == "nt" and not _POSIX_BUILD: | |||
inc_dir = os.path.join(_sys_home or _PROJECT_BASE, "PC") | |||
else: | |||
inc_dir = _sys_home or _PROJECT_BASE | |||
@@ -564,9 +567,9 @@ | |||
# sys.abiflags may not be defined on all platforms. | |||
_CONFIG_VARS['abiflags'] = '' | |||
- if os.name == 'nt': | |||
+ if os.name == 'nt' and not _POSIX_BUILD: | |||
_init_non_posix(_CONFIG_VARS) | |||
- if os.name == 'posix': | |||
+ if _POSIX_BUILD: | |||
_init_posix(_CONFIG_VARS) | |||
# For backward compatibility, see issue19555 | |||
SO = _CONFIG_VARS.get('EXT_SUFFIX') | |||
@@ -579,7 +582,7 @@ | |||
# Always convert srcdir to an absolute path | |||
srcdir = _CONFIG_VARS.get('srcdir', _PROJECT_BASE) | |||
- if os.name == 'posix': | |||
+ if _POSIX_BUILD: | |||
if _PYTHON_BUILD: | |||
# If srcdir is a relative path (typically '.' or '..') | |||
# then it should be interpreted relative to the directory |
@@ -0,0 +1,34 @@ | |||
diff -Naur Python-3.8.0-orig/Modules/_ctypes/_ctypes.c Python-3.8.0/Modules/_ctypes/_ctypes.c | |||
--- Python-3.8.0-orig/Modules/_ctypes/_ctypes.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Modules/_ctypes/_ctypes.c 2019-10-22 10:02:10.434865800 +0300 | |||
@@ -3342,11 +3342,30 @@ | |||
mangled_name = alloca(strlen(name) + 1 + 1 + 1 + 3); /* \0 _ @ %d */ | |||
if (!mangled_name) | |||
return NULL; | |||
+ /* Issue: for stdcall decorated export functions MSVC compiler adds | |||
+ * underscore, but GCC compiler create them without. This is | |||
+ * visible by example for _ctypes_test.pyd module. | |||
+ * As well functions from system libraries are without underscore. | |||
+ * Solutions: | |||
+ * - If a python module is build with gcc option --add-stdcall-alias | |||
+ * the module will contain XXX as alias for function XXX@ as result | |||
+ * first search in this method will succeed. | |||
+ * - Distutil may use compiler to create def-file, to modify it as | |||
+ * add underscore alias and with new def file to create module. | |||
+ * - Or may be just to search for function without underscore. | |||
+ */ | |||
for (i = 0; i < 32; ++i) { | |||
sprintf(mangled_name, "_%s@%d", name, i*4); | |||
Py_BEGIN_ALLOW_THREADS | |||
address = (PPROC)GetProcAddress(handle, mangled_name); | |||
Py_END_ALLOW_THREADS | |||
+ if (address) | |||
+ return address; | |||
+ /* search for function without underscore as weel */ | |||
+ sprintf(mangled_name, "%s@%d", name, i*4); | |||
+ Py_BEGIN_ALLOW_THREADS | |||
+ address = (PPROC)GetProcAddress(handle, mangled_name); | |||
+ Py_END_ALLOW_THREADS | |||
if (address) | |||
return address; | |||
} |
@@ -0,0 +1,12 @@ | |||
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py | |||
--- Python-3.8.0-orig/setup.py 2019-10-22 10:02:06.503658900 +0300 | |||
+++ Python-3.8.0/setup.py 2019-10-22 10:02:13.258470800 +0300 | |||
@@ -2434,7 +2434,7 @@ | |||
else: | |||
newfilename = filename + minoronly | |||
log.info('renaming %s to %s', filename, newfilename) | |||
- os.rename(filename, newfilename) | |||
+ os.replace(filename, newfilename) | |||
newoutfiles.append(newfilename) | |||
if filename in updated_files: | |||
newupdated_files.append(newfilename) |
@@ -0,0 +1,19 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/cygwinccompiler.py Python-3.8.0/Lib/distutils/cygwinccompiler.py | |||
--- Python-3.8.0-orig/Lib/distutils/cygwinccompiler.py 2019-10-22 10:02:03.680054000 +0300 | |||
+++ Python-3.8.0/Lib/distutils/cygwinccompiler.py 2019-10-22 10:02:16.066475700 +0300 | |||
@@ -48,7 +48,6 @@ | |||
import os | |||
import sys | |||
import copy | |||
-from subprocess import Popen, PIPE, check_output | |||
import re | |||
from distutils.ccompiler import gen_preprocess_options, gen_lib_options | |||
@@ -385,6 +384,7 @@ | |||
executable = cmd.split()[0] | |||
if find_executable(executable) is None: | |||
return None | |||
+ from subprocess import Popen, PIPE | |||
out = Popen(cmd, shell=True, stdout=PIPE).stdout | |||
try: | |||
out_string = out.read() |
@@ -0,0 +1,76 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/sysconfig.py Python-3.8.0/Lib/distutils/sysconfig.py | |||
--- Python-3.8.0-orig/Lib/distutils/sysconfig.py 2019-10-22 10:01:10.872961200 +0300 | |||
+++ Python-3.8.0/Lib/distutils/sysconfig.py 2019-10-22 10:02:18.890080700 +0300 | |||
@@ -65,6 +65,17 @@ | |||
python_build = _python_build() | |||
+def _posix_build(): | |||
+ # GCC[mingw*] use posix build system | |||
+ # Check for cross builds explicitly | |||
+ host_platform = os.environ.get("_PYTHON_HOST_PLATFORM") | |||
+ if host_platform: | |||
+ if host_platform.startswith('mingw'): | |||
+ return True | |||
+ return os.name == 'posix' or \ | |||
+ (os.name == "nt" and 'GCC' in sys.version) | |||
+posix_build = _posix_build() | |||
+ | |||
# Calculate the build qualifier flags if they are defined. Adding the flags | |||
# to the include and lib directories only makes sense for an installation, not | |||
# an in-source build. | |||
@@ -98,7 +109,7 @@ | |||
""" | |||
if prefix is None: | |||
prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX | |||
- if os.name == "posix": | |||
+ if posix_build: | |||
if python_build: | |||
# Assume the executable is in the build directory. The | |||
# pyconfig.h file should be in the same directory. Since | |||
@@ -145,7 +156,7 @@ | |||
else: | |||
prefix = plat_specific and EXEC_PREFIX or PREFIX | |||
- if os.name == "posix": | |||
+ if posix_build: | |||
libpython = os.path.join(prefix, | |||
"lib", "python" + get_python_version()) | |||
if standard_lib: | |||
@@ -255,7 +266,7 @@ | |||
def get_config_h_filename(): | |||
"""Return full pathname of installed pyconfig.h file.""" | |||
if python_build: | |||
- if os.name == "nt": | |||
+ if os.name == "nt" and not posix_build: | |||
inc_dir = os.path.join(_sys_home or project_base, "PC") | |||
else: | |||
inc_dir = _sys_home or project_base | |||
@@ -461,6 +472,9 @@ | |||
def _init_nt(): | |||
+ if posix_build: | |||
+ _init_posix() | |||
+ return | |||
"""Initialize the module as appropriate for NT""" | |||
g = {} | |||
# set basic install directories | |||
@@ -510,7 +524,7 @@ | |||
# Always convert srcdir to an absolute path | |||
srcdir = _config_vars.get('srcdir', project_base) | |||
- if os.name == 'posix': | |||
+ if posix_build: | |||
if python_build: | |||
# If srcdir is a relative path (typically '.' or '..') | |||
# then it should be interpreted relative to the directory | |||
@@ -529,7 +543,7 @@ | |||
# Normally it is relative to the build directory. However, during | |||
# testing, for example, we might be running a non-installed python | |||
# from a different directory. | |||
- if python_build and os.name == "posix": | |||
+ if python_build and posix_build: | |||
base = project_base | |||
if (not os.path.isabs(_config_vars['srcdir']) and | |||
base != os.getcwd()): |
@@ -0,0 +1,38 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/site.py Python-3.8.0/Lib/site.py | |||
--- Python-3.8.0-orig/Lib/site.py 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Lib/site.py 2019-10-22 10:02:21.776085800 +0300 | |||
@@ -251,7 +251,8 @@ | |||
def joinuser(*args): | |||
return os.path.expanduser(os.path.join(*args)) | |||
- if os.name == "nt": | |||
+ from sysconfig import _POSIX_BUILD | |||
+ if os.name == "nt" and not _POSIX_BUILD: | |||
base = os.environ.get("APPDATA") or "~" | |||
return joinuser(base, "Python") | |||
@@ -266,7 +267,8 @@ | |||
def _get_path(userbase): | |||
version = sys.version_info | |||
- if os.name == 'nt': | |||
+ from sysconfig import _POSIX_BUILD | |||
+ if sys.platform == 'win32' and not _POSIX_BUILD: | |||
return f'{userbase}\\Python{version[0]}{version[1]}\\site-packages' | |||
if sys.platform == 'darwin' and sys._framework: | |||
@@ -329,12 +331,13 @@ | |||
if prefixes is None: | |||
prefixes = PREFIXES | |||
+ from sysconfig import _POSIX_BUILD | |||
for prefix in prefixes: | |||
if not prefix or prefix in seen: | |||
continue | |||
seen.add(prefix) | |||
- if os.sep == '/': | |||
+ if _POSIX_BUILD: | |||
sitepackages.append(os.path.join(prefix, "lib", | |||
"python%d.%d" % sys.version_info[:2], | |||
"site-packages")) |
@@ -0,0 +1,143 @@ | |||
diff -Naur Python-3.8.0-orig/Misc/python-config.sh.in Python-3.8.0/Misc/python-config.sh.in | |||
--- Python-3.8.0-orig/Misc/python-config.sh.in 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Misc/python-config.sh.in 2019-10-22 10:02:24.584090700 +0300 | |||
@@ -1,32 +1,44 @@ | |||
#!/bin/sh | |||
-# Keep this script in sync with python-config.in | |||
- | |||
exit_with_usage () | |||
{ | |||
echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir|--embed" | |||
- exit $1 | |||
+ exit 1 | |||
} | |||
+# Really, python-config.py (and thus .sh) should be called directly, but | |||
+# sometimes software (e.g. GDB) calls python-config.sh as if it were the | |||
+# Python executable, passing python-config.py as the first argument. | |||
+# Work around that oddness by ignoring any .py passed as first arg. | |||
+case "$1" in | |||
+ *.py) | |||
+ shift | |||
+ ;; | |||
+esac | |||
+ | |||
if [ "$1" = "" ] ; then | |||
- exit_with_usage 1 | |||
+ exit_with_usage | |||
fi | |||
# Returns the actual prefix where this script was installed to. | |||
installed_prefix () | |||
{ | |||
- RESULT=$(dirname $(cd $(dirname "$1") && pwd -P)) | |||
- if which readlink >/dev/null 2>&1 ; then | |||
- if readlink -f "$RESULT" >/dev/null 2>&1; then | |||
- RESULT=$(readlink -f "$RESULT") | |||
- fi | |||
+ local RESULT=$(dirname $(cd $(dirname "$1") && pwd -P)) | |||
+ if [ $(which readlink) ] ; then | |||
+ RESULT=$(readlink -f "$RESULT") | |||
+ fi | |||
+ # Since we don't know where the output from this script will end up | |||
+ # we keep all paths in Windows-land since MSYS2 can handle that | |||
+ # while native tools can't handle paths in MSYS2-land. | |||
+ if [ "$OSTYPE" = "msys" ]; then | |||
+ RESULT=$(cd "$RESULT" && pwd -W) | |||
fi | |||
echo $RESULT | |||
} | |||
prefix_real=$(installed_prefix "$0") | |||
-# Use sed to fix paths from their built-to locations to their installed-to | |||
+# Use sed to fix paths from their built-to locations to their installed to | |||
# locations. Keep prefix & exec_prefix using their original values in case | |||
# they are referenced in other configure variables, to prevent double | |||
# substitution, issue #22140. | |||
@@ -41,13 +53,17 @@ | |||
LIBC="@LIBC@" | |||
SYSLIBS="$LIBM $LIBC" | |||
ABIFLAGS="@ABIFLAGS@" | |||
+# Protect against lack of substitution. | |||
+if [ "$ABIFLAGS" = "@""ABIFLAGS""@" ] ; then | |||
+ ABIFLAGS= | |||
+fi | |||
LIBS="@LIBPYTHON@ @LIBS@ $SYSLIBS" | |||
LIBS_EMBED="-lpython${VERSION}${ABIFLAGS} @LIBS@ $SYSLIBS" | |||
BASECFLAGS="@BASECFLAGS@" | |||
-LDLIBRARY="@LDLIBRARY@" | |||
OPT="@OPT@" | |||
PY_ENABLE_SHARED="@PY_ENABLE_SHARED@" | |||
LDVERSION="@LDVERSION@" | |||
+LDLIBRARY="@LDLIBRARY@" | |||
LIBDEST=${prefix_real}/lib/python${VERSION} | |||
LIBPL=$(echo "@LIBPL@" | sed "s#$prefix#$prefix_real#") | |||
SO="@EXT_SUFFIX@" | |||
@@ -61,7 +77,7 @@ | |||
do | |||
case $ARG in | |||
--help) | |||
- exit_with_usage 0 | |||
+ exit_with_usage | |||
;; | |||
--embed) | |||
PY_EMBED=1 | |||
@@ -69,7 +85,7 @@ | |||
--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--abiflags|--configdir) | |||
;; | |||
*) | |||
- exit_with_usage 1 | |||
+ exit_with_usage | |||
;; | |||
esac | |||
done | |||
@@ -80,37 +96,37 @@ | |||
for ARG in "$@" | |||
do | |||
- case "$ARG" in | |||
+ case $ARG in | |||
--prefix) | |||
- echo "$prefix_real" | |||
+ echo -ne "$prefix_real" | |||
;; | |||
--exec-prefix) | |||
- echo "$exec_prefix_real" | |||
+ echo -ne "$exec_prefix_real " | |||
;; | |||
--includes) | |||
- echo "$INCDIR $PLATINCDIR" | |||
+ echo -ne "$INCDIR $PLATINCDIR" | |||
;; | |||
--cflags) | |||
- echo "$INCDIR $PLATINCDIR $BASECFLAGS $CFLAGS $OPT" | |||
+ echo -ne "$INCDIR $PLATINCDIR $BASECFLAGS $CFLAGS $OPT" | |||
;; | |||
--libs) | |||
- echo "$LIBS" | |||
+ echo -ne "$LIBS" | |||
;; | |||
--ldflags) | |||
LIBPLUSED= | |||
if [ "$PY_ENABLE_SHARED" = "0" ] ; then | |||
LIBPLUSED="-L$LIBPL" | |||
fi | |||
- echo "$LIBPLUSED -L$libdir $LIBS" | |||
+ echo -ne "$LIBPLUSED -L$libdir $LIBS " | |||
;; | |||
--extension-suffix) | |||
- echo "$SO" | |||
+ echo -ne "$SO " | |||
;; | |||
--abiflags) | |||
- echo "$ABIFLAGS" | |||
+ echo -ne "$ABIFLAGS " | |||
;; | |||
--configdir) | |||
- echo "$LIBPL" | |||
+ echo -ne "$LIBPL " | |||
;; | |||
esac | |||
done |
@@ -0,0 +1,120 @@ | |||
diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac | |||
--- Python-3.8.0-orig/configure.ac 2019-10-22 10:01:42.698017100 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-22 10:02:27.392095600 +0300 | |||
@@ -377,6 +377,7 @@ | |||
then | |||
# avoid using uname for cross builds | |||
if test "$cross_compiling" = yes; then | |||
+ ac_sys_release= | |||
# ac_sys_system and ac_sys_release are used for setting | |||
# a lot of different things including 'define_xopen_source' | |||
# in the case statement below. | |||
@@ -390,6 +391,27 @@ | |||
*-*-cygwin*) | |||
ac_sys_system=Cygwin | |||
;; | |||
+ *-*-darwin*) | |||
+ ac_sys_system=Darwin | |||
+ ac_sys_release=$(echo $host | sed -n 's/.*-[^0-9]\+\([0-9]\+\)/\1/p') | |||
+ if test -z "$ac_sys_release"; then | |||
+ # A reasonable default. | |||
+ ac_sys_release=11 | |||
+ fi | |||
+ # Use the last released version number for old versions. | |||
+ if test "$ac_sys_release" = "9" ; then | |||
+ ac_sys_release=9.8 | |||
+ elif test "$ac_sys_release" = "10" ; then | |||
+ ac_sys_release=10.8 | |||
+ elif test "$ac_sys_release" = "11" ; then | |||
+ ac_sys_release=11.4.0 | |||
+ elif test "$ac_sys_release" = "12" ; then | |||
+ ac_sys_release=12.0.0 | |||
+ else | |||
+ # ..and .0.0 for unknown versions. | |||
+ ac_sys_release=${ac_sys_release}.0.0 | |||
+ fi | |||
+ ;; | |||
*-*-vxworks*) | |||
ac_sys_system=VxWorks | |||
;; | |||
@@ -398,7 +420,6 @@ | |||
MACHDEP="unknown" | |||
AC_MSG_ERROR([cross build not supported for $host]) | |||
esac | |||
- ac_sys_release= | |||
else | |||
ac_sys_system=`uname -s` | |||
if test "$ac_sys_system" = "AIX" \ | |||
@@ -445,6 +466,9 @@ | |||
*-*-mingw*) | |||
_host_cpu= | |||
;; | |||
+ *-*-darwin*) | |||
+ _host_cpu= | |||
+ ;; | |||
*) | |||
# for now, limit cross builds to known configurations | |||
MACHDEP="unknown" | |||
@@ -1619,6 +1643,26 @@ | |||
AC_SUBST(CFLAGS_NODIST) | |||
AC_SUBST(LDFLAGS_NODIST) | |||
+if test "x$cross_compiling" = xyes; then | |||
+ function cross_arch | |||
+ { | |||
+ case $host in | |||
+ x86_64*darwin*) | |||
+ echo i386 | |||
+ ;; | |||
+ x86_64*) | |||
+ echo x86_64 | |||
+ ;; | |||
+ *) | |||
+ echo i386 | |||
+ ;; | |||
+ esac | |||
+ } | |||
+ ARCH_PROG=cross_arch | |||
+else | |||
+ ARCH_PROG=/usr/bin/arch | |||
+fi | |||
+ | |||
# The -arch flags for universal builds on OSX | |||
UNIVERSAL_ARCH_FLAGS= | |||
AC_SUBST(UNIVERSAL_ARCH_FLAGS) | |||
@@ -1970,7 +2014,7 @@ | |||
;; | |||
esac | |||
else | |||
- if test `/usr/bin/arch` = "i386" | |||
+ if test "$($ARCH_PROG)" = "i386" | |||
then | |||
# 10.4 was the first release to support Intel archs | |||
cur_target="10.4" | |||
@@ -2526,7 +2570,7 @@ | |||
if test "${enable_universalsdk}"; then | |||
: | |||
else | |||
- LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `/usr/bin/arch`" | |||
+ LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only $($ARCH_PROG)" | |||
fi | |||
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' | |||
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; | |||
@@ -2551,7 +2595,7 @@ | |||
]])],[ac_osx_32bit=yes],[ac_osx_32bit=no],[ac_osx_32bit=yes]) | |||
if test "${ac_osx_32bit}" = "yes"; then | |||
- case `/usr/bin/arch` in | |||
+ case $($ARCH_PROG) in | |||
i386) | |||
MACOSX_DEFAULT_ARCH="i386" | |||
;; | |||
@@ -2563,7 +2607,7 @@ | |||
;; | |||
esac | |||
else | |||
- case `/usr/bin/arch` in | |||
+ case $($ARCH_PROG) in | |||
i386) | |||
MACOSX_DEFAULT_ARCH="x86_64" | |||
;; |
@@ -0,0 +1,43 @@ | |||
diff -Naur Python-3.8.0-orig/Include/internal/pycore_condvar.h Python-3.8.0/Include/internal/pycore_condvar.h | |||
--- Python-3.8.0-orig/Include/internal/pycore_condvar.h 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Include/internal/pycore_condvar.h 2019-10-22 10:02:30.231300600 +0300 | |||
@@ -5,6 +5,12 @@ | |||
# error "this header requires Py_BUILD_CORE define" | |||
#endif | |||
+#ifdef __MINGW32__ | |||
+# if !defined(HAVE_PTHREAD_H) || defined(NT_THREADS) | |||
+# undef _POSIX_THREADS | |||
+# endif | |||
+#endif | |||
+ | |||
#ifndef _POSIX_THREADS | |||
/* This means pthreads are not implemented in libc headers, hence the macro | |||
not present in unistd.h. But they still can be implemented as an external | |||
@@ -37,6 +43,10 @@ | |||
/* include windows if it hasn't been done before */ | |||
#define WIN32_LEAN_AND_MEAN | |||
#include <windows.h> | |||
+/* winpthreads are involved via windows header, so need undef _POSIX_THREADS after header include */ | |||
+#if defined(_POSIX_THREADS) | |||
+#undef _POSIX_THREADS | |||
+#endif | |||
/* options */ | |||
/* non-emulated condition variables are provided for those that want | |||
diff -Naur Python-3.8.0-orig/Include/pythread.h Python-3.8.0/Include/pythread.h | |||
--- Python-3.8.0-orig/Include/pythread.h 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Include/pythread.h 2019-10-22 10:02:30.652501400 +0300 | |||
@@ -9,6 +9,12 @@ | |||
extern "C" { | |||
#endif | |||
+#ifdef __MINGW32__ | |||
+# if !defined(HAVE_PTHREAD_H) || defined(NT_THREADS) | |||
+# undef _POSIX_THREADS | |||
+# endif | |||
+#endif | |||
+ | |||
/* Return status codes for Python lock acquisition. Chosen for maximum | |||
* backwards compatibility, ie failure -> 0, success -> 1. */ | |||
typedef enum PyLockStatus { |
@@ -0,0 +1,14 @@ | |||
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py | |||
--- Python-3.8.0-orig/setup.py 2019-10-22 10:02:14.974473800 +0300 | |||
+++ Python-3.8.0/setup.py 2019-10-22 10:02:33.866107000 +0300 | |||
@@ -2030,6 +2030,10 @@ | |||
return True | |||
def configure_ctypes(self, ext): | |||
+ if MS_WINDOWS: | |||
+ ext.libraries.extend(['ole32', 'oleaut32', 'uuid']) | |||
+ ext.export_symbols.extend(['DllGetClassObject PRIVATE', | |||
+ 'DllCanUnloadNow PRIVATE']) | |||
if not self.use_system_libffi: | |||
if MACOS: | |||
return self.configure_ctypes_darwin(ext) |
@@ -0,0 +1,377 @@ | |||
diff -Naur Python-3.8.0-orig/Include/pylifecycle.h Python-3.8.0/Include/pylifecycle.h | |||
--- Python-3.8.0-orig/Include/pylifecycle.h 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Include/pylifecycle.h 2019-10-22 10:02:36.752112100 +0300 | |||
@@ -21,6 +21,12 @@ | |||
PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void); | |||
PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *); | |||
+PyAPI_FUNC(wchar_t) Py_GetSepW(const wchar_t *); | |||
+PyAPI_FUNC(char) Py_GetSepA(const char *); | |||
+ | |||
+PyAPI_FUNC(void) Py_NormalizeSepsW(wchar_t *); | |||
+PyAPI_FUNC(void) Py_NormalizeSepsA(char *); | |||
+ | |||
/* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level | |||
* exit functions. | |||
diff -Naur Python-3.8.0-orig/Lib/ntpath.py Python-3.8.0/Lib/ntpath.py | |||
--- Python-3.8.0-orig/Lib/ntpath.py 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Lib/ntpath.py 2019-10-22 10:02:37.157712800 +0300 | |||
@@ -11,9 +11,7 @@ | |||
curdir = '.' | |||
pardir = '..' | |||
extsep = '.' | |||
-sep = '\\' | |||
pathsep = ';' | |||
-altsep = '/' | |||
defpath = '.;C:\\bin' | |||
devnull = 'nul' | |||
@@ -23,6 +21,15 @@ | |||
import genericpath | |||
from genericpath import * | |||
+if sys.platform == "win32" and "MSYSTEM" in os.environ: | |||
+ sep = '/' | |||
+ altsep = '\\' | |||
+else: | |||
+ sep = '\\' | |||
+ altsep = '/' | |||
+bsep = str.encode(sep) | |||
+baltsep = str.encode(altsep) | |||
+ | |||
__all__ = ["normcase","isabs","join","splitdrive","split","splitext", | |||
"basename","dirname","commonprefix","getsize","getmtime", | |||
"getatime","getctime", "islink","exists","lexists","isdir","isfile", | |||
@@ -33,9 +40,27 @@ | |||
def _get_bothseps(path): | |||
if isinstance(path, bytes): | |||
- return b'\\/' | |||
+ return bsep+baltsep | |||
+ else: | |||
+ return sep+altsep | |||
+ | |||
+def _get_sep(path): | |||
+ if isinstance(path, bytes): | |||
+ return bsep | |||
+ else: | |||
+ return sep | |||
+ | |||
+def _get_altsep(path): | |||
+ if isinstance(path, bytes): | |||
+ return baltsep | |||
+ else: | |||
+ return altsep | |||
+ | |||
+def _get_colon(path): | |||
+ if isinstance(path, bytes): | |||
+ return b':' | |||
else: | |||
- return '\\/' | |||
+ return ':' | |||
# Normalize the case of a pathname and map slashes to backslashes. | |||
# Other normalizations (such as optimizing '../' away) are not done | |||
@@ -47,9 +72,9 @@ | |||
Makes all characters lowercase and all slashes into backslashes.""" | |||
s = os.fspath(s) | |||
if isinstance(s, bytes): | |||
- return s.replace(b'/', b'\\').lower() | |||
+ return s.replace(baltsep, bsep).lower() | |||
else: | |||
- return s.replace('/', '\\').lower() | |||
+ return s.replace(altsep, sep).lower() | |||
# Return whether a path is absolute. | |||
@@ -68,14 +93,9 @@ | |||
# Join two (or more) paths. | |||
def join(path, *paths): | |||
path = os.fspath(path) | |||
- if isinstance(path, bytes): | |||
- sep = b'\\' | |||
- seps = b'\\/' | |||
- colon = b':' | |||
- else: | |||
- sep = '\\' | |||
- seps = '\\/' | |||
- colon = ':' | |||
+ sep = _get_sep(path) | |||
+ seps = _get_bothseps(path) | |||
+ colon = _get_colon(path) | |||
try: | |||
if not paths: | |||
path[:0] + sep #23780: Ensure compatible data type even if p is null. | |||
@@ -134,14 +154,9 @@ | |||
""" | |||
p = os.fspath(p) | |||
if len(p) >= 2: | |||
- if isinstance(p, bytes): | |||
- sep = b'\\' | |||
- altsep = b'/' | |||
- colon = b':' | |||
- else: | |||
- sep = '\\' | |||
- altsep = '/' | |||
- colon = ':' | |||
+ sep = _get_sep(p) | |||
+ altsep = _get_altsep(p) | |||
+ colon = _get_colon(p) | |||
normp = p.replace(altsep, sep) | |||
if (normp[0:2] == sep*2) and (normp[2:3] != sep): | |||
# is a UNC path: | |||
@@ -195,9 +210,9 @@ | |||
def splitext(p): | |||
p = os.fspath(p) | |||
if isinstance(p, bytes): | |||
- return genericpath._splitext(p, b'\\', b'/', b'.') | |||
+ return genericpath._splitext(p, bsep, baltsep, b'.') | |||
else: | |||
- return genericpath._splitext(p, '\\', '/', '.') | |||
+ return genericpath._splitext(p, sep, altsep, '.') | |||
splitext.__doc__ = genericpath._splitext.__doc__ | |||
@@ -442,15 +457,13 @@ | |||
def normpath(path): | |||
"""Normalize path, eliminating double slashes, etc.""" | |||
path = os.fspath(path) | |||
+ sep = _get_sep(path) | |||
+ altsep = _get_altsep(path) | |||
if isinstance(path, bytes): | |||
- sep = b'\\' | |||
- altsep = b'/' | |||
curdir = b'.' | |||
pardir = b'..' | |||
special_prefixes = (b'\\\\.\\', b'\\\\?\\') | |||
else: | |||
- sep = '\\' | |||
- altsep = '/' | |||
curdir = '.' | |||
pardir = '..' | |||
special_prefixes = ('\\\\.\\', '\\\\?\\') | |||
@@ -620,6 +620,7 @@ | |||
# strip the prefix anyway. | |||
if ex.winerror == initial_winerror: | |||
path = spath | |||
+ path = normpath(path) | |||
return path | |||
@@ -645,12 +658,11 @@ | |||
def relpath(path, start=None): | |||
"""Return a relative version of a path""" | |||
path = os.fspath(path) | |||
+ sep = _get_sep(path) | |||
if isinstance(path, bytes): | |||
- sep = b'\\' | |||
curdir = b'.' | |||
pardir = b'..' | |||
else: | |||
- sep = '\\' | |||
curdir = '.' | |||
pardir = '..' | |||
@@ -705,13 +717,11 @@ | |||
raise ValueError('commonpath() arg is an empty sequence') | |||
paths = tuple(map(os.fspath, paths)) | |||
+ sep = _get_sep(paths[0]) | |||
+ altsep = _get_altsep(paths[0]) | |||
if isinstance(paths[0], bytes): | |||
- sep = b'\\' | |||
- altsep = b'/' | |||
curdir = b'.' | |||
else: | |||
- sep = '\\' | |||
- altsep = '/' | |||
curdir = '.' | |||
try: | |||
diff -Naur Python-3.8.0-orig/Modules/posixmodule.c Python-3.8.0/Modules/posixmodule.c | |||
--- Python-3.8.0-orig/Modules/posixmodule.c 2019-10-22 10:00:56.988936800 +0300 | |||
+++ Python-3.8.0/Modules/posixmodule.c 2019-10-22 10:02:37.547713500 +0300 | |||
@@ -3438,6 +3438,7 @@ | |||
return PyErr_SetFromWindowsErr(0); | |||
} | |||
+ Py_NormalizeSepsW(wbuf2); | |||
PyObject *resobj = PyUnicode_FromWideChar(wbuf2, len); | |||
if (wbuf2 != wbuf) { | |||
PyMem_RawFree(wbuf2); | |||
@@ -3886,6 +3887,7 @@ | |||
result = GetFullPathNameW(path->wide, result, woutbufp, &wtemp); | |||
} | |||
if (result) { | |||
+ Py_NormalizeSepsW(woutbufp); | |||
v = PyUnicode_FromWideChar(woutbufp, wcslen(woutbufp)); | |||
if (path->narrow) | |||
Py_SETREF(v, PyUnicode_EncodeFSDefault(v)); | |||
@@ -3962,6 +3964,7 @@ | |||
target_path = tmp; | |||
} | |||
+ Py_NormalizeSepsW(target_path); | |||
result = PyUnicode_FromWideChar(target_path, result_length); | |||
if (result && path->narrow) { | |||
Py_SETREF(result, PyUnicode_EncodeFSDefault(result)); | |||
diff -Naur Python-3.8.0-orig/Python/initconfig.c Python-3.8.0/Python/initconfig.c | |||
--- Python-3.8.0-orig/Python/initconfig.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Python/initconfig.c 2019-10-22 10:02:37.968914200 +0300 | |||
@@ -98,7 +98,7 @@ | |||
"PYTHONDEVMODE: enable the development mode.\n" | |||
"PYTHONPYCACHEPREFIX: root directory for bytecode cache (pyc) files.\n"; | |||
-#if defined(MS_WINDOWS) | |||
+#if defined(_MSC_VER) | |||
# define PYTHONHOMEHELP "<prefix>\\python{major}{minor}" | |||
#else | |||
# define PYTHONHOMEHELP "<prefix>/lib/pythonX.X" | |||
@@ -1129,7 +1129,7 @@ | |||
} | |||
/* Last fall back: hardcoded name */ | |||
-#ifdef MS_WINDOWS | |||
+#ifdef _MSC_VER | |||
const wchar_t *default_program_name = L"python"; | |||
#else | |||
const wchar_t *default_program_name = L"python3"; | |||
diff -Naur Python-3.8.0-orig/Python/pathconfig.c Python-3.8.0/Python/pathconfig.c | |||
--- Python-3.8.0-orig/Python/pathconfig.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Python/pathconfig.c 2019-10-22 10:02:38.358914900 +0300 | |||
@@ -13,6 +13,114 @@ | |||
extern "C" { | |||
#endif | |||
+#ifdef __MINGW32__ | |||
+#define wcstok wcstok_s | |||
+#include <windows.h> | |||
+#endif | |||
+ | |||
+char | |||
+Py_GetSepA(const 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 char | |||
+Py_GetAltSepA(const 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(const wchar_t *name) | |||
+{ | |||
+ char* msystem = (char*)2; /* So that non Windows use / as sep */ | |||
+ static wchar_t sep = L'\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, L"\\\\?\\", sizeof(L"\\\\?\\") - sizeof(wchar_t)) == 0) | |||
+ { | |||
+ return L'\\'; | |||
+ } | |||
+#endif | |||
+ if (sep != L'\0') | |||
+ return sep; | |||
+#if defined(__MINGW32__) | |||
+ msystem = Py_GETENV("MSYSTEM"); | |||
+#endif | |||
+ if (msystem != NULL) | |||
+ sep = L'/'; | |||
+ else | |||
+ sep = L'\\'; | |||
+ return sep; | |||
+} | |||
+ | |||
+static wchar_t | |||
+Py_GetAltSepW(const wchar_t *name) | |||
+{ | |||
+ char sep = Py_GetSepW(name); | |||
+ if (sep == L'/') | |||
+ return L'\\'; | |||
+ return L'/'; | |||
+} | |||
+ | |||
+void | |||
+Py_NormalizeSepsW(wchar_t *name) | |||
+{ | |||
+ wchar_t sep = Py_GetSepW(name); | |||
+ wchar_t altsep = Py_GetAltSepW(name); | |||
+ wchar_t* seps; | |||
+ if (wcslen(name) > 1 && name[1] == L':') { | |||
+ name[0] = towupper(name[0]); | |||
+ } | |||
+ seps = wcschr(name, altsep); | |||
+ while(seps) { | |||
+ *seps = sep; | |||
+ seps = wcschr(seps, altsep); | |||
+ } | |||
+} | |||
_PyPathConfig _Py_path_config = _PyPathConfig_INIT; | |||
#ifdef MS_WINDOWS | |||
@@ -560,6 +668,7 @@ | |||
if (_Py_path_config.program_name == NULL) { | |||
Py_FatalError("Py_SetProgramName() failed: out of memory"); | |||
} | |||
+ Py_NormalizeSepsW(_Py_path_config.program_name); | |||
} | |||
void | |||
diff -Naur Python-3.8.0-orig/Python/traceback.c Python-3.8.0/Python/traceback.c | |||
--- Python-3.8.0-orig/Python/traceback.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Python/traceback.c 2019-10-22 10:02:39.170116300 +0300 | |||
@@ -315,7 +315,7 @@ | |||
filepath = PyBytes_AS_STRING(filebytes); | |||
/* Search tail of filename in sys.path before giving up */ | |||
- tail = strrchr(filepath, SEP); | |||
+ tail = strrchr(filepath, Py_GetSepA(filepath)); | |||
if (tail == NULL) | |||
tail = filepath; | |||
else |
@@ -0,0 +1,401 @@ | |||
diff -Naur Python-3.8.0-orig/Include/pylifecycle.h Python-3.8.0/Include/pylifecycle.h | |||
--- Python-3.8.0-orig/Include/pylifecycle.h 2019-10-22 10:02:41.276120000 +0300 | |||
+++ Python-3.8.0/Include/pylifecycle.h 2019-10-22 10:02:44.427325500 +0300 | |||
@@ -53,7 +53,7 @@ | |||
PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void); | |||
PyAPI_FUNC(wchar_t *) Py_GetPath(void); | |||
PyAPI_FUNC(void) Py_SetPath(const wchar_t *); | |||
-#ifdef MS_WINDOWS | |||
+#ifdef _MSC_VER | |||
int _Py_CheckPython3(void); | |||
#endif | |||
diff -Naur Python-3.8.0-orig/Modules/getpath.c Python-3.8.0/Modules/getpath.c | |||
--- Python-3.8.0-orig/Modules/getpath.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Modules/getpath.c 2019-10-22 10:02:44.848526300 +0300 | |||
@@ -14,6 +14,11 @@ | |||
# include <mach-o/dyld.h> | |||
#endif | |||
+#ifdef MS_WINDOWS | |||
+#include <windows.h> | |||
+#include <shlwapi.h> | |||
+#endif | |||
+ | |||
/* Search in some common locations for the associated Python libraries. | |||
* | |||
* Two directories must be found, the platform independent directory | |||
@@ -132,13 +137,39 @@ | |||
int prefix_found; /* found platform independent libraries? */ | |||
int exec_prefix_found; /* found the platform dependent libraries? */ | |||
+ wchar_t *dll_path; | |||
int warnings; | |||
const wchar_t *pythonpath_env; | |||
} PyCalculatePath; | |||
static const wchar_t delimiter[2] = {DELIM, '\0'}; | |||
-static const wchar_t separator[2] = {SEP, '\0'}; | |||
+static wchar_t separator[2] = {SEP, '\0'}; | |||
+static int | |||
+is_sep(wchar_t ch) | |||
+{ | |||
+#ifdef _WIN32 | |||
+ return ch == SEP || ch == ALTSEP; | |||
+#else | |||
+ return ch == SEP; | |||
+#endif | |||
+} | |||
+ | |||
+static int | |||
+is_absolute(const wchar_t *path) | |||
+{ | |||
+#ifdef _WIN32 | |||
+ size_t i = wcslen(path); | |||
+ if (i >= 3) { | |||
+ if (iswalpha(path[0]) && path[1] == L':' && is_sep(path[2])) { | |||
+ return 1; | |||
+ } | |||
+ } | |||
+ return 0; | |||
+#else | |||
+ return path[0] == SEP; | |||
+#endif | |||
+} | |||
/* Get file status. Encode the path to the locale encoding. */ | |||
static int | |||
@@ -161,7 +192,7 @@ | |||
reduce(wchar_t *dir) | |||
{ | |||
size_t i = wcslen(dir); | |||
- while (i > 0 && dir[i] != SEP) { | |||
+ while (i > 0 && !is_sep(dir[i])) { | |||
--i; | |||
} | |||
dir[i] = '\0'; | |||
@@ -241,14 +272,14 @@ | |||
joinpath(wchar_t *buffer, const wchar_t *stuff, size_t buflen) | |||
{ | |||
size_t n, k; | |||
- if (stuff[0] != SEP) { | |||
+ if (!is_sep(stuff[0])) { | |||
n = wcslen(buffer); | |||
if (n >= buflen) { | |||
return PATHLEN_ERR(); | |||
} | |||
- if (n > 0 && buffer[n-1] != SEP) { | |||
- buffer[n++] = SEP; | |||
+ if (n > 0 && !is_sep(buffer[n-1]) != SEP) { | |||
+ buffer[n++] = Py_GetSepW(buffer); | |||
} | |||
} | |||
else { | |||
@@ -284,7 +315,7 @@ | |||
static PyStatus | |||
copy_absolute(wchar_t *path, const wchar_t *p, size_t pathlen) | |||
{ | |||
- if (p[0] == SEP) { | |||
+ if (is_absolute(p)) { | |||
if (safe_wcscpy(path, p, pathlen) < 0) { | |||
return PATHLEN_ERR(); | |||
} | |||
@@ -297,7 +328,7 @@ | |||
} | |||
return _PyStatus_OK(); | |||
} | |||
- if (p[0] == '.' && p[1] == SEP) { | |||
+ if (p[0] == '.' && is_sep(p[1])) { | |||
p += 2; | |||
} | |||
PyStatus status = joinpath(path, p, pathlen); | |||
@@ -313,7 +344,7 @@ | |||
static PyStatus | |||
absolutize(wchar_t *path, size_t path_len) | |||
{ | |||
- if (path[0] == SEP) { | |||
+ if (is_absolute(path)) { | |||
return _PyStatus_OK(); | |||
} | |||
@@ -403,6 +434,7 @@ | |||
return status; | |||
} | |||
+ Py_NormalizeSepsW(path); | |||
if (isfile(path)) { | |||
/* Check VPATH to see if argv0_path is in the build directory. | |||
VPATH can be empty. */ | |||
@@ -427,6 +459,7 @@ | |||
return status; | |||
} | |||
+ Py_NormalizeSepsW(prefix); | |||
if (ismodule(prefix, prefix_len)) { | |||
*found = -1; | |||
reduce(prefix); | |||
@@ -529,12 +562,21 @@ | |||
* return the compiled-in defaults instead. | |||
*/ | |||
if (calculate->prefix_found > 0) { | |||
+#ifdef _WIN32 | |||
+ wchar_t drive_root[3]; | |||
+ memset(drive_root, 0, sizeof(drive_root)); | |||
+ wcsncpy(drive_root, prefix, 3); | |||
+#endif | |||
reduce(prefix); | |||
reduce(prefix); | |||
/* The prefix is the root directory, but reduce() chopped | |||
* off the "/". */ | |||
if (!prefix[0]) { | |||
+#ifdef _WIN32 | |||
+ wcsncpy(prefix, drive_root, 3); | |||
+#else | |||
wcscpy(prefix, separator); | |||
+#endif | |||
} | |||
pathconfig->prefix = _PyMem_RawWcsdup(prefix); | |||
} | |||
@@ -649,6 +691,7 @@ | |||
/* Check for pybuilddir.txt */ | |||
assert(*found == 0); | |||
+ Py_NormalizeSepsW(exec_prefix); | |||
status = calculate_pybuilddir(argv0_path, exec_prefix, exec_prefix_len, | |||
found); | |||
if (_PyStatus_EXCEPTION(status)) { | |||
@@ -734,6 +777,7 @@ | |||
if (_PyStatus_EXCEPTION(status)) { | |||
return status; | |||
} | |||
+ Py_NormalizeSepsW(exec_prefix); | |||
} | |||
/* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */ | |||
return _PyStatus_OK(); | |||
@@ -746,11 +790,20 @@ | |||
wchar_t *exec_prefix) | |||
{ | |||
if (calculate->exec_prefix_found > 0) { | |||
+#ifdef _WIN32 | |||
+ wchar_t drive_root[3]; | |||
+ memset(drive_root, 0, sizeof(drive_root)); | |||
+ wcsncpy(drive_root, exec_prefix, 3); | |||
+#endif | |||
reduce(exec_prefix); | |||
reduce(exec_prefix); | |||
reduce(exec_prefix); | |||
if (!exec_prefix[0]) { | |||
+#ifdef _WIN32 | |||
+ wcsncpy(exec_prefix, drive_root, 3); | |||
+#else | |||
wcscpy(exec_prefix, separator); | |||
+#endif | |||
} | |||
pathconfig->exec_prefix = _PyMem_RawWcsdup(exec_prefix); | |||
@@ -767,6 +820,48 @@ | |||
} | |||
+#ifdef MS_WINDOWS | |||
+static int | |||
+GetWindowsModulePaths(wchar_t *progpath) | |||
+{ | |||
+ int result = 0; | |||
+ wchar_t program_full_path[MAXPATHLEN+1]; | |||
+ memset(program_full_path, 0, sizeof(program_full_path)); | |||
+ | |||
+ if (GetModuleFileNameW(NULL, program_full_path, MAXPATHLEN)) { | |||
+ result = 1; | |||
+ Py_NormalizeSepsW(program_full_path); | |||
+ } | |||
+ | |||
+ wcscpy(progpath, program_full_path); | |||
+ return result; | |||
+} | |||
+ | |||
+ | |||
+wchar_t* | |||
+_Py_GetDLLPath(void) | |||
+{ | |||
+ wchar_t dll_path[MAXPATHLEN+1]; | |||
+ memset(dll_path, 0, sizeof(dll_path)); | |||
+ | |||
+#ifdef Py_ENABLE_SHARED | |||
+ extern HANDLE PyWin_DLLhModule; | |||
+ if (PyWin_DLLhModule) { | |||
+ if (GetModuleFileNameW(PyWin_DLLhModule, dll_path, MAXPATHLEN)) { | |||
+ Py_NormalizeSepsW(dll_path); | |||
+ } else { | |||
+ dll_path[0] = 0; | |||
+ } | |||
+ } | |||
+#else | |||
+ dll_path[0] = 0; | |||
+#endif | |||
+ | |||
+ return _PyMem_RawWcsdup(dll_path); | |||
+} | |||
+#endif /* MS_WINDOWS */ | |||
+ | |||
+ | |||
static PyStatus | |||
calculate_program_full_path(PyCalculatePath *calculate, _PyPathConfig *pathconfig) | |||
{ | |||
@@ -789,7 +884,7 @@ | |||
* other way to find a directory to start the search from. If | |||
* $PATH isn't exported, you lose. | |||
*/ | |||
- if (wcschr(pathconfig->program_name, SEP)) { | |||
+ if (wcschr(pathconfig->program_name, Py_GetSepW(pathconfig->program_name))) { | |||
if (safe_wcscpy(program_full_path, pathconfig->program_name, | |||
program_full_path_len) < 0) { | |||
return PATHLEN_ERR(); | |||
@@ -821,6 +916,10 @@ | |||
PyMem_RawFree(path); | |||
} | |||
#endif /* __APPLE__ */ | |||
+#ifdef MS_WINDOWS | |||
+ else if(GetWindowsModulePaths(program_full_path)) { | |||
+ } | |||
+#endif /* MS_WINDOWS */ | |||
else if (calculate->path_env) { | |||
wchar_t *path = calculate->path_env; | |||
while (1) { | |||
@@ -861,7 +960,7 @@ | |||
else { | |||
program_full_path[0] = '\0'; | |||
} | |||
- if (program_full_path[0] != SEP && program_full_path[0] != '\0') { | |||
+ if (!is_absolute(program_full_path)) { | |||
status = absolutize(program_full_path, program_full_path_len); | |||
if (_PyStatus_EXCEPTION(status)) { | |||
return status; | |||
@@ -1071,6 +1170,7 @@ | |||
if (_PyStatus_EXCEPTION(status)) { | |||
return status; | |||
} | |||
+ Py_NormalizeSepsW(zip_path); | |||
/* Replace "00" with version */ | |||
size_t bufsz = wcslen(zip_path); | |||
@@ -1098,7 +1198,7 @@ | |||
while (1) { | |||
wchar_t *delim = wcschr(defpath, DELIM); | |||
- if (defpath[0] != SEP) { | |||
+ if (!is_absolute(defpath)) { | |||
/* Paths are relative to prefix */ | |||
bufsz += prefixsz; | |||
} | |||
@@ -1115,6 +1215,11 @@ | |||
bufsz += wcslen(zip_path) + 1; | |||
bufsz += wcslen(exec_prefix) + 1; | |||
+#ifdef MS_WINDOWS | |||
+ if (is_absolute(prefix)) { | |||
+ bufsz += wcslen(prefix) + 1; | |||
+ } | |||
+#endif | |||
/* Allocate the buffer */ | |||
wchar_t *buf = PyMem_RawMalloc(bufsz * sizeof(wchar_t)); | |||
@@ -1140,9 +1245,9 @@ | |||
while (1) { | |||
wchar_t *delim = wcschr(defpath, DELIM); | |||
- if (defpath[0] != SEP) { | |||
+ if (!is_absolute(defpath)) { | |||
wcscat(buf, prefix); | |||
- if (prefixsz >= 2 && prefix[prefixsz - 2] != SEP && | |||
+ if (prefixsz >= 2 && !is_sep(prefix[prefixsz - 2]) && | |||
defpath[0] != (delim ? DELIM : L'\0')) | |||
{ | |||
/* not empty */ | |||
@@ -1163,6 +1268,12 @@ | |||
defpath = delim + 1; | |||
} | |||
wcscat(buf, delimiter); | |||
+#ifdef MS_WINDOWS | |||
+ if (is_absolute(prefix)) { | |||
+ wcscat(buf, prefix); | |||
+ wcscat(buf, delimiter); | |||
+ } | |||
+#endif | |||
/* Finally, on goes the directory for dynamic-load modules */ | |||
wcscat(buf, exec_prefix); | |||
@@ -1188,16 +1299,20 @@ | |||
if (!calculate->pythonpath) { | |||
return DECODE_LOCALE_ERR("PYTHONPATH define", len); | |||
} | |||
+ Py_NormalizeSepsW(calculate->pythonpath); | |||
calculate->prefix = Py_DecodeLocale(PREFIX, &len); | |||
if (!calculate->prefix) { | |||
return DECODE_LOCALE_ERR("PREFIX define", len); | |||
} | |||
+ Py_NormalizeSepsW(calculate->prefix); | |||
calculate->exec_prefix = Py_DecodeLocale(EXEC_PREFIX, &len); | |||
if (!calculate->exec_prefix) { | |||
return DECODE_LOCALE_ERR("EXEC_PREFIX define", len); | |||
} | |||
- calculate->lib_python = Py_DecodeLocale("lib/python" VERSION, &len); | |||
+ Py_NormalizeSepsW(calculate->exec_prefix); | |||
+ 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); | |||
} | |||
@@ -1215,6 +1330,7 @@ | |||
PyMem_RawFree(calculate->pythonpath); | |||
PyMem_RawFree(calculate->prefix); | |||
PyMem_RawFree(calculate->exec_prefix); | |||
+ PyMem_RawFree(calculate->dll_path); | |||
PyMem_RawFree(calculate->lib_python); | |||
PyMem_RawFree(calculate->path_env); | |||
} | |||
@@ -1225,6 +1341,8 @@ | |||
{ | |||
PyStatus status; | |||
+ calculate->dll_path = _Py_GetDLLPath(); | |||
+ | |||
if (pathconfig->program_full_path == NULL) { | |||
status = calculate_program_full_path(calculate, pathconfig); | |||
if (_PyStatus_EXCEPTION(status)) { | |||
@@ -1343,6 +1461,7 @@ | |||
{ | |||
PyStatus status; | |||
PyCalculatePath calculate; | |||
+ separator[0] = Py_GetSepW(NULL); | |||
memset(&calculate, 0, sizeof(calculate)); | |||
status = calculate_init(&calculate, config); | |||
diff -Naur Python-3.8.0-orig/Modules/posixmodule.c Python-3.8.0/Modules/posixmodule.c | |||
--- Python-3.8.0-orig/Modules/posixmodule.c 2019-10-22 10:02:42.087321400 +0300 | |||
+++ Python-3.8.0/Modules/posixmodule.c 2019-10-22 10:02:45.238527000 +0300 | |||
@@ -3691,7 +3691,7 @@ | |||
Py_END_ALLOW_THREADS | |||
/* FindNextFile sets error to ERROR_NO_MORE_FILES if | |||
it got to the end of the directory. */ | |||
- if (!result && GetLastError() != ERROR_NO_MORE_FILES) { | |||
+ if (!result && GetLastError() != 0 && GetLastError() != ERROR_NO_MORE_FILES) { | |||
Py_DECREF(list); | |||
list = path_error(path); | |||
goto exit; | |||
diff -Naur Python-3.8.4-orig/Python/dynload_win.c Python-3.8.4/Python/dynload_win.c | |||
--- Python-3.8.4-orig/Python/dynload_win.c 2019-10-22 10:01:24.710185500 +0300 | |||
+++ Python-3.8.4/Python/dynload_win.c 2019-10-22 10:02:45.644127700 +0300 | |||
@@ -180,7 +180,9 @@ | |||
char funcname[258], *import_python; | |||
const wchar_t *wpathname; | |||
+#if defined(_MSC_VER) | |||
_Py_CheckPython3(); | |||
+#endif | |||
wpathname = _PyUnicode_AsUnicode(pathname); | |||
if (wpathname == NULL) |
@@ -0,0 +1,40 @@ | |||
diff -Naur Python-3.8.0-orig/Modules/getpath.c Python-3.8.0/Modules/getpath.c | |||
--- Python-3.8.0-orig/Modules/getpath.c 2019-10-22 10:02:47.765731400 +0300 | |||
+++ Python-3.8.0/Modules/getpath.c 2019-10-22 10:02:49.637734700 +0300 | |||
@@ -1393,6 +1393,36 @@ | |||
return status; | |||
} | |||
+#ifdef MS_WINDOWS | |||
+ if (calculate->path_env) { | |||
+ wchar_t *module_path, *norm_path; | |||
+ // Add path of executable/dll to system path. This | |||
+ // is so that the correct tcl??.dll and tk??.dll get used. | |||
+ module_path = calculate->dll_path[0] ? calculate->dll_path : pathconfig->program_full_path; | |||
+ norm_path = (wchar_t *)alloca(sizeof(wchar_t) * (wcslen(module_path) + 1)); | |||
+ if (norm_path) { | |||
+ wchar_t *slashes, *end, *new_path; | |||
+ wcscpy(norm_path, module_path); | |||
+ slashes = wcschr(norm_path, L'/'); | |||
+ while (slashes) { | |||
+ *slashes = L'\\'; | |||
+ slashes = wcschr(slashes + 1, L'/'); | |||
+ } | |||
+ end = wcsrchr(norm_path, L'\\') ? wcsrchr(norm_path, L'\\') : norm_path + wcslen(norm_path); | |||
+ end[1] = L'\0'; | |||
+ | |||
+ new_path = (wchar_t *)alloca(sizeof(wchar_t) * (wcslen(L"PATH=") + wcslen(calculate->path_env) + 1 + wcslen(norm_path) + 1)); | |||
+ if (new_path) { | |||
+ wcscpy(new_path, L"PATH="); | |||
+ wcscat(new_path, calculate->path_env); | |||
+ wcscat(new_path, L";"); | |||
+ wcscat(new_path, norm_path); | |||
+ _wputenv(new_path); | |||
+ } | |||
+ } | |||
+ } | |||
+#endif | |||
+ | |||
if ((!calculate->prefix_found || !calculate->exec_prefix_found) && | |||
calculate->warnings) | |||
{ |
@@ -0,0 +1,9 @@ | |||
diff -Naur Python-3.8.0-orig/Modules/Setup.config.in Python-3.8.0/Modules/Setup.config.in | |||
--- Python-3.8.0-orig/Modules/Setup.config.in 2019-10-22 10:01:08.018156200 +0300 | |||
+++ Python-3.8.0/Modules/Setup.config.in 2019-10-22 10:02:53.303741100 +0300 | |||
@@ -11,4 +11,5 @@ | |||
# build-in modules for windows platform: | |||
@USE_WIN32_MODULE@winreg ../PC/winreg.c | |||
+@USE_WIN32_MODULE@msvcrt -DPy_BUILD_CORE ../PC/msvcrtmodule.c | |||
@@ -0,0 +1,104 @@ | |||
diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac | |||
--- Python-3.8.0-orig/configure.ac 2019-10-22 10:02:29.123698700 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-22 10:02:56.595346900 +0300 | |||
@@ -598,6 +598,65 @@ | |||
AC_DEFINE(_INCLUDE__STDC_A1_SOURCE, 1, Define to include mbstate_t for mbrtowc) | |||
fi | |||
+# On 'semi-native' build systems (MSYS*/Cygwin targeting MinGW-w64) | |||
+# _sysconfigdata.py will contain paths that are correct only in the | |||
+# build environment. This means external modules will fail to build | |||
+# without setting up the same env and also that the build of Python | |||
+# itself will fail as the paths are not correct for the host tools. | |||
+# | |||
+# Also, getpath.c uses GetModuleFileNameW (replacing \ with /) and | |||
+# compares that with the define VPATH (passed in via command-line) | |||
+# to determine whether it's the build- or the installed-Python. | |||
+# | |||
+# To work around these issues a set of _b2h variables are created: | |||
+# VPATH_b2h, prefix_b2h, srcdir_b2h, abs_srcdir_b2h | |||
+# and abs_builddir_b2h | |||
+# .. where b2h stands for build to host. sysconfig.py replaces path | |||
+# prefixes matching the non-b2h versions with the b2h equivalents. | |||
+# | |||
+# (note this assumes the host compilers are native and *not* cross | |||
+# - in the 'semi-native' scenario only that is.) | |||
+ | |||
+AC_DEFUN([ABS_PATH_HOST], | |||
+[$1=$(cd $$2 && pwd) | |||
+ case $build_os in | |||
+ mingw*) | |||
+ case $host_os in | |||
+ mingw*) $1=$(cd $$2 && pwd -W) ;; | |||
+ *) ;; | |||
+ esac | |||
+ ;; | |||
+ cygwin*) | |||
+ case $host_os in | |||
+ mingw*) $1=$(cygpath -w -m $$2) ;; | |||
+ *) ;; | |||
+ esac | |||
+ ;; | |||
+ esac | |||
+AC_SUBST([$1]) | |||
+]) | |||
+ | |||
+AC_MSG_CHECKING(absolute host location of VPATH) | |||
+ABS_PATH_HOST([VPATH_b2h],[srcdir]) | |||
+AC_MSG_RESULT([$VPATH_b2h]) | |||
+ | |||
+AC_MSG_CHECKING(absolute host location of prefix) | |||
+ABS_PATH_HOST([prefix_b2h],[prefix]) | |||
+AC_MSG_RESULT([$prefix_b2h]) | |||
+ | |||
+AC_MSG_CHECKING(absolute host location of srcdir) | |||
+ABS_PATH_HOST([srcdir_b2h],[srcdir]) | |||
+AC_MSG_RESULT([$srcdir_b2h]) | |||
+ | |||
+AC_MSG_CHECKING(absolute host location of abs_srcdir) | |||
+ABS_PATH_HOST([abs_srcdir_b2h],[srcdir]) | |||
+AC_MSG_RESULT([$abs_srcdir_b2h]) | |||
+ | |||
+my_builddir=. | |||
+AC_MSG_CHECKING(Absolute host location of abs_builddir) | |||
+ABS_PATH_HOST([abs_builddir_b2h],[my_builddir]) | |||
+AC_MSG_RESULT([$abs_builddir_b2h]) | |||
+ | |||
AC_MSG_CHECKING([for init system calls]) | |||
AC_SUBST(INITSYS) | |||
case $host in | |||
diff -Naur Python-3.8.0-orig/Lib/sysconfig.py Python-3.8.0/Lib/sysconfig.py | |||
--- Python-3.8.0-orig/Lib/sysconfig.py 2019-10-22 10:02:09.342863900 +0300 | |||
+++ Python-3.8.0/Lib/sysconfig.py 2019-10-22 10:02:57.000947600 +0300 | |||
@@ -329,6 +329,14 @@ | |||
if isinstance(v, str): | |||
done[k] = v.strip() | |||
+ # any keys that have one with the same name suffixed with _b2h | |||
+ # need to be replaced with the value of the _b2h key. | |||
+ # This converts from MSYS*/Cygwin paths to Windows paths. | |||
+ for k, v in dict(done).items(): | |||
+ if isinstance(k, str): | |||
+ if k.endswith("_b2h"): | |||
+ done[k[:-4]]=v | |||
+ | |||
# save the results in the global dictionary | |||
vars.update(done) | |||
return vars | |||
diff -Naur Python-3.8.0-orig/Makefile.pre.in Python-3.8.0/Makefile.pre.in | |||
--- Python-3.8.0-orig/Makefile.pre.in 2019-10-22 10:01:28.376191900 +0300 | |||
+++ Python-3.8.0/Makefile.pre.in 2019-10-22 10:02:57.390948300 +0300 | |||
@@ -137,6 +137,13 @@ | |||
# Install prefix for data files | |||
datarootdir= @datarootdir@ | |||
+# Locations needed for semi-native fixup of sysconfig. | |||
+srcdir_b2h= @srcdir_b2h@ | |||
+VPATH_b2h= @VPATH_b2h@ | |||
+abs_srcdir_b2h= @abs_srcdir_b2h@ | |||
+abs_builddir_b2h= @abs_builddir_b2h@ | |||
+prefix_b2h= @prefix_b2h@ | |||
+ | |||
# Expanded directories | |||
BINDIR= @bindir@ | |||
LIBDIR= @libdir@ |
@@ -0,0 +1,64 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/command/build_ext.py Python-3.8.0/Lib/distutils/command/build_ext.py | |||
--- Python-3.8.0-orig/Lib/distutils/command/build_ext.py 2019-10-22 10:01:56.348041100 +0300 | |||
+++ Python-3.8.0/Lib/distutils/command/build_ext.py 2019-10-22 10:03:01.072554800 +0300 | |||
@@ -221,9 +221,10 @@ | |||
if sys.platform[:6] == 'cygwin': | |||
if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")): | |||
# building third party extensions | |||
+ config_dir_name = os.path.basename(sysconfig.get_config_var('LIBPL')) | |||
self.library_dirs.append(os.path.join(sys.prefix, "lib", | |||
"python" + get_python_version(), | |||
- "config")) | |||
+ config_dir_name)) | |||
else: | |||
# building python standard extensions | |||
self.library_dirs.append('.') | |||
diff -Naur Python-3.8.0-orig/Lib/sysconfig.py Python-3.8.0/Lib/sysconfig.py | |||
--- Python-3.8.0-orig/Lib/sysconfig.py 2019-10-22 10:02:59.528152100 +0300 | |||
+++ Python-3.8.0/Lib/sysconfig.py 2019-10-22 10:03:01.462555500 +0300 | |||
@@ -43,23 +43,23 @@ | |||
'data': '{base}', | |||
}, | |||
'nt': { | |||
- 'stdlib': '{installed_base}/Lib', | |||
- 'platstdlib': '{base}/Lib', | |||
- 'purelib': '{base}/Lib/site-packages', | |||
- 'platlib': '{base}/Lib/site-packages', | |||
- 'include': '{installed_base}/Include', | |||
- 'platinclude': '{installed_base}/Include', | |||
- 'scripts': '{base}/Scripts', | |||
+ 'stdlib': '{installed_base}/lib/python{py_version_short}', | |||
+ 'platstdlib': '{base}/lib/python{py_version_short}', | |||
+ 'purelib': '{base}/lib/python{py_version_short}', | |||
+ 'platlib': '{base}/lib/python{py_version_short}', | |||
+ 'include': '{installed_base}/include/python{py_version_short}', | |||
+ 'platinclude': '{installed_base}/include/python{py_version_short}', | |||
+ 'scripts': '{base}/bin', | |||
'data': '{base}', | |||
}, | |||
# NOTE: When modifying "purelib" scheme, update site._get_path() too. | |||
'nt_user': { | |||
- 'stdlib': '{userbase}/Python{py_version_nodot}', | |||
- 'platstdlib': '{userbase}/Python{py_version_nodot}', | |||
- 'purelib': '{userbase}/Python{py_version_nodot}/site-packages', | |||
- 'platlib': '{userbase}/Python{py_version_nodot}/site-packages', | |||
- 'include': '{userbase}/Python{py_version_nodot}/Include', | |||
- 'scripts': '{userbase}/Python{py_version_nodot}/Scripts', | |||
+ 'stdlib': '{userbase}/lib/python{py_version_short}', | |||
+ 'platstdlib': '{userbase}/lib/python{py_version_short}', | |||
+ 'purelib': '{userbase}/lib/python{py_version_short}/site-packages', | |||
+ 'platlib': '{userbase}/lib/python{py_version_short}/site-packages', | |||
+ 'include': '{userbase}/include/python{py_version_short}', | |||
+ 'scripts': '{userbase}/bin', | |||
'data': '{userbase}', | |||
}, | |||
'posix_user': { | |||
@@ -461,7 +461,7 @@ | |||
vars['INCLUDEPY'] = get_path('include') | |||
vars['EXT_SUFFIX'] = '.pyd' | |||
vars['EXE'] = '.exe' | |||
- vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT | |||
+ vars['VERSION'] = _PY_VERSION_SHORT | |||
vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable)) | |||
# |
@@ -0,0 +1,61 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/cygwinccompiler.py Python-3.8.0/Lib/distutils/cygwinccompiler.py | |||
--- Python-3.8.0-orig/Lib/distutils/cygwinccompiler.py 2019-10-22 10:02:17.798078800 +0300 | |||
+++ Python-3.8.0/Lib/distutils/cygwinccompiler.py 2019-10-22 10:03:04.738561200 +0300 | |||
@@ -58,6 +58,7 @@ | |||
from distutils import log | |||
from distutils.version import LooseVersion | |||
from distutils.spawn import find_executable | |||
+from subprocess import Popen, PIPE, check_output | |||
def get_msvcr(): | |||
"""Include the appropriate MSVC runtime library if Python was built | |||
@@ -373,7 +374,7 @@ | |||
return (CONFIG_H_UNCERTAIN, | |||
"couldn't read '%s': %s" % (fn, exc.strerror)) | |||
-RE_VERSION = re.compile(br'(\d+\.\d+(\.\d+)*)') | |||
+RE_VERSION = re.compile(br'[\D\s]*(\d+\.\d+(\.\d+)*)[\D\s]*$') | |||
def _find_exe_version(cmd): | |||
"""Find the version of an executable by running `cmd` in the shell. | |||
@@ -402,7 +403,16 @@ | |||
If not possible it returns None for it. | |||
""" | |||
- commands = ['gcc -dumpversion', 'ld -v', 'dllwrap --version'] | |||
+ gcc = os.environ.get('CC') or 'gcc' | |||
+ ld = 'ld' | |||
+ out = Popen(gcc+' --print-prog-name ld', shell=True, stdout=PIPE).stdout | |||
+ try: | |||
+ ld = test=str(out.read(),encoding='utf-8').strip() | |||
+ finally: | |||
+ out.close() | |||
+ dllwrap = os.environ.get('DLLWRAP') or 'dllwrap' | |||
+ # MinGW64 doesn't have i686-w64-mingw32-ld, so instead we ask gcc. | |||
+ commands = [gcc+' -dumpversion', ld+' -v', dllwrap+' --version'] | |||
return tuple([_find_exe_version(cmd) for cmd in commands]) | |||
def is_cygwingcc(): | |||
diff -Naur Python-3.8.0-orig/Modules/Setup.config.in Python-3.8.0/Modules/Setup.config.in | |||
--- Python-3.8.0-orig/Modules/Setup.config.in 2019-10-22 10:02:55.456544900 +0300 | |||
+++ Python-3.8.0/Modules/Setup.config.in 2019-10-22 10:03:05.159762000 +0300 | |||
@@ -12,4 +12,5 @@ | |||
# build-in modules for windows platform: | |||
@USE_WIN32_MODULE@winreg ../PC/winreg.c | |||
@USE_WIN32_MODULE@msvcrt -DPy_BUILD_CORE ../PC/msvcrtmodule.c | |||
+@USE_WIN32_MODULE@_winapi _winapi.c | |||
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py | |||
--- Python-3.8.0-orig/setup.py 2019-10-22 10:02:35.597710000 +0300 | |||
+++ Python-3.8.0/setup.py 2019-10-22 10:03:05.939763300 +0300 | |||
@@ -1545,7 +1545,9 @@ | |||
self.add(Extension('msvcrt', [os.path.join(pc_srcdir, p) | |||
for p in ['msvcrtmodule.c']])) | |||
- self.add(Extension('_winapi', ['_winapi.c'])) | |||
+ # Added to Setup.config.in as now needed earlier since I | |||
+ # use subprocess (which uses Popen) in cygwinccompiler.py | |||
+ # self.add(Extension('_winapi', ['_winapi.c'])) | |||
self.add(Extension('_msi', [os.path.join(pc_srcdir, p) | |||
for p in ['_msi.c']], |
@@ -0,0 +1,12 @@ | |||
diff -Naur Python-3.8.0-orig/Include/pyport.h Python-3.8.0/Include/pyport.h | |||
--- Python-3.8.0-orig/Include/pyport.h 2019-10-22 10:01:16.988171900 +0300 | |||
+++ Python-3.8.0/Include/pyport.h 2019-10-22 10:03:09.574569700 +0300 | |||
@@ -177,6 +177,8 @@ | |||
# define PY_FORMAT_SIZE_T "l" | |||
# elif defined(MS_WINDOWS) | |||
# define PY_FORMAT_SIZE_T "I" | |||
+# elif defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO) | |||
+# define PY_FORMAT_SIZE_T "z" | |||
# else | |||
# error "This platform's pyconfig.h needs to define PY_FORMAT_SIZE_T" | |||
# endif |
@@ -0,0 +1,15 @@ | |||
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py | |||
--- Python-3.8.0-orig/setup.py 2019-10-22 10:03:08.498167800 +0300 | |||
+++ Python-3.8.0/setup.py 2019-10-22 10:03:12.382574600 +0300 | |||
@@ -654,10 +654,10 @@ | |||
if not CROSS_COMPILING: | |||
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') | |||
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | |||
+ self.add_multiarch_paths() | |||
# only change this for cross builds for 3.3, issues on Mageia | |||
if CROSS_COMPILING: | |||
self.add_cross_compiling_paths() | |||
- self.add_multiarch_paths() | |||
self.add_ldflags_cppflags() | |||
def init_inc_lib_dirs(self): |
@@ -0,0 +1,12 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/compileall.py Python-3.8.0/Lib/compileall.py | |||
--- Python-3.8.0-orig/Lib/compileall.py 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Lib/compileall.py 2019-10-22 10:03:15.206179600 +0300 | |||
@@ -36,6 +36,8 @@ | |||
if name == '__pycache__': | |||
continue | |||
fullname = os.path.join(dir, name) | |||
+ if sys.platform == "win32" and sys.version.find("GCC") >= 0: | |||
+ fullname = fullname.replace('\\','/') | |||
if ddir is not None: | |||
dfile = os.path.join(ddir, name) | |||
else: |
@@ -0,0 +1,93 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/command/install.py Python-3.8.0/Lib/distutils/command/install.py | |||
--- Python-3.8.0-orig/Lib/distutils/command/install.py 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Lib/distutils/command/install.py 2019-10-22 10:03:18.045384600 +0300 | |||
@@ -341,7 +341,8 @@ | |||
# Convert directories from Unix /-separated syntax to the local | |||
# convention. | |||
- self.convert_paths('lib', 'purelib', 'platlib', | |||
+ self.convert_paths('base', 'platbase', | |||
+ 'lib', 'purelib', 'platlib', | |||
'scripts', 'data', 'headers', | |||
'userbase', 'usersite') | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/util.py Python-3.8.0/Lib/distutils/util.py | |||
--- Python-3.8.0-orig/Lib/distutils/util.py 2019-10-22 10:01:56.753641800 +0300 | |||
+++ Python-3.8.0/Lib/distutils/util.py 2019-10-22 10:03:18.450985300 +0300 | |||
@@ -130,6 +130,13 @@ | |||
paths.remove('.') | |||
if not paths: | |||
return os.curdir | |||
+ # On Windows, if paths is ['C:','folder','subfolder'] then | |||
+ # os.path.join(*paths) will return 'C:folder\subfolder' which | |||
+ # is thus relative to the CWD on that drive. So we work around | |||
+ # this by adding a \ to path[0] | |||
+ if (len(paths) > 0 and paths[0].endswith(':') and | |||
+ sys.platform == "win32" and sys.version.find("GCC") >= 0): | |||
+ paths[0] += '\\' | |||
return os.path.join(*paths) | |||
# convert_path () | |||
@@ -140,6 +147,10 @@ | |||
relative, this is equivalent to "os.path.join(new_root,pathname)". | |||
Otherwise, it requires making 'pathname' relative and then joining the | |||
two, which is tricky on DOS/Windows and Mac OS. | |||
+ | |||
+ If on Windows or OS/2 and both new_root and pathname are on different | |||
+ drives, raises DistutilsChangeRootError as this is nonsensical, | |||
+ otherwise use drive which can be in either of new_root or pathname. | |||
""" | |||
if os.name == 'posix': | |||
if not os.path.isabs(pathname): | |||
@@ -149,9 +160,20 @@ | |||
elif os.name == 'nt': | |||
(drive, path) = os.path.splitdrive(pathname) | |||
- if path[0] == '\\': | |||
+ if path[0] == os.sep: | |||
path = path[1:] | |||
- return os.path.join(new_root, path) | |||
+ (drive_r, path_r) = os.path.splitdrive(new_root) | |||
+ if path_r and path_r[0] == os.sep: | |||
+ path_r = path_r[1:] | |||
+ drive_used = '' | |||
+ if len(drive) == 2 and len(drive_r) == 2 and drive != drive_r: | |||
+ raise DistutilsChangeRootError("root and pathname not on same drive (%s, %s)" | |||
+ % (drive_r,drive)) | |||
+ elif len(drive_r) == 2: | |||
+ drive_used = drive_r+os.sep | |||
+ elif len(drive) == 2: | |||
+ drive_used = drive+os.sep | |||
+ return os.path.join(drive_used+path_r, path) | |||
else: | |||
raise DistutilsPlatformError("nothing known about platform '%s'" % os.name) | |||
diff -Naur Python-3.8.0-orig/Makefile.pre.in Python-3.8.0/Makefile.pre.in | |||
--- Python-3.8.0-orig/Makefile.pre.in 2019-10-22 10:02:59.949352800 +0300 | |||
+++ Python-3.8.0/Makefile.pre.in 2019-10-22 10:03:18.840986000 +0300 | |||
@@ -1612,6 +1612,12 @@ | |||
else true; \ | |||
fi | |||
+ifeq (Msys,Msys) | |||
+DESTDIRFINAL=$(DESTDIR) | |||
+else | |||
+DESTDIRFINAL=$(DESTDIR)/ | |||
+endif | |||
+ | |||
# Install the dynamically loadable modules | |||
# This goes into $(exec_prefix) | |||
sharedinstall: sharedmods | |||
@@ -1619,9 +1625,9 @@ | |||
--prefix=$(prefix) \ | |||
--install-scripts=$(BINDIR) \ | |||
--install-platlib=$(DESTSHARED) \ | |||
- --root=$(DESTDIR)/ | |||
- -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py | |||
- -rm -r $(DESTDIR)$(DESTSHARED)/__pycache__ | |||
+ --root=$(DESTDIRFINAL) | |||
+ -rm $(DESTDIRFINAL)$(DESTSHARED)/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py | |||
+ -rm -r $(DESTDIRFINAL)$(DESTSHARED)/__pycache__ | |||
# Here are a couple of targets for MacOSX again, to install a full | |||
# framework-based Python. frameworkinstall installs everything, the |
@@ -0,0 +1,69 @@ | |||
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py | |||
--- Python-3.8.0-orig/setup.py 2019-10-22 10:03:14.129777700 +0300 | |||
+++ Python-3.8.0/setup.py 2019-10-22 10:03:22.475792400 +0300 | |||
@@ -703,7 +703,7 @@ | |||
if HOST_PLATFORM == 'hp-ux11': | |||
self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32'] | |||
- if MACOS: | |||
+ if MACOS or MS_WINDOWS: | |||
# This should work on any unixy platform ;-) | |||
# If the user has bothered specifying additional -I and -L flags | |||
# in OPT and LDFLAGS we might as well use them here. | |||
@@ -713,6 +713,8 @@ | |||
# directories with whitespace in the name to store libraries. | |||
cflags, ldflags = sysconfig.get_config_vars( | |||
'CFLAGS', 'LDFLAGS') | |||
+ cflags = cflags + ' ' + ('',os.environ.get('CC'))[os.environ.get('CC') != None] | |||
+ ldflags = ldflags + ' ' + ('',os.environ.get('LDSHARED'))[os.environ.get('LDSHARED') != None] | |||
for item in cflags.split(): | |||
if item.startswith('-I'): | |||
self.inc_dirs.append(item[2:]) | |||
@@ -1907,14 +1909,19 @@ | |||
# The versions with dots are used on Unix, and the versions without | |||
# dots on Windows, for detection by cygwin. | |||
tcllib = tklib = tcl_includes = tk_includes = None | |||
- for version in ['8.6', '86', '8.5', '85', '8.4', '84', '8.3', '83', | |||
- '8.2', '82', '8.1', '81', '8.0', '80']: | |||
- tklib = self.compiler.find_library_file(self.lib_dirs, | |||
- 'tk' + version) | |||
- tcllib = self.compiler.find_library_file(self.lib_dirs, | |||
- 'tcl' + version) | |||
- if tklib and tcllib: | |||
- # Exit the loop when we've found the Tcl/Tk libraries | |||
+ tcltk_suffix = None | |||
+ for suffix in ['', 's']: | |||
+ for version in ['8.6', '86', '8.5', '85', '8.4', '84', '8.3', '83', | |||
+ '8.2', '82', '8.1', '81', '8.0', '80', '']: | |||
+ tklib = self.compiler.find_library_file(self.lib_dirs, | |||
+ 'tk' + version + suffix) | |||
+ tcllib = self.compiler.find_library_file(self.lib_dirs, | |||
+ 'tcl' + version + suffix) | |||
+ if tklib and tcllib: | |||
+ # Exit the loop when we've found the Tcl/Tk libraries | |||
+ tcltk_suffix = suffix | |||
+ break | |||
+ if tcltk_suffix != None: | |||
break | |||
# Now check for the header files | |||
@@ -1985,10 +1992,18 @@ | |||
# Add the Tcl/Tk libraries | |||
libs.append('tk'+ version) | |||
libs.append('tcl'+ version) | |||
+ libs.append('tk'+ version + tcltk_suffix) | |||
+ libs.append('tcl'+ version + tcltk_suffix) | |||
+ if MS_WINDOWS: | |||
+ for winlib in ['ws2_32','gdi32','comctl32','comdlg32','imm32','uuid','oleaut32','ole32']: | |||
+ libs.append( winlib ) | |||
# Finally, link with the X11 libraries (not appropriate on cygwin) | |||
- if not CYGWIN: | |||
+ # ...on those platforms, define STATIC_BUILD if linking to static tcl/tk. | |||
+ if not CYGWIN and not MS_WINDOWS: | |||
libs.append('X11') | |||
+ elif tcllib.endswith('s.a'): | |||
+ defs.append( ('STATIC_BUILD',1) ) | |||
# XXX handle these, but how to detect? | |||
# *** Uncomment and edit for PIL (TkImaging) extension only: |
@@ -0,0 +1,17 @@ | |||
diff -Naur Python-3.8.0-orig/Include/py_curses.h Python-3.8.0/Include/py_curses.h | |||
--- Python-3.8.0-orig/Include/py_curses.h 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Include/py_curses.h 2019-10-22 10:03:25.689398000 +0300 | |||
@@ -36,6 +36,13 @@ | |||
#include <curses.h> | |||
#endif | |||
+#if defined(__MINGW32__) | |||
+#include <windows.h> | |||
+#if !defined(_ISPAD) | |||
+#define _ISPAD 0x10 | |||
+#endif | |||
+#endif | |||
+ | |||
#ifdef HAVE_NCURSES_H | |||
/* configure was checking <curses.h>, but we will | |||
use <ncurses.h>, which has some or all these features. */ |
@@ -0,0 +1,25 @@ | |||
diff -Naur Python-3.8.0-orig/Python/graminit.c Python-3.8.0/Python/graminit.c | |||
--- Python-3.8.0-orig/Python/graminit.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Python/graminit.c 2019-10-22 10:03:28.497403000 +0300 | |||
@@ -1,7 +1,8 @@ | |||
/* Generated by Parser/pgen */ | |||
#include "grammar.h" | |||
-grammar _PyParser_Grammar; | |||
+#include "pyport.h" | |||
+PyAPI_DATA(grammar) _PyParser_Grammar; | |||
static const arc arcs_0_0[3] = { | |||
{2, 1}, | |||
{3, 2}, | |||
diff -Naur Python-3.8.0-orig/Modules/parsermodule.c Python-3.8.0/Modules/parsermodule.c | |||
--- Python-3.8.0-orig/Modules/parsermodule.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Modules/parsermodule.c 2019-10-22 10:03:28.497403000 +0300 | |||
@@ -38,7 +38,7 @@ | |||
#include "grammar.h" | |||
#include "parsetok.h" | |||
-extern grammar _PyParser_Grammar; /* From graminit.c */ | |||
+PyAPI_DATA(grammar) _PyParser_Grammar; /* From graminit.c */ | |||
#ifdef lint | |||
#include <note.h> |
@@ -0,0 +1,49 @@ | |||
diff -Naur Python-3.8.0-orig/Makefile.pre.in Python-3.8.0/Makefile.pre.in | |||
--- Python-3.8.0-orig/Makefile.pre.in 2019-10-22 10:03:21.368190400 +0300 | |||
+++ Python-3.8.0/Makefile.pre.in 2019-10-22 10:03:31.336607900 +0300 | |||
@@ -710,20 +710,20 @@ | |||
Programs/_freeze_importlib.o: Programs/_freeze_importlib.c Makefile | |||
-Programs/_freeze_importlib: Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) | |||
+Programs/_freeze_importlib$(EXE): Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) | |||
$(LINKCC) $(PY_CORE_LDFLAGS) -o $@ Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS) | |||
.PHONY: regen-importlib | |||
-regen-importlib: Programs/_freeze_importlib | |||
+regen-importlib: Programs/_freeze_importlib$(EXE) | |||
# Regenerate Python/importlib_external.h | |||
# from Lib/importlib/_bootstrap_external.py using _freeze_importlib | |||
- ./Programs/_freeze_importlib importlib._bootstrap_external \ | |||
+ ./Programs/_freeze_importlib$(EXE) importlib._bootstrap_external \ | |||
$(srcdir)/Lib/importlib/_bootstrap_external.py \ | |||
$(srcdir)/Python/importlib_external.h.new | |||
$(UPDATE_FILE) $(srcdir)/Python/importlib_external.h $(srcdir)/Python/importlib_external.h.new | |||
# Regenerate Python/importlib.h from Lib/importlib/_bootstrap.py | |||
# using _freeze_importlib | |||
- ./Programs/_freeze_importlib importlib._bootstrap \ | |||
+ ./Programs/_freeze_importlib$(EXE) importlib._bootstrap \ | |||
$(srcdir)/Lib/importlib/_bootstrap.py \ | |||
$(srcdir)/Python/importlib.h.new | |||
$(UPDATE_FILE) $(srcdir)/Python/importlib.h $(srcdir)/Python/importlib.h.new | |||
@@ -1781,7 +1781,7 @@ | |||
find build -name '*.py[co]' -exec rm -f {} ';' || true | |||
-rm -f pybuilddir.txt | |||
-rm -f Lib/lib2to3/*Grammar*.pickle | |||
- -rm -f Programs/_testembed Programs/_freeze_importlib | |||
+ -rm -f Programs/_testembed Programs/_freeze_importlib$(EXE) | |||
-find build -type f -a ! -name '*.gc??' -exec rm -f {} ';' | |||
-rm -f Include/pydtrace_probes.h | |||
-rm -f profile-gen-stamp | |||
diff -Naur Python-3.8.0-orig/Programs/_freeze_importlib.c Python-3.8.0/Programs/_freeze_importlib.c | |||
--- Python-3.8.0-orig/Programs/_freeze_importlib.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Programs/_freeze_importlib.c 2019-10-22 10:03:31.757808700 +0300 | |||
@@ -20,7 +20,7 @@ | |||
{0, 0, 0} /* sentinel */ | |||
}; | |||
-#ifndef MS_WINDOWS | |||
+#ifndef _MSC_VER | |||
/* On Windows, this links with the regular pythonXY.dll, so this variable comes | |||
from frozen.obj. In the Makefile, frozen.o is not linked into this executable, | |||
so we define the variable here. */ |
@@ -0,0 +1,21 @@ | |||
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py | |||
--- Python-3.8.0-orig/setup.py 2019-10-22 10:03:24.597396100 +0300 | |||
+++ Python-3.8.0/setup.py 2019-10-22 10:03:35.002614400 +0300 | |||
@@ -38,6 +38,17 @@ | |||
return sys.platform | |||
+# On MSYS, os.system needs to be wrapped with sh.exe | |||
+# as otherwise all the io redirection will fail. | |||
+# Arguably, this could happen inside the real os.system | |||
+# rather than this monkey patch. | |||
+if sys.platform == "win32" and "MSYSTEM" in os.environ: | |||
+ os_system = os.system | |||
+ def msys_system(command): | |||
+ command_in_sh = 'sh.exe -c "%s"' % command.replace("\\", "\\\\") | |||
+ return os_system(command_in_sh) | |||
+ os.system = msys_system | |||
+ | |||
CROSS_COMPILING = ("_PYTHON_HOST_PLATFORM" in os.environ) | |||
HOST_PLATFORM = get_platform() | |||
MS_WINDOWS = (HOST_PLATFORM == 'win32') |
@@ -0,0 +1,59 @@ | |||
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py | |||
--- Python-3.8.0-orig/setup.py 2019-10-22 10:03:36.718617400 +0300 | |||
+++ Python-3.8.0/setup.py 2019-10-22 10:03:37.795019300 +0300 | |||
@@ -563,7 +563,7 @@ | |||
# Debian/Ubuntu multiarch support. | |||
# https://wiki.ubuntu.com/MultiarchSpec | |||
cc = sysconfig.get_config_var('CC') | |||
- tmpfile = os.path.join(self.build_temp, 'multiarch') | |||
+ tmpfile = os.path.join(self.build_temp, 'multiarch').replace('\\','/') | |||
if not os.path.exists(self.build_temp): | |||
os.makedirs(self.build_temp) | |||
ret = os.system( | |||
@@ -588,7 +588,7 @@ | |||
opt = '' | |||
if CROSS_COMPILING: | |||
opt = '-t' + sysconfig.get_config_var('HOST_GNU_TYPE') | |||
- tmpfile = os.path.join(self.build_temp, 'multiarch') | |||
+ tmpfile = os.path.join(self.build_temp, 'multiarch').replace('\\','/') | |||
if not os.path.exists(self.build_temp): | |||
os.makedirs(self.build_temp) | |||
ret = os.system( | |||
@@ -607,7 +607,7 @@ | |||
def add_cross_compiling_paths(self): | |||
cc = sysconfig.get_config_var('CC') | |||
- tmpfile = os.path.join(self.build_temp, 'ccpaths') | |||
+ tmpfile = os.path.join(self.build_temp, 'ccpaths').replace('\\','/') | |||
if not os.path.exists(self.build_temp): | |||
os.makedirs(self.build_temp) | |||
ret = os.system('%s -E -v - </dev/null 2>%s 1>/dev/null' % (cc, tmpfile)) | |||
@@ -915,7 +915,7 @@ | |||
readline_termcap_library = "" | |||
curses_library = "" | |||
# Cannot use os.popen here in py3k. | |||
- tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib') | |||
+ tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib').replace('\\','/') | |||
if not os.path.exists(self.build_temp): | |||
os.makedirs(self.build_temp) | |||
# Determine if readline is already linked against curses or tinfo. | |||
@@ -1869,16 +1869,16 @@ | |||
cflags = sysconfig.get_config_vars('CFLAGS')[0] | |||
archs = re.findall(r'-arch\s+(\w+)', cflags) | |||
- tmpfile = os.path.join(self.build_temp, 'tk.arch') | |||
+ tmpfile = os.path.join(self.build_temp, 'tk.arch').replace('\\','/') | |||
if not os.path.exists(self.build_temp): | |||
os.makedirs(self.build_temp) | |||
# Note: cannot use os.popen or subprocess here, that | |||
# requires extensions that are not available here. | |||
if is_macosx_sdk_path(F): | |||
- os.system("file %s/Tk.framework/Tk | grep 'for architecture' > %s"%(os.path.join(sysroot, F[1:]), tmpfile)) | |||
+ os.system("file %s/Tk.framework/Tk | grep 'for architecture' > %s"%(os.path.join(sysroot, F[1:]).replace('\\','/'), tmpfile)) | |||
else: | |||
- os.system("file %s/Tk.framework/Tk | grep 'for architecture' > %s"%(F, tmpfile)) | |||
+ os.system("file %s/Tk.framework/Tk | grep 'for architecture' > %s"%(F.replace('\\','/'), tmpfile)) | |||
with open(tmpfile) as fp: | |||
detected_archs = [] |
@@ -0,0 +1,29 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/command/install.py Python-3.8.0/Lib/distutils/command/install.py | |||
--- Python-3.8.0-orig/Lib/distutils/command/install.py 2019-10-22 10:03:20.572589000 +0300 | |||
+++ Python-3.8.0/Lib/distutils/command/install.py 2019-10-22 10:03:40.618624200 +0300 | |||
@@ -20,10 +20,10 @@ | |||
HAS_USER_SITE = True | |||
WINDOWS_SCHEME = { | |||
- 'purelib': '$base/Lib/site-packages', | |||
- 'platlib': '$base/Lib/site-packages', | |||
- 'headers': '$base/Include/$dist_name', | |||
- 'scripts': '$base/Scripts', | |||
+ 'purelib': '$base/lib/python$py_version_short/site-packages', | |||
+ 'platlib': '$base/lib/python$py_version_short/site-packages', | |||
+ 'headers': '$base/include/python$py_version_short$abiflags/$dist_name', | |||
+ 'scripts': '$base/bin', | |||
'data' : '$base', | |||
} | |||
@@ -50,8 +50,8 @@ | |||
INSTALL_SCHEMES['nt_user'] = { | |||
'purelib': '$usersite', | |||
'platlib': '$usersite', | |||
- 'headers': '$userbase/Python$py_version_nodot/Include/$dist_name', | |||
- 'scripts': '$userbase/Python$py_version_nodot/Scripts', | |||
+ 'headers': '$userbase/include/python$py_version_short$abiflags/$dist_name', | |||
+ 'scripts': '$userbase/bin', | |||
'data' : '$userbase', | |||
} | |||
@@ -0,0 +1,11 @@ | |||
diff -Naur Python-3.8.0-orig/Include/osdefs.h Python-3.8.0/Include/osdefs.h | |||
--- Python-3.8.0-orig/Include/osdefs.h 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Include/osdefs.h 2019-10-22 10:03:43.426629200 +0300 | |||
@@ -10,7 +10,6 @@ | |||
#ifdef MS_WINDOWS | |||
#define SEP L'\\' | |||
#define ALTSEP L'/' | |||
-#define MAXPATHLEN 256 | |||
#define DELIM L';' | |||
#endif | |||
@@ -0,0 +1,40 @@ | |||
diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac | |||
--- Python-3.8.0-orig/configure.ac 2019-10-22 10:02:59.122551400 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-22 10:03:46.312634200 +0300 | |||
@@ -3071,10 +3071,19 @@ | |||
fi | |||
# check if we need libintl for locale functions | |||
+case $host in | |||
+ *) | |||
+ dnl Native windows build don't use libintl (see _localemodule.c). | |||
+ dnl Also we don't like setup.py to add "intl" library to the list | |||
+ dnl when build _locale module. | |||
+ ;; | |||
+ *) | |||
AC_CHECK_LIB(intl, textdomain, | |||
[AC_DEFINE(WITH_LIBINTL, 1, | |||
[Define to 1 if libintl is needed for locale functions.]) | |||
LIBS="-lintl $LIBS"]) | |||
+ ;; | |||
+esac | |||
# checks for system dependent C++ extensions support | |||
case "$ac_sys_system" in | |||
diff -Naur Python-3.8.0-orig/Modules/_localemodule.c Python-3.8.0/Modules/_localemodule.c | |||
--- Python-3.8.0-orig/Modules/_localemodule.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Modules/_localemodule.c 2019-10-22 10:03:46.718235000 +0300 | |||
@@ -12,6 +12,13 @@ | |||
#define PY_SSIZE_T_CLEAN | |||
#include "Python.h" | |||
#include "pycore_fileutils.h" | |||
+#ifdef __MINGW32__ | |||
+/* The header libintl.h and library libintl may exist on mingw host. | |||
+ * To be compatible with MSVC build we has to undef some defines. | |||
+ */ | |||
+#undef HAVE_LIBINTL_H | |||
+#undef HAVE_BIND_TEXTDOMAIN_CODESET | |||
+#endif | |||
#include <stdio.h> | |||
#include <locale.h> |
@@ -0,0 +1,14 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/ctypes/__init__.py Python-3.8.0/Lib/ctypes/__init__.py | |||
--- Python-3.8.0-orig/Lib/ctypes/__init__.py 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Lib/ctypes/__init__.py 2019-10-22 10:03:49.931840600 +0300 | |||
@@ -449,7 +449,9 @@ | |||
cdll = LibraryLoader(CDLL) | |||
pydll = LibraryLoader(PyDLL) | |||
-if _os.name == "nt": | |||
+if _os.name == "nt" and _sys.version.find('GCC') >= 0: | |||
+ pythonapi = PyDLL("libpython%d.%d%s.dll" % (_sys.version_info[:2] + (_sys.abiflags,)), None) | |||
+elif _os.name == "nt": | |||
pythonapi = PyDLL("python dll", None, _sys.dllhandle) | |||
elif _sys.platform == "cygwin": | |||
pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2]) |
@@ -0,0 +1,12 @@ | |||
diff -Naur Python-3.8.0-orig/Modules/_gdbmmodule.c Python-3.8.0/Modules/_gdbmmodule.c | |||
--- Python-3.8.0-orig/Modules/_gdbmmodule.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Modules/_gdbmmodule.c 2019-10-22 10:03:53.161046300 +0300 | |||
@@ -11,7 +11,7 @@ | |||
#include <fcntl.h> | |||
#include "gdbm.h" | |||
-#if defined(WIN32) && !defined(__CYGWIN__) | |||
+#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__) | |||
#include "gdbmerrno.h" | |||
extern const char * gdbm_strerror(gdbm_error); | |||
#endif |
@@ -0,0 +1,45 @@ | |||
diff -Naur Python-3.8.0-orig/Include/bytesobject.h Python-3.8.0/Include/bytesobject.h | |||
--- Python-3.8.0-orig/Include/bytesobject.h 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Include/bytesobject.h 2019-10-22 10:03:56.031451300 +0300 | |||
@@ -52,9 +52,9 @@ | |||
PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *); | |||
PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *); | |||
PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list) | |||
- Py_GCC_ATTRIBUTE((format(printf, 1, 0))); | |||
+ Py_GCC_ATTRIBUTE((format(gnu_printf, 1, 0))); | |||
PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...) | |||
- Py_GCC_ATTRIBUTE((format(printf, 1, 2))); | |||
+ Py_GCC_ATTRIBUTE((format(gnu_printf, 1, 2))); | |||
PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *); | |||
PyAPI_FUNC(char *) PyBytes_AsString(PyObject *); | |||
PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int); | |||
diff -Naur Python-3.8.0-orig/Include/pyerrors.h Python-3.8.0/Include/pyerrors.h | |||
--- Python-3.8.0-orig/Include/pyerrors.h 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Include/pyerrors.h 2019-10-22 10:03:56.437052000 +0300 | |||
@@ -319,9 +319,9 @@ | |||
#include <stdarg.h> | |||
PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) | |||
- Py_GCC_ATTRIBUTE((format(printf, 3, 4))); | |||
+ Py_GCC_ATTRIBUTE((format(gnu_printf, 3, 4))); | |||
PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) | |||
- Py_GCC_ATTRIBUTE((format(printf, 3, 0))); | |||
+ Py_GCC_ATTRIBUTE((format(gnu_printf, 3, 0))); | |||
#ifndef Py_LIMITED_API | |||
# define Py_CPYTHON_ERRORS_H | |||
diff -Naur Python-3.8.0-orig/Include/sysmodule.h Python-3.8.0/Include/sysmodule.h | |||
--- Python-3.8.0-orig/Include/sysmodule.h 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Include/sysmodule.h 2019-10-22 10:03:56.858252800 +0300 | |||
@@ -15,9 +15,9 @@ | |||
PyAPI_FUNC(void) PySys_SetPath(const wchar_t *); | |||
PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) | |||
- Py_GCC_ATTRIBUTE((format(printf, 1, 2))); | |||
+ Py_GCC_ATTRIBUTE((format(gnu_printf, 1, 2))); | |||
PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) | |||
- Py_GCC_ATTRIBUTE((format(printf, 1, 2))); | |||
+ Py_GCC_ATTRIBUTE((format(gnu_printf, 1, 2))); | |||
PyAPI_FUNC(void) PySys_FormatStdout(const char *format, ...); | |||
PyAPI_FUNC(void) PySys_FormatStderr(const char *format, ...); | |||
@@ -0,0 +1,21 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/ssl.py Python-3.8.0/Lib/ssl.py | |||
--- Python-3.8.0-orig/Lib/ssl.py 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Lib/ssl.py 2019-10-22 10:04:00.493059100 +0300 | |||
@@ -249,7 +249,7 @@ | |||
CHANGE_CIPHER_SPEC = 0x0101 | |||
-if sys.platform == "win32": | |||
+if sys.platform == "win32" and sys.version.find("GCC") == -1: | |||
from _ssl import enum_certificates, enum_crls | |||
from socket import socket, AF_INET, SOCK_STREAM, create_connection | |||
@@ -569,7 +569,7 @@ | |||
def load_default_certs(self, purpose=Purpose.SERVER_AUTH): | |||
if not isinstance(purpose, _ASN1Object): | |||
raise TypeError(purpose) | |||
- if sys.platform == "win32": | |||
+ if sys.platform == "win32" and sys.version.find("GCC") == -1: | |||
for storename in self._windows_cert_stores: | |||
self._load_windows_store_certs(storename, purpose) | |||
self.set_default_verify_paths() |
@@ -0,0 +1,16 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/cygwinccompiler.py Python-3.8.0/Lib/distutils/cygwinccompiler.py | |||
--- Python-3.8.0-orig/Lib/distutils/cygwinccompiler.py 2019-10-22 10:03:07.686966400 +0300 | |||
+++ Python-3.8.0/Lib/distutils/cygwinccompiler.py 2019-10-22 10:04:03.316664100 +0300 | |||
@@ -305,9 +305,9 @@ | |||
raise CCompilerError( | |||
'Cygwin gcc cannot be used with --compiler=mingw32') | |||
- self.set_executables(compiler='gcc -O -Wall', | |||
- compiler_so='gcc -mdll -O -Wall', | |||
- compiler_cxx='g++ -O -Wall', | |||
+ self.set_executables(compiler='gcc -O2 -Wall', | |||
+ compiler_so='gcc -mdll -O2 -Wall', | |||
+ compiler_cxx='g++ -O2 -Wall', | |||
linker_exe='gcc', | |||
linker_so='%s %s %s' | |||
% (self.linker_dll, shared_option, |
@@ -0,0 +1,12 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/cygwinccompiler.py Python-3.8.0/Lib/distutils/cygwinccompiler.py | |||
--- Python-3.8.0-orig/Lib/distutils/cygwinccompiler.py 2019-10-22 10:04:05.048267100 +0300 | |||
+++ Python-3.8.0/Lib/distutils/cygwinccompiler.py 2019-10-22 10:04:06.140269100 +0300 | |||
@@ -238,7 +238,7 @@ | |||
# (On my machine: 10KiB < stripped_file < ??100KiB | |||
# unstripped_file = stripped_file + XXX KiB | |||
# ( XXX=254 for a typical python extension)) | |||
- if not debug: | |||
+ if not debug and not hasattr(sys, 'gettotalrefcount'): | |||
extra_preargs.append("-s") | |||
UnixCCompiler.link(self, target_desc, objects, output_filename, |
@@ -0,0 +1,21 @@ | |||
diff -Naur Python-3.8.0-orig/Python/sysmodule.c Python-3.8.0/Python/sysmodule.c | |||
--- Python-3.8.0-orig/Python/sysmodule.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Python/sysmodule.c 2019-10-22 10:04:08.995074100 +0300 | |||
@@ -34,7 +34,7 @@ | |||
#include <windows.h> | |||
#endif /* MS_WINDOWS */ | |||
-#ifdef MS_COREDLL | |||
+#if defined(MS_WINDOWS) && defined(Py_ENABLE_SHARED) | |||
extern void *PyWin_DLLhModule; | |||
/* A string loaded from the DLL at startup: */ | |||
extern const char *PyWin_DLLVersionString; | |||
@@ -2694,7 +2694,7 @@ | |||
PyUnicode_FromString("little")); | |||
#endif | |||
-#ifdef MS_COREDLL | |||
+#if defined(MS_WINDOWS) && defined(Py_ENABLE_SHARED) | |||
SET_SYS_FROM_STRING("dllhandle", | |||
PyLong_FromVoidPtr(PyWin_DLLhModule)); | |||
SET_SYS_FROM_STRING("winver", |
@@ -0,0 +1,12 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/command/build_ext.py Python-3.8.0/Lib/distutils/command/build_ext.py | |||
--- Python-3.8.0-orig/Lib/distutils/command/build_ext.py 2019-10-22 10:03:03.194158500 +0300 | |||
+++ Python-3.8.0/Lib/distutils/command/build_ext.py 2019-10-22 10:04:11.803079000 +0300 | |||
@@ -218,7 +218,7 @@ | |||
# For extensions under Cygwin, Python's library directory must be | |||
# appended to library_dirs | |||
- if sys.platform[:6] == 'cygwin': | |||
+ if sys.platform[:6] == 'cygwin' or self.plat_name.startswith(('mingw')): | |||
if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")): | |||
# building third party extensions | |||
config_dir_name = os.path.basename(sysconfig.get_config_var('LIBPL')) |
@@ -0,0 +1,27 @@ | |||
diff -Naur Python-3.8.0-orig/Python/getcompiler.c Python-3.8.0/Python/getcompiler.c | |||
--- Python-3.8.0-orig/Python/getcompiler.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Python/getcompiler.c 2019-10-22 10:04:17.450288900 +0300 | |||
@@ -10,7 +10,22 @@ | |||
#if defined(__clang__) | |||
#define COMPILER "\n[Clang " __clang_version__ "]" | |||
#elif defined(__GNUC__) | |||
-#define COMPILER "\n[GCC " __VERSION__ "]" | |||
+/* To not break compatibility with things that determine | |||
+ CPU arch by calling get_build_version in msvccompiler.py | |||
+ (such as NumPy) add "32 bit" or "64 bit (AMD64)" on Windows | |||
+ and also use a space as a separator rather than a newline. */ | |||
+#if defined(_WIN32) | |||
+#define COMP_SEP " " | |||
+#if defined(__x86_64__) | |||
+#define ARCH_SUFFIX " 64 bit (AMD64)" | |||
+#else | |||
+#define ARCH_SUFFIX " 32 bit" | |||
+#endif | |||
+#else | |||
+#define COMP_SEP "\n" | |||
+#define ARCH_SUFFIX "" | |||
+#endif | |||
+#define COMPILER COMP_SEP "[GCC " __VERSION__ ARCH_SUFFIX "]" | |||
// Generic fallbacks. | |||
#elif defined(__cplusplus) | |||
#define COMPILER "[C++]" |
@@ -0,0 +1,19 @@ | |||
diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac | |||
--- Python-3.8.0-orig/configure.ac 2019-10-22 10:03:48.434238000 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-22 10:04:20.273893900 +0300 | |||
@@ -5668,6 +5668,15 @@ | |||
done | |||
AC_MSG_RESULT(done) | |||
+# For mingw build need additional library for linking | |||
+case $host in | |||
+ *-*-mingw*) | |||
+ LIBS="$LIBS -lversion -lshlwapi" | |||
+ ;; | |||
+ *) | |||
+ ;; | |||
+esac | |||
+ | |||
# Availability of -O2: | |||
AC_MSG_CHECKING(for -O2) | |||
saved_cflags="$CFLAGS" |
@@ -0,0 +1,11 @@ | |||
diff -Naur Python-3.8.0-orig/Makefile.pre.in Python-3.8.0/Makefile.pre.in | |||
--- Python-3.8.0-orig/Makefile.pre.in 2019-10-22 10:03:33.473811700 +0300 | |||
+++ Python-3.8.0/Makefile.pre.in 2019-10-22 10:04:23.315899200 +0300 | |||
@@ -1404,6 +1404,7 @@ | |||
distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \ | |||
test/test_tools test/test_warnings test/test_warnings/data \ | |||
turtledemo \ | |||
+ msilib \ | |||
multiprocessing multiprocessing/dummy \ | |||
unittest unittest/test unittest/test/testmock \ | |||
venv venv/scripts venv/scripts/common venv/scripts/posix \ |
@@ -0,0 +1,22 @@ | |||
diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac | |||
--- Python-3.8.0-orig/configure.ac 2019-10-22 10:04:22.223897300 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-22 10:04:26.170704200 +0300 | |||
@@ -5293,9 +5293,15 @@ | |||
# first curses header check | |||
ac_save_cppflags="$CPPFLAGS" | |||
-if test "$cross_compiling" = no; then | |||
- CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" | |||
-fi | |||
+case $host_os in | |||
+ mingw*) | |||
+ ;; | |||
+ *) | |||
+ if test "$cross_compiling" = no; then | |||
+ CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" | |||
+ fi | |||
+ ;; | |||
+esac | |||
AC_CHECK_HEADERS(curses.h ncurses.h) | |||
@@ -0,0 +1,12 @@ | |||
diff -Naur Python-3.8.0-orig/Modules/Setup Python-3.8.0/Modules/Setup | |||
--- Python-3.8.0-orig/Modules/Setup 2019-10-22 10:01:07.612555400 +0300 | |||
+++ Python-3.8.0/Modules/Setup 2019-10-22 10:04:29.009909200 +0300 | |||
@@ -111,7 +111,7 @@ | |||
_abc _abc.c # Abstract base classes | |||
itertools itertoolsmodule.c # Functions creating iterators for efficient looping | |||
atexit atexitmodule.c # Register functions to be run at interpreter-shutdown | |||
-_signal -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal signalmodule.c | |||
+_signal -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal signalmodule.c -lws2_32 | |||
_stat _stat.c # stat.h interface | |||
time -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal timemodule.c # -lm # time operations and variables | |||
_thread -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal _threadmodule.c # low-level threading interface |
@@ -0,0 +1,12 @@ | |||
diff -Naur Python-3.8.0-orig/Modules/Setup Python-3.8.0/Modules/Setup | |||
--- Python-3.8.0-orig/Modules/Setup 2019-10-22 10:04:31.147113000 +0300 | |||
+++ Python-3.8.0/Modules/Setup 2019-10-22 10:04:32.223514900 +0300 | |||
@@ -120,7 +120,7 @@ | |||
_locale -DPy_BUILD_CORE_BUILTIN _localemodule.c # -lintl | |||
# Standard I/O baseline | |||
-_io -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal -I$(srcdir)/Modules/_io _io/_iomodule.c _io/iobase.c _io/fileio.c _io/bytesio.c _io/bufferedio.c _io/textio.c _io/stringio.c | |||
+_io -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal -I$(srcdir)/Modules/_io _io/_iomodule.c _io/iobase.c _io/fileio.c _io/bytesio.c _io/bufferedio.c _io/textio.c _io/stringio.c _io/winconsoleio.c | |||
# faulthandler module | |||
faulthandler faulthandler.c |
@@ -0,0 +1,12 @@ | |||
diff -Naur Python-3.8.0-orig/Modules/_multiprocessing/multiprocessing.c Python-3.8.0/Modules/_multiprocessing/multiprocessing.c | |||
--- Python-3.8.0-orig/Modules/_multiprocessing/multiprocessing.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Modules/_multiprocessing/multiprocessing.c 2019-10-22 10:04:35.437120500 +0300 | |||
@@ -128,7 +128,7 @@ | |||
{"recv", multiprocessing_recv, METH_VARARGS, ""}, | |||
{"send", multiprocessing_send, METH_VARARGS, ""}, | |||
#endif | |||
-#if !defined(POSIX_SEMAPHORES_NOT_ENABLED) && !defined(__ANDROID__) | |||
+#if defined(MS_WINDOWS) || (!defined(POSIX_SEMAPHORES_NOT_ENABLED) && !defined(__ANDROID__)) | |||
{"sem_unlink", _PyMp_sem_unlink, METH_VARARGS, ""}, | |||
#endif | |||
{NULL} |
@@ -0,0 +1,417 @@ | |||
diff -Naur Python-3.8.0-orig/Include/iscygpty.h Python-3.8.0/Include/iscygpty.h | |||
--- Python-3.8.0-orig/Include/iscygpty.h 1970-01-01 03:00:00.000000000 +0300 | |||
+++ Python-3.8.0/Include/iscygpty.h 2019-10-22 10:04:39.461927600 +0300 | |||
@@ -0,0 +1,41 @@ | |||
+/* | |||
+ * iscygpty.h -- part of ptycheck | |||
+ * https://github.com/k-takata/ptycheck | |||
+ * | |||
+ * Copyright (c) 2015-2017 K.Takata | |||
+ * | |||
+ * You can redistribute it and/or modify it under the terms of either | |||
+ * the MIT license (as described below) or the Vim license. | |||
+ * | |||
+ * Permission is hereby granted, free of charge, to any person obtaining | |||
+ * a copy of this software and associated documentation files (the | |||
+ * "Software"), to deal in the Software without restriction, including | |||
+ * without limitation the rights to use, copy, modify, merge, publish, | |||
+ * distribute, sublicense, and/or sell copies of the Software, and to | |||
+ * permit persons to whom the Software is furnished to do so, subject to | |||
+ * the following conditions: | |||
+ * | |||
+ * The above copyright notice and this permission notice shall be | |||
+ * included in all copies or substantial portions of the Software. | |||
+ * | |||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |||
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |||
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |||
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | |||
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |||
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |||
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
+ */ | |||
+ | |||
+#ifndef _ISCYGPTY_H | |||
+#define _ISCYGPTY_H | |||
+ | |||
+#ifdef _WIN32 | |||
+int is_cygpty(int fd); | |||
+int is_cygpty_used(void); | |||
+#else | |||
+#define is_cygpty(fd) 0 | |||
+#define is_cygpty_used() 0 | |||
+#endif | |||
+ | |||
+#endif /* _ISCYGPTY_H */ | |||
diff -Naur Python-3.8.0-orig/Makefile.pre.in Python-3.8.0/Makefile.pre.in | |||
--- Python-3.8.0-orig/Makefile.pre.in 2019-10-22 10:04:25.063102300 +0300 | |||
+++ Python-3.8.0/Makefile.pre.in 2019-10-22 10:04:39.867528300 +0300 | |||
@@ -346,6 +346,7 @@ | |||
Python/import.o \ | |||
Python/importdl.o \ | |||
Python/initconfig.o \ | |||
+ Python/iscygpty.o \ | |||
Python/marshal.o \ | |||
Python/modsupport.o \ | |||
Python/mysnprintf.o \ | |||
@@ -1011,6 +1012,7 @@ | |||
$(srcdir)/Include/import.h \ | |||
$(srcdir)/Include/interpreteridobject.h \ | |||
$(srcdir)/Include/intrcheck.h \ | |||
+ $(srcdir)/Include/iscygpty.h \ | |||
$(srcdir)/Include/iterobject.h \ | |||
$(srcdir)/Include/listobject.h \ | |||
$(srcdir)/Include/longintrepr.h \ | |||
diff -Naur Python-3.8.0-orig/Modules/_io/fileio.c Python-3.8.0/Modules/_io/fileio.c | |||
--- Python-3.8.0-orig/Modules/_io/fileio.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Modules/_io/fileio.c 2019-10-22 10:04:40.273129000 +0300 | |||
@@ -18,6 +18,7 @@ | |||
#endif | |||
#include <stddef.h> /* For offsetof */ | |||
#include "_iomodule.h" | |||
+#include "iscygpty.h" | |||
/* | |||
* Known likely problems: | |||
@@ -1119,7 +1120,7 @@ | |||
return err_closed(); | |||
Py_BEGIN_ALLOW_THREADS | |||
_Py_BEGIN_SUPPRESS_IPH | |||
- res = isatty(self->fd); | |||
+ res = isatty(self->fd) || is_cygpty(self->fd); | |||
_Py_END_SUPPRESS_IPH | |||
Py_END_ALLOW_THREADS | |||
return PyBool_FromLong(res); | |||
diff -Naur Python-3.8.0-orig/Modules/main.c Python-3.8.0/Modules/main.c | |||
--- Python-3.8.0-orig/Modules/main.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Modules/main.c 2019-10-22 10:04:41.068730400 +0300 | |||
@@ -5,6 +5,7 @@ | |||
#include "pycore_pylifecycle.h" | |||
#include "pycore_pymem.h" | |||
#include "pycore_pystate.h" | |||
+#include "iscygpty.h" | |||
#ifdef __FreeBSD__ | |||
# include <fenv.h> /* fedisableexcept() */ | |||
@@ -103,7 +104,7 @@ | |||
static int | |||
stdin_is_interactive(const PyConfig *config) | |||
{ | |||
- return (isatty(fileno(stdin)) || config->interactive); | |||
+ return (isatty(fileno(stdin)) || config->interactive || is_cygpty(fileno(stdin))); | |||
} | |||
diff -Naur Python-3.8.0-orig/Modules/posixmodule.c Python-3.8.0/Modules/posixmodule.c | |||
--- Python-3.8.0-orig/Modules/posixmodule.c 2019-10-22 10:02:48.171332100 +0300 | |||
+++ Python-3.8.0/Modules/posixmodule.c 2019-10-22 10:04:41.489931200 +0300 | |||
@@ -34,6 +34,7 @@ | |||
FSCTL_GET_REPARSE_POINT is not exported with WIN32_LEAN_AND_MEAN. */ | |||
# include <windows.h> | |||
#endif | |||
+#include "iscygpty.h" | |||
#include "pycore_ceval.h" /* _PyEval_ReInitThreads() */ | |||
#include "pycore_pystate.h" /* _PyRuntime */ | |||
@@ -9258,7 +9259,7 @@ | |||
{ | |||
int return_value; | |||
_Py_BEGIN_SUPPRESS_IPH | |||
- return_value = isatty(fd); | |||
+ return_value = isatty(fd) || is_cygpty(fd); | |||
_Py_END_SUPPRESS_IPH | |||
return return_value; | |||
} | |||
diff -Naur Python-3.8.0-orig/Python/frozenmain.c Python-3.8.0/Python/frozenmain.c | |||
--- Python-3.8.0-orig/Python/frozenmain.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Python/frozenmain.c 2019-10-22 10:04:41.895531900 +0300 | |||
@@ -4,6 +4,7 @@ | |||
#include "Python.h" | |||
#include "pycore_pystate.h" | |||
#include <locale.h> | |||
+#include "iscygpty.h" | |||
#ifdef MS_WINDOWS | |||
extern void PyWinFreeze_ExeInit(void); | |||
@@ -107,7 +108,7 @@ | |||
else | |||
sts = 0; | |||
- if (inspect && isatty((int)fileno(stdin))) | |||
+ if (inspect && (isatty((int)fileno(stdin)) || is_cygpty((int)fileno(stdin)))) | |||
sts = PyRun_AnyFile(stdin, "<stdin>") != 0; | |||
#ifdef MS_WINDOWS | |||
diff -Naur Python-3.8.0-orig/Python/iscygpty.c Python-3.8.0/Python/iscygpty.c | |||
--- Python-3.8.0-orig/Python/iscygpty.c 1970-01-01 03:00:00.000000000 +0300 | |||
+++ Python-3.8.0/Python/iscygpty.c 2019-10-22 10:04:42.301132600 +0300 | |||
@@ -0,0 +1,185 @@ | |||
+/* | |||
+ * iscygpty.c -- part of ptycheck | |||
+ * https://github.com/k-takata/ptycheck | |||
+ * | |||
+ * Copyright (c) 2015-2017 K.Takata | |||
+ * | |||
+ * You can redistribute it and/or modify it under the terms of either | |||
+ * the MIT license (as described below) or the Vim license. | |||
+ * | |||
+ * Permission is hereby granted, free of charge, to any person obtaining | |||
+ * a copy of this software and associated documentation files (the | |||
+ * "Software"), to deal in the Software without restriction, including | |||
+ * without limitation the rights to use, copy, modify, merge, publish, | |||
+ * distribute, sublicense, and/or sell copies of the Software, and to | |||
+ * permit persons to whom the Software is furnished to do so, subject to | |||
+ * the following conditions: | |||
+ * | |||
+ * The above copyright notice and this permission notice shall be | |||
+ * included in all copies or substantial portions of the Software. | |||
+ * | |||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |||
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |||
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |||
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | |||
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |||
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |||
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
+ */ | |||
+ | |||
+#ifdef _WIN32 | |||
+ | |||
+#include <ctype.h> | |||
+#include <io.h> | |||
+#include <wchar.h> | |||
+#include <windows.h> | |||
+ | |||
+#ifdef USE_FILEEXTD | |||
+/* VC 7.1 or earlier doesn't support SAL. */ | |||
+# if !defined(_MSC_VER) || (_MSC_VER < 1400) | |||
+# define __out | |||
+# define __in | |||
+# define __in_opt | |||
+# endif | |||
+/* Win32 FileID API Library: | |||
+ * http://www.microsoft.com/en-us/download/details.aspx?id=22599 | |||
+ * Needed for WinXP. */ | |||
+# include <fileextd.h> | |||
+#else /* USE_FILEEXTD */ | |||
+/* VC 8 or earlier. */ | |||
+# if defined(_MSC_VER) && (_MSC_VER < 1500) | |||
+# ifdef ENABLE_STUB_IMPL | |||
+# define STUB_IMPL | |||
+# else | |||
+# error "Win32 FileID API Library is required for VC2005 or earlier." | |||
+# endif | |||
+# endif | |||
+#endif /* USE_FILEEXTD */ | |||
+ | |||
+ | |||
+#include "iscygpty.h" | |||
+ | |||
+//#define USE_DYNFILEID | |||
+#ifdef USE_DYNFILEID | |||
+typedef BOOL (WINAPI *pfnGetFileInformationByHandleEx)( | |||
+ HANDLE hFile, | |||
+ FILE_INFO_BY_HANDLE_CLASS FileInformationClass, | |||
+ LPVOID lpFileInformation, | |||
+ DWORD dwBufferSize | |||
+); | |||
+static pfnGetFileInformationByHandleEx pGetFileInformationByHandleEx = NULL; | |||
+ | |||
+# ifndef USE_FILEEXTD | |||
+static BOOL WINAPI stub_GetFileInformationByHandleEx( | |||
+ HANDLE hFile, | |||
+ FILE_INFO_BY_HANDLE_CLASS FileInformationClass, | |||
+ LPVOID lpFileInformation, | |||
+ DWORD dwBufferSize | |||
+ ) | |||
+{ | |||
+ return FALSE; | |||
+} | |||
+# endif | |||
+ | |||
+static void setup_fileid_api(void) | |||
+{ | |||
+ if (pGetFileInformationByHandleEx != NULL) { | |||
+ return; | |||
+ } | |||
+ pGetFileInformationByHandleEx = (pfnGetFileInformationByHandleEx) | |||
+ GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), | |||
+ "GetFileInformationByHandleEx"); | |||
+ if (pGetFileInformationByHandleEx == NULL) { | |||
+# ifdef USE_FILEEXTD | |||
+ pGetFileInformationByHandleEx = GetFileInformationByHandleEx; | |||
+# else | |||
+ pGetFileInformationByHandleEx = stub_GetFileInformationByHandleEx; | |||
+# endif | |||
+ } | |||
+} | |||
+#else | |||
+# define pGetFileInformationByHandleEx GetFileInformationByHandleEx | |||
+# define setup_fileid_api() | |||
+#endif | |||
+ | |||
+ | |||
+#define is_wprefix(s, prefix) \ | |||
+ (wcsncmp((s), (prefix), sizeof(prefix) / sizeof(WCHAR) - 1) == 0) | |||
+ | |||
+/* Check if the fd is a cygwin/msys's pty. */ | |||
+int is_cygpty(int fd) | |||
+{ | |||
+#ifdef STUB_IMPL | |||
+ return 0; | |||
+#else | |||
+ HANDLE h; | |||
+ int size = sizeof(FILE_NAME_INFO) + sizeof(WCHAR) * (MAX_PATH - 1); | |||
+ FILE_NAME_INFO *nameinfo; | |||
+ WCHAR *p = NULL; | |||
+ | |||
+ setup_fileid_api(); | |||
+ | |||
+ h = (HANDLE) _get_osfhandle(fd); | |||
+ if (h == INVALID_HANDLE_VALUE) { | |||
+ return 0; | |||
+ } | |||
+ /* Cygwin/msys's pty is a pipe. */ | |||
+ if (GetFileType(h) != FILE_TYPE_PIPE) { | |||
+ return 0; | |||
+ } | |||
+ nameinfo = malloc(size + sizeof(WCHAR)); | |||
+ if (nameinfo == NULL) { | |||
+ return 0; | |||
+ } | |||
+ /* Check the name of the pipe: | |||
+ * '\{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master' */ | |||
+ if (pGetFileInformationByHandleEx(h, FileNameInfo, nameinfo, size)) { | |||
+ nameinfo->FileName[nameinfo->FileNameLength / sizeof(WCHAR)] = L'\0'; | |||
+ p = nameinfo->FileName; | |||
+ if (is_wprefix(p, L"\\cygwin-")) { /* Cygwin */ | |||
+ p += 8; | |||
+ } else if (is_wprefix(p, L"\\msys-")) { /* MSYS and MSYS2 */ | |||
+ p += 6; | |||
+ } else { | |||
+ p = NULL; | |||
+ } | |||
+ if (p != NULL) { | |||
+ while (*p && isxdigit(*p)) /* Skip 16-digit hexadecimal. */ | |||
+ ++p; | |||
+ if (is_wprefix(p, L"-pty")) { | |||
+ p += 4; | |||
+ } else { | |||
+ p = NULL; | |||
+ } | |||
+ } | |||
+ if (p != NULL) { | |||
+ while (*p && isdigit(*p)) /* Skip pty number. */ | |||
+ ++p; | |||
+ if (is_wprefix(p, L"-from-master")) { | |||
+ //p += 12; | |||
+ } else if (is_wprefix(p, L"-to-master")) { | |||
+ //p += 10; | |||
+ } else { | |||
+ p = NULL; | |||
+ } | |||
+ } | |||
+ } | |||
+ free(nameinfo); | |||
+ return (p != NULL); | |||
+#endif /* STUB_IMPL */ | |||
+} | |||
+ | |||
+/* Check if at least one cygwin/msys pty is used. */ | |||
+int is_cygpty_used(void) | |||
+{ | |||
+ int fd, ret = 0; | |||
+ | |||
+ for (fd = 0; fd < 3; fd++) { | |||
+ ret |= is_cygpty(fd); | |||
+ } | |||
+ return ret; | |||
+} | |||
+ | |||
+#endif /* _WIN32 */ | |||
+ | |||
+/* vim: set ts=4 sw=4: */ | |||
diff -Naur Python-3.8.0-orig/Python/pylifecycle.c Python-3.8.0/Python/pylifecycle.c | |||
--- Python-3.8.0-orig/Python/pylifecycle.c 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Python/pylifecycle.c 2019-10-22 10:04:42.691133300 +0300 | |||
@@ -24,6 +24,7 @@ | |||
#include "ast.h" | |||
#include "marshal.h" | |||
#include "osdefs.h" | |||
+#include "iscygpty.h" | |||
#include <locale.h> | |||
#ifdef HAVE_SIGNAL_H | |||
@@ -2349,7 +2350,7 @@ | |||
int | |||
Py_FdIsInteractive(FILE *fp, const char *filename) | |||
{ | |||
- if (isatty((int)fileno(fp))) | |||
+ if (isatty((int)fileno(fp)) || is_cygpty((int)fileno(fp))) | |||
return 1; | |||
if (!Py_InteractiveFlag) | |||
return 0; | |||
--- Python-3.8.7/Python/bltinmodule.c.orig 2020-12-21 17:25:24.000000000 +0100 | |||
+++ Python-3.8.7/Python/bltinmodule.c 2021-01-06 16:50:48.899457200 +0100 | |||
@@ -1,6 +1,7 @@ | |||
/* Built-in functions */ | |||
#include "Python.h" | |||
+#include "iscygpty.h" | |||
#include <ctype.h> | |||
#include "ast.h" | |||
#undef Yield /* undefine macro conflicting with <winbase.h> */ | |||
@@ -1980,7 +1981,7 @@ | |||
Py_DECREF(tmp); | |||
if (fd < 0 && PyErr_Occurred()) | |||
return NULL; | |||
- tty = fd == fileno(stdin) && isatty(fd); | |||
+ tty = fd == fileno(stdin) && (isatty(fd) || is_cygpty(fd)); | |||
} | |||
if (tty) { | |||
tmp = _PyObject_CallMethodId(fout, &PyId_fileno, NULL); | |||
@@ -1993,7 +1994,7 @@ | |||
Py_DECREF(tmp); | |||
if (fd < 0 && PyErr_Occurred()) | |||
return NULL; | |||
- tty = fd == fileno(stdout) && isatty(fd); | |||
+ tty = fd == fileno(stdout) && (isatty(fd) || is_cygpty(fd)); | |||
} | |||
} | |||
--- Python-3.8.7/Objects/fileobject.c.orig 2020-12-21 17:25:24.000000000 +0100 | |||
+++ Python-3.8.7/Objects/fileobject.c 2021-01-06 16:51:19.605061600 +0100 | |||
@@ -2,6 +2,7 @@ | |||
#define PY_SSIZE_T_CLEAN | |||
#include "Python.h" | |||
+#include "iscygpty.h" | |||
#include "pycore_pystate.h" | |||
#if defined(HAVE_GETC_UNLOCKED) && !defined(_Py_MEMORY_SANITIZER) | |||
@@ -434,7 +435,7 @@ | |||
} | |||
Py_BEGIN_ALLOW_THREADS | |||
- res = isatty(self->fd); | |||
+ res = isatty(self->fd) || is_cygpty(self->fd); | |||
Py_END_ALLOW_THREADS | |||
return PyBool_FromLong(res); | |||
--- Python-3.8.7/Python/fileutils.c.orig 2020-12-21 17:25:24.000000000 +0100 | |||
+++ Python-3.8.7/Python/fileutils.c 2021-01-06 16:50:56.153853200 +0100 | |||
@@ -1,4 +1,5 @@ | |||
#include "Python.h" | |||
+#include "iscygpty.h" | |||
#include "pycore_fileutils.h" | |||
#include "osdefs.h" | |||
#include <locale.h> | |||
@@ -59,7 +60,7 @@ | |||
#endif | |||
int valid; | |||
_Py_BEGIN_SUPPRESS_IPH | |||
- valid = isatty(fd); | |||
+ valid = isatty(fd) || is_cygpty(fd); | |||
_Py_END_SUPPRESS_IPH | |||
if (!valid) | |||
Py_RETURN_NONE; |
@@ -0,0 +1,12 @@ | |||
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py | |||
--- Python-3.8.0-orig/setup.py 2019-10-22 10:04:16.342687000 +0300 | |||
+++ Python-3.8.0/setup.py 2019-10-22 10:04:48.353943200 +0300 | |||
@@ -1331,7 +1331,7 @@ | |||
if dbm_args: | |||
dbm_order = [arg.split('=')[-1] for arg in dbm_args][-1].split(":") | |||
else: | |||
- dbm_order = "ndbm:gdbm:bdb".split(":") | |||
+ dbm_order = [] | |||
dbmext = None | |||
for cand in dbm_order: | |||
if cand == "ndbm": |
@@ -0,0 +1,71 @@ | |||
diff -Naur Python-3.8.0-orig/Makefile.pre.in Python-3.8.0/Makefile.pre.in | |||
--- Python-3.8.0-orig/Makefile.pre.in 2019-10-22 10:04:44.812737000 +0300 | |||
+++ Python-3.8.0/Makefile.pre.in 2019-10-22 10:04:51.177548200 +0300 | |||
@@ -249,6 +249,7 @@ | |||
PYTHON= python$(EXE) | |||
BUILDPYTHON= python$(BUILDEXE) | |||
+BUILDPYTHONW= pythonw$(BUILDEXE) | |||
PYTHON_FOR_REGEN=@PYTHON_FOR_REGEN@ | |||
UPDATE_FILE=@PYTHON_FOR_REGEN@ $(srcdir)/Tools/scripts/update_file.py | |||
@@ -455,7 +456,7 @@ | |||
# Default target | |||
all: @DEF_MAKE_ALL_RULE@ | |||
-build_all: check-clean-src $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks \ | |||
+build_all: check-clean-src $(BUILDPYTHON) $(BUILDPYTHONW) oldsharedmods sharedmods gdbhooks \ | |||
Programs/_testembed python-config | |||
# Check that the source is clean when building out of source. | |||
@@ -569,9 +570,27 @@ | |||
clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c | |||
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --srcdir $(srcdir) | |||
+pythonnt_rc.h: | |||
+ # FIXME: FIELD3 not set | |||
+ @echo '#define FIELD3 0' > $@ | |||
+ @echo '#define MS_DLL_ID "$(VERSION)"' >> $@ | |||
+ @echo '#define PYTHON_DLL_NAME "$(DLLLIBRARY)"' >> $@ | |||
+ | |||
+python_exe.o: pythonnt_rc.h $(srcdir)/PC/python_exe.rc | |||
+ windres -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/python_exe.rc $@ | |||
+ | |||
+pythonw_exe.o: pythonnt_rc.h $(srcdir)/PC/pythonw_exe.rc | |||
+ windres -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/pythonw_exe.rc $@ | |||
+ | |||
+python_nt.o: pythonnt_rc.h $(srcdir)/PC/python_nt.rc | |||
+ windres -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/python_nt.rc $@ | |||
+ | |||
+$(BUILDPYTHONW): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) pythonw_exe.o | |||
+ $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -municode -mwindows -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) pythonw_exe.o | |||
+ | |||
# Build the interpreter | |||
-$(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) | |||
- $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) | |||
+$(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) python_exe.o | |||
+ $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -municode -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) python_exe.o | |||
platform: $(BUILDPYTHON) pybuilddir.txt | |||
$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform | |||
@@ -677,10 +696,10 @@ | |||
# This rule builds the Cygwin Python DLL and import library if configured | |||
# for a shared core library; otherwise, this rule is a noop. | |||
-$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS) | |||
+$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS) python_nt.o | |||
if test -n "$(DLLLIBRARY)"; then \ | |||
$(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \ | |||
- $(LIBS) $(MODLIBS) $(SYSLIBS); \ | |||
+ $(LIBS) $(MODLIBS) $(SYSLIBS) python_nt.o; \ | |||
else true; \ | |||
fi | |||
@@ -1246,6 +1265,7 @@ | |||
done | |||
if test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \ | |||
$(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \ | |||
+ $(INSTALL_PROGRAM) $(BUILDPYTHONW) $(DESTDIR)$(BINDIR)/python3w$(EXE); \ | |||
else \ | |||
$(INSTALL_PROGRAM) $(STRIPFLAG) Mac/pythonw $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \ | |||
fi |
@@ -0,0 +1,12 @@ | |||
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py | |||
--- Python-3.8.0-orig/setup.py 2019-10-22 10:04:50.085546300 +0300 | |||
+++ Python-3.8.0/setup.py 2019-10-22 10:04:54.016753200 +0300 | |||
@@ -2165,7 +2165,7 @@ | |||
undef_macros = [] | |||
if '--with-system-libmpdec' in sysconfig.get_config_var("CONFIG_ARGS"): | |||
include_dirs = [] | |||
- libraries = [':libmpdec.so.2'] | |||
+ libraries = [':libmpdec.dll.a'] | |||
sources = ['_decimal/_decimal.c'] | |||
depends = ['_decimal/docstrings.h'] | |||
else: |
@@ -0,0 +1,15 @@ | |||
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py | |||
--- Python-3.8.0-orig/setup.py 2019-10-22 10:04:55.763956200 +0300 | |||
+++ Python-3.8.0/setup.py 2019-10-22 10:04:59.804363300 +0300 | |||
@@ -911,7 +911,10 @@ | |||
def detect_readline_curses(self): | |||
# readline | |||
- do_readline = self.compiler.find_library_file(self.lib_dirs, 'readline') | |||
+ if not MS_WINDOWS: | |||
+ do_readline = self.compiler.find_library_file(self.lib_dirs, 'readline') | |||
+ else: | |||
+ do_readline = False | |||
readline_termcap_library = "" | |||
curses_library = "" | |||
# Cannot use os.popen here in py3k. |
@@ -0,0 +1,12 @@ | |||
diff -Naur Python-3.8.0-orig/Include/fileobject.h Python-3.8.0/Include/fileobject.h | |||
--- Python-3.8.0-orig/Include/fileobject.h 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Include/fileobject.h 2019-10-22 10:05:02.627968300 +0300 | |||
@@ -23,7 +23,7 @@ | |||
PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding; | |||
/* A routine to check if a file descriptor can be select()-ed. */ | |||
-#ifdef _MSC_VER | |||
+#ifdef MS_WINDOWS | |||
/* On Windows, any socket fd can be select()-ed, no matter how high */ | |||
#define _PyIsSelectable_fd(FD) (1) | |||
#else |
@@ -0,0 +1,12 @@ | |||
diff -Naur Python-3.8.0-orig/Modules/getpath.c Python-3.8.0/Modules/getpath.c | |||
--- Python-3.8.0-orig/Modules/getpath.c 2019-10-22 10:02:51.821738500 +0300 | |||
+++ Python-3.8.0/Modules/getpath.c 2019-10-22 10:05:05.467173300 +0300 | |||
@@ -373,7 +373,7 @@ | |||
/* Check for already have an executable suffix */ | |||
size_t n = wcslen(progpath); | |||
size_t s = wcslen(EXE_SUFFIX); | |||
- if (wcsncasecmp(EXE_SUFFIX, progpath + n - s, s) == 0) { | |||
+ if (_wcsnicmp(EXE_SUFFIX, progpath + n - s, s) == 0) { | |||
return _PyStatus_OK(); | |||
} | |||
@@ -0,0 +1,11 @@ | |||
--- Python-3.8.0/Modules/_xxsubinterpretersmodule.c.orig 2019-10-22 13:34:28.145872500 +0300 | |||
+++ Python-3.8.0/Modules/_xxsubinterpretersmodule.c 2019-10-22 13:34:49.299509600 +0300 | |||
@@ -1749,7 +1749,7 @@ | |||
"A channel ID identifies a channel and may be used as an int."); | |||
static PyTypeObject ChannelIDtype = { | |||
- PyVarObject_HEAD_INIT(&PyType_Type, 0) | |||
+ PyVarObject_HEAD_INIT(NULL, 0) | |||
"_xxsubinterpreters.ChannelID", /* tp_name */ | |||
sizeof(channelid), /* tp_basicsize */ | |||
0, /* tp_itemsize */ |
@@ -0,0 +1,18 @@ | |||
diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac | |||
--- Python-3.8.0-orig/configure.ac 2019-10-22 10:04:27.917907300 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-22 10:05:14.312388800 +0300 | |||
@@ -4110,10 +4110,14 @@ | |||
AC_MSG_CHECKING(for inet_pton) | |||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |||
+#ifdef _WIN32 | |||
+#include <ws2tcpip.h> | |||
+#else | |||
#include <sys/types.h> | |||
#include <sys/socket.h> | |||
#include <netinet/in.h> | |||
#include <arpa/inet.h> | |||
+#endif | |||
]], [[void* p = inet_pton]])], | |||
[AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.) | |||
AC_MSG_RESULT(yes)], |
@@ -0,0 +1,21 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/msvc9compiler.py Python-3.8.0/Lib/distutils/msvc9compiler.py | |||
--- Python-3.8.0-orig/Lib/distutils/msvc9compiler.py 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Lib/distutils/msvc9compiler.py 2019-10-22 10:05:17.120393700 +0300 | |||
@@ -292,8 +292,6 @@ | |||
# More globals | |||
VERSION = get_build_version() | |||
-if VERSION < 8.0: | |||
- raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION) | |||
# MACROS = MacroExpander(VERSION) | |||
class MSVCCompiler(CCompiler) : | |||
@@ -328,6 +326,8 @@ | |||
def __init__(self, verbose=0, dry_run=0, force=0): | |||
CCompiler.__init__ (self, verbose, dry_run, force) | |||
+ if VERSION < 8.0: | |||
+ raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION) | |||
self.__version = VERSION | |||
self.__root = r"Software\Microsoft\VisualStudio" | |||
# self.__macros = MACROS |
@@ -0,0 +1,12 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/venv/scripts/common/activate Python-3.8.0/Lib/venv/scripts/common/activate | |||
--- Python-3.8.0-orig/Lib/venv/scripts/common/activate 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Lib/venv/scripts/common/activate 2019-10-22 10:05:22.783203700 +0300 | |||
@@ -37,7 +37,7 @@ | |||
# unset irrelevant variables | |||
deactivate nondestructive | |||
-VIRTUAL_ENV="__VENV_DIR__" | |||
+VIRTUAL_ENV=$(cygpath "__VENV_DIR__") | |||
export VIRTUAL_ENV | |||
_OLD_VIRTUAL_PATH="$PATH" |
@@ -0,0 +1,62 @@ | |||
Don't copy the whole /bin when symlinking. | |||
Also provide python3.exe for backwards compat. | |||
Unset MSYSTEM, to fix some path comparisons due to os.sep differences. | |||
Skip some msvc build specifics | |||
diff -Naur Python-3.8.0-orig/Lib/venv/__init__.py Python-3.8.0/Lib/venv/__init__.py | |||
--- Python-3.8.0-orig/Lib/venv/__init__.py 2019-10-22 10:05:21.691201800 +0300 | |||
+++ Python-3.8.0/Lib/venv/__init__.py 2019-10-22 10:05:25.591208600 +0300 | |||
@@ -11,6 +11,7 @@ | |||
import sys | |||
import sysconfig | |||
import types | |||
+from sysconfig import _POSIX_BUILD | |||
logger = logging.getLogger(__name__) | |||
@@ -110,7 +111,7 @@ | |||
context.executable = executable | |||
context.python_dir = dirname | |||
context.python_exe = exename | |||
- if sys.platform == 'win32': | |||
+ if sys.platform == 'win32' and not _POSIX_BUILD: | |||
binname = 'Scripts' | |||
incpath = 'Include' | |||
libpath = os.path.join(env_dir, 'Lib', 'site-packages') | |||
@@ -244,7 +244,7 @@ | |||
if not os.path.islink(path): | |||
os.chmod(path, 0o755) | |||
else: | |||
- if self.symlinks: | |||
+ if self.symlinks and not _POSIX_BUILD: | |||
# For symlinking, we need a complete copy of the root directory | |||
# If symlinks fail, you'll get unnecessary copies of files, but | |||
# we assume that if you've opted into symlinks on Windows then | |||
@@ -266,7 +267,13 @@ | |||
if os.path.lexists(src): | |||
copier(src, os.path.join(binpath, suffix)) | |||
- if sysconfig.is_python_build(True): | |||
+ if _POSIX_BUILD: | |||
+ # copy from python/pythonw so the venvlauncher magic in symlink_or_copy triggers | |||
+ copier(os.path.join(dirname, 'python.exe'), os.path.join(binpath, 'python3.exe')) | |||
+ copier(os.path.join(dirname, 'python.exe'), os.path.join(binpath, 'python%d.%d.exe' % sys.version_info[:2])) | |||
+ copier(os.path.join(dirname, 'pythonw.exe'), os.path.join(binpath, 'python3w.exe')) | |||
+ | |||
+ if sysconfig.is_python_build(True) and not _POSIX_BUILD: | |||
# copy init.tcl | |||
for root, dirs, files in os.walk(context.python_dir): | |||
if 'init.tcl' in files: | |||
@@ -285,9 +285,11 @@ | |||
# We run ensurepip in isolated mode to avoid side effects from | |||
# environment vars, the current directory and anything else | |||
# intended for the global Python environment | |||
+ env = os.environ.copy() | |||
+ env.pop("MSYSTEM", None) | |||
cmd = [context.env_exe, '-Im', 'ensurepip', '--upgrade', | |||
- '--default-pip'] | |||
- subprocess.check_output(cmd, stderr=subprocess.STDOUT) | |||
+ '--default-pip'] | |||
+ subprocess.check_call(cmd, stderr=subprocess.STDOUT, env=env) | |||
def setup_scripts(self, context): | |||
""" |
@@ -0,0 +1,12 @@ | |||
diff -Naur Python-3.8.0-orig/Makefile.pre.in Python-3.8.0/Makefile.pre.in | |||
--- Python-3.8.0-orig/Makefile.pre.in 2019-10-22 10:05:10.396781900 +0300 | |||
+++ Python-3.8.0/Makefile.pre.in 2019-10-22 10:05:28.430413600 +0300 | |||
@@ -699,7 +699,7 @@ | |||
$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS) python_nt.o | |||
if test -n "$(DLLLIBRARY)"; then \ | |||
$(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \ | |||
- $(LIBS) $(MODLIBS) $(SYSLIBS) python_nt.o; \ | |||
+ $(LIBS) $(LDFLAGS_NODIST) $(MODLIBS) $(SYSLIBS) python_nt.o; \ | |||
else true; \ | |||
fi | |||
@@ -0,0 +1,44 @@ | |||
diff -Naur Python-3.8.0-orig/Lib/distutils/cygwinccompiler.py Python-3.8.0/Lib/distutils/cygwinccompiler.py | |||
--- Python-3.8.0-orig/Lib/distutils/cygwinccompiler.py 2019-10-22 10:04:07.887472100 +0300 | |||
+++ Python-3.8.0/Lib/distutils/cygwinccompiler.py 2019-10-22 10:05:31.254018600 +0300 | |||
@@ -165,6 +165,28 @@ | |||
self.spawn(["windres", "-i", src, "-o", obj]) | |||
except DistutilsExecError as msg: | |||
raise CompileError(msg) | |||
+ elif ext == '.mc': | |||
+ # Adapted from msvc9compiler: | |||
+ # | |||
+ # Compile .MC to .RC file to .RES file. | |||
+ # * '-h dir' specifies the directory for the generated include file | |||
+ # * '-r dir' specifies the target directory of the generated RC file and the binary message resource it includes | |||
+ # | |||
+ # For now (since there are no options to change this), | |||
+ # we use the source-directory for the include file and | |||
+ # the build directory for the RC file and message | |||
+ # resources. This works at least for win32all. | |||
+ h_dir = os.path.dirname(src) | |||
+ rc_dir = os.path.dirname(obj) | |||
+ try: | |||
+ # first compile .MC to .RC and .H file | |||
+ self.spawn(['windmc'] + ['-h', h_dir, '-r', rc_dir] + [src]) | |||
+ base, _ = os.path.splitext(os.path.basename(src)) | |||
+ rc_file = os.path.join(rc_dir, base + '.rc') | |||
+ # then compile .RC to .RES file | |||
+ self.spawn(['windres', '-i', rc_file, '-o', obj]) | |||
+ except DistutilsExecError as msg: | |||
+ raise CompileError(msg) | |||
else: # for other files use the C-compiler | |||
try: | |||
self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + | |||
@@ -259,9 +281,9 @@ | |||
base, ext = os.path.splitext(src_name) | |||
# use 'normcase' only for resource suffixes | |||
ext_normcase = os.path.normcase(ext) | |||
- if ext_normcase in ['.rc','.res']: | |||
+ if ext_normcase in ['.rc', '.res', '.mc']: | |||
ext = ext_normcase | |||
- if ext not in (self.src_extensions + ['.rc','.res']): | |||
+ if ext not in (self.src_extensions + ['.rc', '.res', '.mc']): | |||
raise UnknownFileError("unknown file type '%s' (from '%s')" % \ | |||
(ext, src_name)) | |||
base = os.path.splitdrive(base)[1] # Chop off the drive |
@@ -0,0 +1,20 @@ | |||
--- Python-3.8.0/configure.ac.orig 2019-10-24 13:55:46.684382200 +0300 | |||
+++ Python-3.8.0/configure.ac 2019-10-24 13:55:55.334394400 +0300 | |||
@@ -4990,7 +4990,7 @@ | |||
# On Android and Cygwin the shared libraries must be linked with libpython. | |||
AC_SUBST(LIBPYTHON) | |||
-if test -n "$ANDROID_API_LEVEL" -o "$MACHDEP" = "cygwin"; then | |||
+if test -n "$ANDROID_API_LEVEL" -o "$MACHDEP" = "cygwin" -o "$MACHDEP" = "win"; then | |||
LIBPYTHON="-lpython${VERSION}${ABIFLAGS}" | |||
else | |||
LIBPYTHON='' | |||
--- Python-3.8.0/Misc/python.pc.in.orig 2019-10-24 13:55:46.684382200 +0300 | |||
+++ Python-3.8.0/Misc/python.pc.in 2019-10-24 13:55:55.334394400 +0300 | |||
@@ -9,5 +9,5 @@ | |||
Requires: | |||
Version: @VERSION@ | |||
Libs.private: @LIBS@ | |||
-Libs: | |||
+Libs: -L${libdir} -lpython@VERSION@@ABIFLAGS@ | |||
Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@ |
@@ -0,0 +1,14 @@ | |||
--- Python-3.8.0/Lib/importlib/_bootstrap_external.py.orig 2019-12-21 14:31:23.806479400 +0100 | |||
+++ Python-3.8.0/Lib/importlib/_bootstrap_external.py 2019-12-21 14:34:37.093867400 +0100 | |||
@@ -1603,6 +1603,11 @@ | |||
continue | |||
else: | |||
raise ImportError('importlib requires posix or nt') | |||
+ | |||
+ if 'MSYSTEM' in os_module.environ: | |||
+ path_separators = path_separators[::-1] | |||
+ path_sep = path_separators[0] | |||
+ | |||
setattr(self_module, '_os', os_module) | |||
setattr(self_module, 'path_sep', path_sep) | |||
setattr(self_module, 'path_separators', ''.join(path_separators)) |
@@ -0,0 +1,11 @@ | |||
--- Python-3.8.1/Lib/pathlib.py.orig 2019-12-18 18:21:23.000000000 +0100 | |||
+++ Python-3.8.1/Lib/pathlib.py 2019-12-23 11:17:46.731915100 +0100 | |||
@@ -122,6 +122,8 @@ | |||
sep = '\\' | |||
altsep = '/' | |||
+ if 'MSYSTEM' in os.environ: | |||
+ sep, altsep = altsep, sep | |||
has_drv = True | |||
pathmod = ntpath | |||
@@ -0,0 +1,31 @@ | |||
--- Python-3.8.7/Modules/_localemodule.c.orig 2020-12-26 06:59:08.920163200 +0100 | |||
+++ Python-3.8.7/Modules/_localemodule.c 2020-12-26 07:01:52.023610900 +0100 | |||
@@ -177,7 +177,7 @@ | |||
#define GET_LOCALE_STRING(ATTR) PyUnicode_DecodeLocale(lc->ATTR, NULL) | |||
#else /* MS_WINDOWS */ | |||
/* Use _W_* fields of Windows struct lconv */ | |||
-#define GET_LOCALE_STRING(ATTR) PyUnicode_FromWideChar(lc->_W_ ## ATTR, -1) | |||
+#define GET_LOCALE_STRING(ATTR) PyUnicode_DecodeLocale(lc->ATTR, NULL) | |||
#endif /* MS_WINDOWS */ | |||
int res = -1; | |||
@@ -249,7 +249,7 @@ | |||
#ifdef MS_WINDOWS | |||
/* Use _W_* fields of Windows struct lconv */ | |||
-#define GET_LOCALE_STRING(ATTR) PyUnicode_FromWideChar(lc->_W_ ## ATTR, -1) | |||
+#define GET_LOCALE_STRING(ATTR) PyUnicode_DecodeLocale(lc->ATTR, NULL) | |||
#else | |||
#define GET_LOCALE_STRING(ATTR) PyUnicode_DecodeLocale(lc->ATTR, NULL) | |||
#endif | |||
--- Python-3.8.7/Python/fileutils.c.orig 2020-12-21 17:25:24.000000000 +0100 | |||
+++ Python-3.8.7/Python/fileutils.c 2020-12-26 06:52:52.517357800 +0100 | |||
@@ -1975,7 +1975,7 @@ | |||
#define GET_LOCALE_STRING(ATTR) PyUnicode_DecodeLocale(lc->ATTR, NULL) | |||
#else /* MS_WINDOWS */ | |||
/* Use _W_* fields of Windows strcut lconv */ | |||
-#define GET_LOCALE_STRING(ATTR) PyUnicode_FromWideChar(lc->_W_ ## ATTR, -1) | |||
+#define GET_LOCALE_STRING(ATTR) PyUnicode_DecodeLocale(lc->ATTR, NULL) | |||
#endif /* MS_WINDOWS */ | |||
int res = -1; |
@@ -0,0 +1,14 @@ | |||
--- Python-3.8.7/setup.py.orig 2020-12-26 07:15:03.663309900 +0100 | |||
+++ Python-3.8.7/setup.py 2020-12-26 07:51:28.765752400 +0100 | |||
@@ -892,7 +892,11 @@ | |||
depends=['testcapi_long.h'])) | |||
# Python Internal C API test module | |||
+ macros = [] | |||
+ if MS_WINDOWS: | |||
+ macros.append(('PY3_DLLNAME', 'L"%s"' % sysconfig.get_config_var('DLLLIBRARY'))) | |||
self.add(Extension('_testinternalcapi', ['_testinternalcapi.c'], | |||
+ define_macros=macros, | |||
extra_compile_args=['-DPy_BUILD_CORE_MODULE'])) | |||
# Python PEP-3118 (buffer protocol) test module |
@@ -0,0 +1,115 @@ | |||
diff -Naur Python-3.8.0-orig/Modules/_winapi.c Python-3.8.0/Modules/_winapi.c | |||
--- Python-3.8.0-orig/Modules/_winapi.c 2019-10-22 10:01:51.434032500 +0300 | |||
+++ Python-3.8.0/Modules/_winapi.c 2019-10-22 10:05:34.654824500 +0300 | |||
@@ -951,7 +951,7 @@ | |||
DWORD err; | |||
BOOL result; | |||
PyObject *value; | |||
- Py_ssize_t handle_list_size; | |||
+ Py_ssize_t handle_list_size = 0; | |||
DWORD attribute_count = 0; | |||
SIZE_T attribute_list_size = 0; | |||
diff -Naur Python-3.8.0-orig/Modules/posixmodule.c Python-3.8.0/Modules/posixmodule.c | |||
--- Python-3.8.0-orig/Modules/posixmodule.c 2019-10-22 10:04:46.029539100 +0300 | |||
+++ Python-3.8.0/Modules/posixmodule.c 2019-10-22 10:05:35.076025300 +0300 | |||
@@ -4804,7 +4804,7 @@ | |||
/*[clinic end generated code: output=cfcac69d027b82cf input=2fbd62a2f228f8f4]*/ | |||
{ | |||
#ifdef MS_WINDOWS | |||
- HANDLE hFile; | |||
+ HANDLE hFile = 0; | |||
FILETIME atime, mtime; | |||
#else | |||
int result; | |||
@@ -12225,7 +12225,9 @@ | |||
int ncpu = 0; | |||
#ifdef MS_WINDOWS | |||
/* Declare prototype here to avoid pulling in all of the Win7 APIs in 3.8 */ | |||
+#if defined (_WIN32_WINNT) && (_WIN32_WINNT < 0x601) | |||
DWORD WINAPI GetActiveProcessorCount(WORD group); | |||
+#endif | |||
ncpu = GetActiveProcessorCount(ALL_PROCESSOR_GROUPS); | |||
#elif defined(__hpux) | |||
ncpu = mpctl(MPC_GETNUMSPUS, NULL, NULL); | |||
@@ -13489,7 +13491,7 @@ | |||
loaded. */ | |||
Py_BEGIN_ALLOW_THREADS | |||
if (!(hKernel32 = GetModuleHandleW(L"kernel32")) || | |||
- !(AddDllDirectory = (PAddDllDirectory)GetProcAddress( | |||
+ !(AddDllDirectory = (PAddDllDirectory)(void *)GetProcAddress( | |||
hKernel32, "AddDllDirectory")) || | |||
!(cookie = (*AddDllDirectory)(path->wide))) { | |||
err = GetLastError(); | |||
@@ -13539,7 +13541,7 @@ | |||
loaded. */ | |||
Py_BEGIN_ALLOW_THREADS | |||
if (!(hKernel32 = GetModuleHandleW(L"kernel32")) || | |||
- !(RemoveDllDirectory = (PRemoveDllDirectory)GetProcAddress( | |||
+ !(RemoveDllDirectory = (PRemoveDllDirectory)(void *)GetProcAddress( | |||
hKernel32, "RemoveDllDirectory")) || | |||
!(*RemoveDllDirectory)(cookieValue)) { | |||
err = GetLastError(); | |||
diff -Naur Python-3.8.0-orig/Modules/socketmodule.h Python-3.8.0/Modules/socketmodule.h | |||
--- Python-3.8.0-orig/Modules/socketmodule.h 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Modules/socketmodule.h 2019-10-22 10:05:35.466026000 +0300 | |||
@@ -29,8 +29,10 @@ | |||
*/ | |||
# ifdef SIO_GET_MULTICAST_FILTER | |||
# include <mstcpip.h> /* for SIO_RCVALL */ | |||
+#ifndef __MINGW32__ /* resolve by configure */ | |||
# define HAVE_ADDRINFO | |||
# define HAVE_SOCKADDR_STORAGE | |||
+#endif | |||
# define HAVE_GETADDRINFO | |||
# define HAVE_GETNAMEINFO | |||
# define ENABLE_IPV6 | |||
diff -Naur Python-3.8.0-orig/PC/python_exe.rc Python-3.8.0/PC/python_exe.rc | |||
--- Python-3.8.0-orig/PC/python_exe.rc 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/PC/python_exe.rc 2019-10-22 10:05:35.871626700 +0300 | |||
@@ -7,7 +7,7 @@ | |||
#include <winuser.h> | |||
1 RT_MANIFEST "python.manifest" | |||
-1 ICON DISCARDABLE "icons\python.ico" | |||
+1 ICON DISCARDABLE "icons/python.ico" | |||
///////////////////////////////////////////////////////////////////////////// | |||
diff -Naur Python-3.8.0-orig/PC/pythonw_exe.rc Python-3.8.0/PC/pythonw_exe.rc | |||
--- Python-3.8.0-orig/PC/pythonw_exe.rc 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/PC/pythonw_exe.rc 2019-10-22 10:05:36.277227400 +0300 | |||
@@ -7,7 +7,7 @@ | |||
#include <winuser.h> | |||
1 RT_MANIFEST "python.manifest" | |||
-1 ICON DISCARDABLE "icons\pythonw.ico" | |||
+1 ICON DISCARDABLE "icons/pythonw.ico" | |||
///////////////////////////////////////////////////////////////////////////// | |||
diff -Naur Python-3.8.0-orig/PC/winreg.c Python-3.8.0/PC/winreg.c | |||
--- Python-3.8.0-orig/PC/winreg.c 2019-10-22 10:01:02.698546800 +0300 | |||
+++ Python-3.8.0/PC/winreg.c 2019-10-22 10:05:36.682828100 +0300 | |||
@@ -800,6 +800,7 @@ | |||
case REG_BINARY: | |||
/* ALSO handle ALL unknown data types here. Even if we can't | |||
support it natively, we should handle the bits. */ | |||
+ /* fallthrough */ | |||
default: | |||
if (retDataSize == 0) { | |||
Py_INCREF(Py_None); | |||
diff -Naur Python-3.8.0-orig/Python/thread_nt.h Python-3.8.0/Python/thread_nt.h | |||
--- Python-3.8.0-orig/Python/thread_nt.h 2019-10-14 16:34:47.000000000 +0300 | |||
+++ Python-3.8.0/Python/thread_nt.h 2019-10-22 10:05:37.088428800 +0300 | |||
@@ -342,8 +342,9 @@ | |||
{ | |||
dprintf(("%lu: PyThread_release_lock(%p) called\n", PyThread_get_thread_ident(),aLock)); | |||
- if (!(aLock && LeaveNonRecursiveMutex((PNRMUTEX) aLock))) | |||
+ if (!(aLock && LeaveNonRecursiveMutex((PNRMUTEX) aLock))) { | |||
dprintf(("%lu: Could not PyThread_release_lock(%p) error: %ld\n", PyThread_get_thread_ident(), aLock, GetLastError())); | |||
+ } | |||
} | |||
/* minimum/maximum thread stack sizes supported */ |
@@ -0,0 +1,561 @@ | |||
# Maintainer: Alexey Pavlov <alexpux@gmail.com> | |||
# Maintainer: Ray Donnelly <mingw.android@gmail.com> | |||
# Contributor: Saul Ibarra Corretge <saghul@gmail.com> | |||
# Contributor: Frode Solheim <frode@fs-uae.net> | |||
# TODO :: subprocess.Popen .. specifically list2cmdline in subprocess.py | |||
# needs a fix so it can handle running MSYS2 executables better. | |||
# Arguments should not be quoted in the Windows fashion as-per: | |||
# http://www.daviddeley.com/autohotkey/parameters/parameters.htm | |||
# but instead how Cygwin expects them to be quoted. Checking for | |||
# {cygwin,msys-2.0}.dll in the executable is the only way that I | |||
# can think to do this at present. | |||
# Any double quoted string will cause problems, e.g. | |||
# -DGNOMELOCALEDIR=\"/mingw64/share/locale\" | |||
_realname=python | |||
pkgbase="mingw-w64-${_realname}" | |||
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}") | |||
_pybasever=3.8 | |||
pkgver=${_pybasever}.7 | |||
pkgrel=2 | |||
provides=("${MINGW_PACKAGE_PREFIX}-python3=${pkgver}") | |||
conflicts=("${MINGW_PACKAGE_PREFIX}-python3" | |||
"${MINGW_PACKAGE_PREFIX}-python2<2.7.16-7") | |||
replaces=("${MINGW_PACKAGE_PREFIX}-python3") | |||
pkgdesc="A high-level scripting language (mingw-w64)" | |||
arch=('any') | |||
license=('PSF') | |||
url="https://www.python.org/" | |||
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs" | |||
"${MINGW_PACKAGE_PREFIX}-expat" | |||
"${MINGW_PACKAGE_PREFIX}-bzip2" | |||
"${MINGW_PACKAGE_PREFIX}-libffi" | |||
"${MINGW_PACKAGE_PREFIX}-mpdecimal" | |||
"${MINGW_PACKAGE_PREFIX}-ncurses" | |||
"${MINGW_PACKAGE_PREFIX}-openssl" | |||
"${MINGW_PACKAGE_PREFIX}-sqlite3" | |||
"${MINGW_PACKAGE_PREFIX}-tcl" | |||
"${MINGW_PACKAGE_PREFIX}-tk" | |||
"${MINGW_PACKAGE_PREFIX}-zlib" | |||
"${MINGW_PACKAGE_PREFIX}-xz") | |||
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config") | |||
options=('makeflags') # 'debug' '!strip' ) | |||
source=("https://www.python.org/ftp/python/${pkgver%rc?}/Python-${pkgver}.tar.xz" | |||
0000-make-_sysconfigdata.py-relocatable.patch | |||
0001-fix-_nt_quote_args-using-subprocess-list2cmdline.patch | |||
0002-restore-setup-config.patch | |||
0100-MINGW-BASE-use-NT-thread-model.patch | |||
0110-MINGW-translate-gcc-internal-defines-to-python-platf.patch | |||
0130-MINGW-configure-MACHDEP-and-platform-for-build.patch | |||
0140-MINGW-preset-configure-defaults.patch | |||
0150-MINGW-configure-largefile-support-for-windows-builds.patch | |||
0170-MINGW-add-srcdir-PC-to-CPPFLAGS.patch | |||
0180-MINGW-init-system-calls.patch | |||
0200-MINGW-build-in-windows-modules-winreg.patch | |||
0210-MINGW-determine-if-pwdmodule-should-be-used.patch | |||
0250-MINGW-compiler-customize-mingw-cygwin-compilers.patch | |||
0260-MINGW-compiler-enable-new-dtags.patch | |||
0290-issue6672-v2-Add-Mingw-recognition-to-pyport.h-to-al.patch | |||
0300-MINGW-configure-for-shared-build.patch | |||
0310-MINGW-dynamic-loading-support.patch | |||
0330-MINGW-ignore-main-program-for-frozen-scripts.patch | |||
0350-MINGW-setup-_multiprocessing-module.patch | |||
0360-MINGW-setup-select-module.patch | |||
0370-MINGW-setup-_ctypes-module-with-system-libffi.patch | |||
0380-MINGW-defect-winsock2-and-setup-_socket-module.patch | |||
0390-MINGW-exclude-unix-only-modules.patch | |||
0400-MINGW-setup-msvcrt-and-_winapi-modules.patch | |||
0410-MINGW-build-extensions-with-GCC.patch | |||
0420-MINGW-use-Mingw32CCompiler-as-default-compiler-for-m.patch | |||
0430-MINGW-find-import-library.patch | |||
0440-MINGW-setup-_ssl-module.patch | |||
0460-MINGW-generalization-of-posix-build-in-sysconfig.py.patch | |||
0462-MINGW-support-stdcall-without-underscore.patch | |||
0464-use-replace-instead-rename-to-avoid-failure-on-windo.patch | |||
0470-MINGW-avoid-circular-dependency-from-time-module-dur.patch | |||
0480-MINGW-generalization-of-posix-build-in-distutils-sys.patch | |||
0490-MINGW-customize-site.patch | |||
0500-add-python-config-sh.patch | |||
0510-cross-darwin-feature.patch | |||
0520-py3k-mingw-ntthreads-vs-pthreads.patch | |||
0530-mingw-system-libffi.patch | |||
0555-msys-mingw-prefer-unix-sep-if-MSYSTEM.patch | |||
0560-mingw-use-posix-getpath.patch | |||
0565-mingw-add-ModuleFileName-dir-to-PATH.patch | |||
0570-mingw-add-BUILDIN_WIN32_MODULEs-time-msvcrt.patch | |||
0610-msys-cygwin-semi-native-build-sysconfig.patch | |||
0620-mingw-sysconfig-like-posix.patch | |||
0630-mingw-_winapi_as_builtin_for_Popen_in_cygwinccompiler.patch | |||
0640-mingw-x86_64-size_t-format-specifier-pid_t.patch | |||
0650-cross-dont-add-multiarch-paths-if-cross-compiling.patch | |||
0660-mingw-use-backslashes-in-compileall-py.patch | |||
0670-msys-convert_path-fix-and-root-hack.patch | |||
0690-allow-static-tcltk.patch | |||
0720-mingw-pdcurses_ISPAD.patch | |||
0740-grammar-fixes.patch | |||
0750-builddir-fixes.patch | |||
0760-msys-monkeypatch-os-system-via-sh-exe.patch | |||
0770-msys-replace-slashes-used-in-io-redirection.patch | |||
0800-mingw-install-layout-as-posix.patch | |||
0810-remove_path_max.default.patch | |||
0820-dont-link-with-gettext.patch | |||
0830-ctypes-python-dll.patch | |||
0840-gdbm-module-includes.patch | |||
0850-use-gnu_printf-in-format.patch | |||
0870-mingw-fix-ssl-dont-use-enum_certificates.patch | |||
0890-mingw-build-optimized-ext.patch | |||
0900-cygwinccompiler-dont-strip-modules-if-pydebug.patch | |||
0910-fix-using-dllhandle-and-winver-mingw.patch | |||
0920-mingw-add-LIBPL-to-library-dirs.patch | |||
0970-Add-AMD64-to-sys-config-so-msvccompiler-get_build_version-works.patch | |||
0990-MINGW-link-with-additional-library.patch | |||
1010-install-msilib.patch | |||
1060-dont-include-system-ncurses-path.patch | |||
1620-fix-signal-module-build.patch | |||
1630-build-winconsoleio.patch | |||
1650-expose-sem_unlink.patch | |||
1700-cygpty-isatty.patch | |||
1701-disable-broken-gdbm-module.patch | |||
1702-default-to-console-cp-for-cygpty.patch | |||
1800-link-win-resource-files-and-build-pythonw.patch | |||
1810-3.7-mpdec-mingw.patch | |||
1850-disable-readline.patch | |||
1860-fix-isselectable.patch | |||
1870-use-_wcsnicmp-instead-wcsncasecmp.patch | |||
1890-_xxsubinterpretersmodule.patch | |||
2010-configure-have-inet-pton.patch | |||
2030-fix-msvc9-import.patch | |||
2051-set-venv-activate-path-unix.patch | |||
2052-venv-creation-fixes.patch | |||
2060-pass-gen-profile-ldflags.patch | |||
2070-distutils-add-windmc-to-cygwinccompiler.patch | |||
2080-pkg-config-windows-must-link-ext-with-python-lib.patch | |||
3000-importlib-bootstrap-path-sep.patch | |||
3001-pathlib-path-sep.patch | |||
3010-workaround-missing-lconv-members-mingw.patch | |||
3011-fix-build-testinternalcapi.patch | |||
5000-warnings-fixes.patch | |||
smoketests.py) | |||
# Helper macros to help make tasks easier # | |||
apply_patch_with_msg() { | |||
for _patch in "$@" | |||
do | |||
msg2 "Applying ${_patch}" | |||
patch -Nbp1 -i "${srcdir}/${_patch}" | |||
done | |||
} | |||
del_file_exists() { | |||
for _fname in "$@" | |||
do | |||
if [ -f ${_fname} ]; then | |||
rm -rf ${_fname} | |||
fi | |||
done | |||
} | |||
# =========================================== # | |||
prepare() { | |||
cd "${srcdir}/Python-${pkgver}" | |||
plain "Apply Ray Donnelly's should-be-upstreamed patches" | |||
apply_patch_with_msg \ | |||
0000-make-_sysconfigdata.py-relocatable.patch \ | |||
0001-fix-_nt_quote_args-using-subprocess-list2cmdline.patch \ | |||
0002-restore-setup-config.patch | |||
plain "Apply Roumen Petrov's core patches (10)" | |||
apply_patch_with_msg \ | |||
0100-MINGW-BASE-use-NT-thread-model.patch \ | |||
0110-MINGW-translate-gcc-internal-defines-to-python-platf.patch \ | |||
0130-MINGW-configure-MACHDEP-and-platform-for-build.patch \ | |||
0140-MINGW-preset-configure-defaults.patch \ | |||
0150-MINGW-configure-largefile-support-for-windows-builds.patch \ | |||
0170-MINGW-add-srcdir-PC-to-CPPFLAGS.patch \ | |||
0180-MINGW-init-system-calls.patch \ | |||
0200-MINGW-build-in-windows-modules-winreg.patch \ | |||
0210-MINGW-determine-if-pwdmodule-should-be-used.patch | |||
plain "Apply Roumen Petrov's compiler patch (2)" | |||
apply_patch_with_msg \ | |||
0250-MINGW-compiler-customize-mingw-cygwin-compilers.patch \ | |||
0260-MINGW-compiler-enable-new-dtags.patch | |||
plain "Apply Roumen Petrov's extensions patches (21)" | |||
apply_patch_with_msg \ | |||
0290-issue6672-v2-Add-Mingw-recognition-to-pyport.h-to-al.patch \ | |||
0300-MINGW-configure-for-shared-build.patch \ | |||
0310-MINGW-dynamic-loading-support.patch \ | |||
0330-MINGW-ignore-main-program-for-frozen-scripts.patch \ | |||
0350-MINGW-setup-_multiprocessing-module.patch \ | |||
0360-MINGW-setup-select-module.patch \ | |||
0370-MINGW-setup-_ctypes-module-with-system-libffi.patch \ | |||
0380-MINGW-defect-winsock2-and-setup-_socket-module.patch \ | |||
0390-MINGW-exclude-unix-only-modules.patch \ | |||
0400-MINGW-setup-msvcrt-and-_winapi-modules.patch \ | |||
0410-MINGW-build-extensions-with-GCC.patch \ | |||
0420-MINGW-use-Mingw32CCompiler-as-default-compiler-for-m.patch \ | |||
0430-MINGW-find-import-library.patch \ | |||
0440-MINGW-setup-_ssl-module.patch \ | |||
0460-MINGW-generalization-of-posix-build-in-sysconfig.py.patch \ | |||
0462-MINGW-support-stdcall-without-underscore.patch \ | |||
0464-use-replace-instead-rename-to-avoid-failure-on-windo.patch \ | |||
0470-MINGW-avoid-circular-dependency-from-time-module-dur.patch \ | |||
0480-MINGW-generalization-of-posix-build-in-distutils-sys.patch \ | |||
0490-MINGW-customize-site.patch | |||
plain "Apply Ray Donnelly's general/cross patches (42)" | |||
apply_patch_with_msg \ | |||
0500-add-python-config-sh.patch \ | |||
0510-cross-darwin-feature.patch \ | |||
0520-py3k-mingw-ntthreads-vs-pthreads.patch \ | |||
0530-mingw-system-libffi.patch \ | |||
0555-msys-mingw-prefer-unix-sep-if-MSYSTEM.patch \ | |||
0560-mingw-use-posix-getpath.patch \ | |||
0565-mingw-add-ModuleFileName-dir-to-PATH.patch \ | |||
0570-mingw-add-BUILDIN_WIN32_MODULEs-time-msvcrt.patch | |||
apply_patch_with_msg \ | |||
0610-msys-cygwin-semi-native-build-sysconfig.patch \ | |||
0620-mingw-sysconfig-like-posix.patch \ | |||
0630-mingw-_winapi_as_builtin_for_Popen_in_cygwinccompiler.patch \ | |||
0640-mingw-x86_64-size_t-format-specifier-pid_t.patch \ | |||
0650-cross-dont-add-multiarch-paths-if-cross-compiling.patch \ | |||
0660-mingw-use-backslashes-in-compileall-py.patch \ | |||
0670-msys-convert_path-fix-and-root-hack.patch \ | |||
0690-allow-static-tcltk.patch | |||
apply_patch_with_msg \ | |||
0720-mingw-pdcurses_ISPAD.patch \ | |||
0740-grammar-fixes.patch \ | |||
0750-builddir-fixes.patch \ | |||
0760-msys-monkeypatch-os-system-via-sh-exe.patch \ | |||
0770-msys-replace-slashes-used-in-io-redirection.patch \ | |||
0800-mingw-install-layout-as-posix.patch \ | |||
0810-remove_path_max.default.patch \ | |||
0820-dont-link-with-gettext.patch \ | |||
0830-ctypes-python-dll.patch \ | |||
0840-gdbm-module-includes.patch \ | |||
0850-use-gnu_printf-in-format.patch \ | |||
0870-mingw-fix-ssl-dont-use-enum_certificates.patch \ | |||
0890-mingw-build-optimized-ext.patch \ | |||
0900-cygwinccompiler-dont-strip-modules-if-pydebug.patch \ | |||
0910-fix-using-dllhandle-and-winver-mingw.patch \ | |||
0920-mingw-add-LIBPL-to-library-dirs.patch \ | |||
0970-Add-AMD64-to-sys-config-so-msvccompiler-get_build_version-works.patch \ | |||
0990-MINGW-link-with-additional-library.patch \ | |||
1010-install-msilib.patch \ | |||
1060-dont-include-system-ncurses-path.patch | |||
plain "New patches added for the update from 3.5.3 to 3.6.1" | |||
apply_patch_with_msg \ | |||
1620-fix-signal-module-build.patch \ | |||
1630-build-winconsoleio.patch \ | |||
1650-expose-sem_unlink.patch | |||
# Extend some isatty calls to check for mintty when checking for | |||
# a terminal output. And default stdout/in to the console CP for cygpty | |||
# (once we have conpty this can be removed) | |||
# https://github.com/Alexpux/MINGW-packages/issues/2645 | |||
# https://github.com/Alexpux/MINGW-packages/issues/2656 | |||
apply_patch_with_msg \ | |||
1700-cygpty-isatty.patch \ | |||
1702-default-to-console-cp-for-cygpty.patch | |||
# gdbm is broken and as a result breaks dbm/shelve. | |||
# Don't include it so the dbm.dumb backend is used instead, | |||
# like with the official CPython build. | |||
apply_patch_with_msg \ | |||
1701-disable-broken-gdbm-module.patch | |||
# https://github.com/Alexpux/MINGW-packages/issues/3139 | |||
apply_patch_with_msg \ | |||
1800-link-win-resource-files-and-build-pythonw.patch | |||
apply_patch_with_msg \ | |||
1810-3.7-mpdec-mingw.patch \ | |||
1850-disable-readline.patch \ | |||
1860-fix-isselectable.patch \ | |||
1870-use-_wcsnicmp-instead-wcsncasecmp.patch \ | |||
1890-_xxsubinterpretersmodule.patch | |||
# https://github.com/msys2/MINGW-packages/issues/5184 | |||
apply_patch_with_msg 2010-configure-have-inet-pton.patch | |||
# https://github.com/msys2/MINGW-packages/issues/5155 | |||
apply_patch_with_msg 2030-fix-msvc9-import.patch | |||
# https://github.com/msys2/MINGW-packages/issues/5001 | |||
apply_patch_with_msg 2051-set-venv-activate-path-unix.patch | |||
apply_patch_with_msg 2052-venv-creation-fixes.patch | |||
apply_patch_with_msg 2060-pass-gen-profile-ldflags.patch | |||
apply_patch_with_msg 2070-distutils-add-windmc-to-cygwinccompiler.patch | |||
apply_patch_with_msg 2080-pkg-config-windows-must-link-ext-with-python-lib.patch | |||
# https://github.com/msys2/MINGW-packages/issues/6035 | |||
apply_patch_with_msg 3000-importlib-bootstrap-path-sep.patch | |||
apply_patch_with_msg 3001-pathlib-path-sep.patch | |||
apply_patch_with_msg 5000-warnings-fixes.patch | |||
# https://sourceforge.net/p/mingw-w64/bugs/870/ | |||
# This can be skipped with a newer msvcrt | |||
apply_patch_with_msg 3010-workaround-missing-lconv-members-mingw.patch | |||
apply_patch_with_msg 3011-fix-build-testinternalcapi.patch | |||
autoreconf -vfi | |||
} | |||
check() { | |||
cd "${srcdir}/build-${CARCH}" | |||
# Some basic tests to ensure nothing major or MSYS2 specific features are | |||
# broken | |||
./python.exe "${srcdir}/smoketests.py" | |||
MSYSTEM= ./python.exe "${srcdir}/smoketests.py" | |||
# make test EXTRATESTOPTS="-v" | |||
} | |||
build() { | |||
local PREFIX_WIN=$(cygpath -wm ${MINGW_PREFIX}) | |||
CFLAGS+=" -fwrapv -D__USE_MINGW_ANSI_STDIO=1 -D_WIN32_WINNT=0x0601" | |||
CXXFLAGS+=" -fwrapv -D__USE_MINGW_ANSI_STDIO=1 -D_WIN32_WINNT=0x0601" | |||
CPPFLAGS+=" -I${PREFIX_WIN}/include/ncurses " | |||
declare -a _extra_config | |||
if check_option "strip" "y"; then | |||
LDFLAGS+=" -s " | |||
fi | |||
if check_option "debug" "n"; then | |||
CFLAGS+=" -DNDEBUG " | |||
CXXFLAGS+=" -DNDEBUG " | |||
_extra_config+=("--enable-optimizations") | |||
_extra_config+=("--with-lto") | |||
else | |||
CFLAGS+=" -O0 -ggdb" | |||
CXXFLAGS+=" -O0 -ggdb" | |||
_extra_config+=("--with-pydebug") | |||
fi | |||
# Workaround for conftest error on 64-bit builds | |||
export ac_cv_working_tzset=no | |||
# Workaround for when dlfcn exists on Windows, which causes | |||
# some conftests to succeed when they shouldn't (we don't use dlfcn). | |||
export ac_cv_header_dlfcn_h=no | |||
export ac_cv_lib_dl_dlopen=no | |||
export ac_cv_have_decl_RTLD_GLOBAL=no | |||
export ac_cv_have_decl_RTLD_LAZY=no | |||
export ac_cv_have_decl_RTLD_LOCAL=no | |||
export ac_cv_have_decl_RTLD_NOW=no | |||
export ac_cv_have_decl_RTLD_DEEPBIND=no | |||
export ac_cv_have_decl_RTLD_MEMBER=no | |||
export ac_cv_have_decl_RTLD_NODELETE=no | |||
export ac_cv_have_decl_RTLD_NOLOAD=no | |||
[[ -d "${srcdir}/build-${CARCH}" ]] && rm -rf "${srcdir}/build-${CARCH}" | |||
mkdir -p "${srcdir}/build-${CARCH}" && cd "${srcdir}/build-${CARCH}" | |||
MSYSTEM=MINGW ../Python-${pkgver}/configure \ | |||
--prefix=${MINGW_PREFIX} \ | |||
--host=${MINGW_CHOST} \ | |||
--build=${MINGW_CHOST} \ | |||
--enable-shared \ | |||
--with-nt-threads \ | |||
--with-system-expat \ | |||
--with-system-ffi \ | |||
--with-system-libmpdec \ | |||
--without-ensurepip \ | |||
--without-c-locale-coercion \ | |||
--enable-loadable-sqlite-extensions \ | |||
"${_extra_config[@]}" \ | |||
OPT="" | |||
# We patch importlib which is embedded in C headers, so regenerate them | |||
make regen-importlib | |||
make | |||
# Add missing venvlauncher files (issue #7014) | |||
# FIXME: build these from PC/launcher.c instead | |||
cp python.exe venvlauncher.exe | |||
cp pythonw.exe venvwlauncher.exe | |||
} | |||
package() { | |||
cd "${srcdir}/build-${CARCH}" | |||
local PREFIX_WIN=$(cygpath -wm ${MINGW_PREFIX}) | |||
MSYSTEM=MINGW \ | |||
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \ | |||
make -j1 install DESTDIR="${pkgdir}" | |||
if check_option "debug" "n"; then | |||
VERABI=${_pybasever} | |||
else | |||
VERABI=${_pybasever}d | |||
fi | |||
# gdb pretty printers for debugging Python itself; to use: | |||
# python | |||
# sys.path.append('C:/msys64/mingw64/share/gdb/python3') | |||
# import python_gdb | |||
# reload(python_gdb) | |||
# end | |||
[[ -d "${pkgdir}${MINGW_PREFIX}"/share/gdb/python3/ ]] || mkdir -p "${pkgdir}${MINGW_PREFIX}"/share/gdb/python3/ | |||
cp -f python.exe-gdb.py "${pkgdir}${MINGW_PREFIX}"/share/gdb/python3/python_gdb.py | |||
rm "${pkgdir}${MINGW_PREFIX}"/bin/2to3 | |||
cp -f "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/config-${VERABI}/libpython${VERABI}.dll.a "${pkgdir}${MINGW_PREFIX}"/lib/libpython${VERABI}.dll.a | |||
# Need for building boost python module | |||
cp -f "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/config-${VERABI}/libpython${VERABI}.dll.a "${pkgdir}${MINGW_PREFIX}"/lib/libpython${_pybasever}.dll.a | |||
# some useful "stuff" | |||
install -dm755 "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/Tools/{i18n,scripts} | |||
install -m755 "${srcdir}/Python-${pkgver}"/Tools/i18n/{msgfmt,pygettext}.py "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/Tools/i18n/ | |||
install -m755 "${srcdir}/Python-${pkgver}"/Tools/scripts/{README,*py} "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/Tools/scripts/ | |||
# clean up #!s | |||
find "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/ -name '*.py' | \ | |||
xargs sed -i "s|#[ ]*![ ]*/usr/bin/env python$|#!/usr/bin/env python|" | |||
# clean-up reference to build directory | |||
sed -i "s#${srcdir}/Python-${pkgver}:##" "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/config-${VERABI}/Makefile | |||
for fscripts in 2to3-${_pybasever} idle3 idle${_pybasever} pydoc3 pydoc${_pybasever}; do | |||
sed -i "s|$(cygpath -w ${MINGW_PREFIX} | sed 's|\\|\\\\|g')/bin/python${_pybasever}.exe|/usr/bin/env python${_pybasever}.exe|g" "${pkgdir}${MINGW_PREFIX}"/bin/${fscripts} | |||
done | |||
# Default names are aliases for Python now | |||
cp "${pkgdir}${MINGW_PREFIX}"/bin/python3.exe "${pkgdir}${MINGW_PREFIX}"/bin/python.exe | |||
cp "${pkgdir}${MINGW_PREFIX}"/bin/python3w.exe "${pkgdir}${MINGW_PREFIX}"/bin/pythonw.exe | |||
cp "${pkgdir}${MINGW_PREFIX}"/bin/python3-config "${pkgdir}${MINGW_PREFIX}"/bin/python-config | |||
cp "${pkgdir}${MINGW_PREFIX}"/bin/idle3 "${pkgdir}${MINGW_PREFIX}"/bin/idle | |||
cp "${pkgdir}${MINGW_PREFIX}"/bin/pydoc3 "${pkgdir}${MINGW_PREFIX}"/bin/pydoc | |||
cp "${pkgdir}${MINGW_PREFIX}"/bin/2to3-${_pybasever} "${pkgdir}${MINGW_PREFIX}"/bin/2to3 | |||
sed -i "s|#!${pkgdir}${MINGW_PREFIX}/bin/python${VERABI}.exe|#!/usr/bin/env python${_pybasever}.exe|" "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/config-${VERABI}/python-config.py | |||
# fix permissons | |||
find ${pkgdir}${MINGW_PREFIX} -type f \( -name "*.dll" -o -name "*.exe" \) | xargs chmod 0755 | |||
# Fix up two instances of MSYS2 paths in python-config.sh in-case the final consumer of the results are native executables. | |||
sed -e "s|${MINGW_PREFIX}|${PREFIX_WIN}|" \ | |||
-i "${pkgdir}${MINGW_PREFIX}"/bin/python${VERABI}-config \ | |||
-i "${pkgdir}${MINGW_PREFIX}"/bin/python3-config \ | |||
-i "${pkgdir}${MINGW_PREFIX}"/bin/python-config | |||
# replace paths in sysconfig | |||
sed -i "s|${pkgdir}${MINGW_PREFIX}|${MINGW_PREFIX}|g" \ | |||
"${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/lib-dynload/_sysconfigdata*.py \ | |||
"${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/smtpd.py | |||
# install venv launchers | |||
mkdir -p "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/venv/scripts/nt | |||
cp venvlauncher.exe "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/venv/scripts/nt/python.exe | |||
cp venvwlauncher.exe "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/venv/scripts/nt/pythonw.exe | |||
} | |||
sha256sums=('ddcc1df16bb5b87aa42ec5d20a5b902f2d088caa269b28e01590f97a798ec50a' | |||
'0ee1acf745d38d41fd098487b9595705fd8f6666d7b154d54ddba32d14f1253b' | |||
'0d27f52bc514dbf2b730f62fa6c18c797a2f4cbad8698d95b15e2774d68e483d' | |||
'd2d73d9fb9db48fecb3a6856e4606f444eaac7637fd4f65e192701e53ac422eb' | |||
'abed03b63e0b498804b44d1cdf8b1ff0c3c4329d3ea9c0323b2512adcacb9b57' | |||
'c2fb01aacfc5d96bdb69ef37282f300ecd8bfa3e11921caa1fce8e871f5a31f8' | |||
'6446e0a5255d317d93c5c55094d4c797cf68fbd14bb08d38c94d7080837d1380' | |||
'8e90c38ac27316781f8853fcbce300526d92732edf4cd08d1dc2a0438fd2d694' | |||
'36f6e8b4320ee79b6ff7e84aefec3aec57293bcbacf08ea7847f3147d459b4a9' | |||
'0a6a1ee72f3aa050f1ff0b8ff88845189309163ef1a5f70808f1ab351348cdae' | |||
'56bdf305a3786ae50871045373e89f2e20df3055e1033197f122ee2c6c8b0966' | |||
'910c84eb01cfe2207ee7fd8549247d9498be8b58c4dbbb6eaa2118037e77730e' | |||
'da5057e58a4866e20c3c604153febb2b57a089d327a954ee5b51830af8204e17' | |||
'265a3c99923b76210e0401bc0cafa88b99328343aec43d64aa94cb84fcdda6d8' | |||
'4f1db216d6a2dad137b07ccdd4b2d71c37169083706addf90c3b0b850312632a' | |||
'f07fc8cc9030c2adf9d7c301eadb8b182aad7f1f2cde102cce730f51a093bbdd' | |||
'9f05613753a8b4ad8c5a6b32c257a318e9ff416345f4ebef3e69f56cf9a51578' | |||
'9269a4d4dab6a0e93b8a0b5ed84c3e93bdfbaf99148e467daf993f6f767c8d45' | |||
'1e89597d37838ad7c18463b83476b3cc6bec1480a052e757b9fbfb3264d4d890' | |||
'03891c0fe4ad90a9926c0e04dc7bb0efbf0022cd6d7746cf2d173dbd739f6142' | |||
'3b85b18922d21e8fc6e07a12e1c8d79c7ec271dddb75ed0fb4f44148b030b360' | |||
'6d0119cd216b944927254598cfec1b85757000ab39f5ba987a86ed2216d6351b' | |||
'ee3f515a3e4060b08b106d788039aa0abfb0424fdf09b613dbab06256405b7ef' | |||
'9c6e64ba27d72e912be3486a0cc65d9f59f5d7ba71fb634fef0860a00311d12c' | |||
'3842234d2c3aeece0416a670c789801ef76ce31841a9c1bfcbb26340aa346712' | |||
'194ef359356d4d58bb15bafe8738c0586350d26e85cc39f5db833f428d67b41d' | |||
'ce63ec2ec57db5fcfae332f8bb413d6c2f8888d29e449b8ae674cbcbe01a5f95' | |||
'f7729d39c8eadce379b2b21cd253c604bfe3e4293945b4d6def9bf0c9b3c8f4f' | |||
'be165a89d087dcc1d06b78031d441e7dd1f5d5c2a0a73de49c4c9e211132b97a' | |||
'85ec670b8c0a8fc7a5dcafc19aa697d358c5bfe67cb3d7e17ec8070d4edb16f3' | |||
'4804d854bb9fb3e6ff11c23e420b6ff34266bbc93ce33115129bf838171d49ee' | |||
'a26997445938dd01a03a16a622d19adbc270e679df195407436c97246c96f99a' | |||
'269fc7d93aeefc286009612604385ac2ec1d0304b97c858ffe123c282be8d94c' | |||
'17341d1d4f654f8fbaea905dcf0f4091c66eefa6725b592632413fc77498b6c3' | |||
'47613ba1b262d7c3dbe96ecff5543d0923ad874eec7aa7451e17b0b414691f83' | |||
'1b3a27ea33b66efe3131dcb9951030aa7d4c18f9ec851e89a4582b69f8e673e7' | |||
'90719b6f11be4be6e6df37a9699d87da9f5200090baf0276f0d6aeb717b9e06c' | |||
'840cbf8fafa2cc230dd8a9f667dbad80d54ad573f929f9970252722b9183688b' | |||
'fbae2e8121a027713ce9cf2197b4d702f512e65d028a2a71d4229a4c70f8410d' | |||
'95cf0d30ad7f0f171da79187f1564b8b2796e9d76551cfb442c26ae4d9f1aafe' | |||
'6b37b7d4ecd269abcf92ada988d4be48e0fee1473d6a2cc7d6562812c579095d' | |||
'4bb617a956b783edfb1a4246580172c4f9eb2728ff14730618854a3be7840dad' | |||
'65aff7e831f3bb4b37ed5d4db5dfa75ab6bd582d132dd197e658ccb699dbfac7' | |||
'f2a7b6dce11311e3d318d5729258935a520dcb7ce4dc879ecb1738a2f8bfe434' | |||
'0a81aa7fd5fa0b511fda81ce3345f3199d3be1c83fc660f7f365ef4ede88f3f7' | |||
'27122f9db1be8b1efbccd6ab263313aa66c97dfcd0acb9499434a1fa4ecbb2bd' | |||
'0c93d28bec11968da47b300fe8049d7e32c07c27ccde36ce5f1701306f3cbaf5' | |||
'cef46c7e1afcaf9b6bacf723d5ae22f3f42045eb93bbd9bf5d2b1dba7638028a' | |||
'819bd305734a8fe190afdd399e6158c041c5b9912b436375b2d8dc520f7376ba' | |||
'f33d70071a232a2a3930aa0a2b3f032ef6a17e07acc7412000ceb25bdd339ade' | |||
'5c56aa13fd3f18bd4b327d8cd540ff7fd9e0145e6358d6330103938655d3dfd7' | |||
'ca3eea7fac20d160d9aa3a8e17c0b9ab169cfe16a685f78d2c4d1fd52f8f6784' | |||
'7f2b4c0fcf4a78b983ae3c3a57c47748470370aa4bf17ea9b3ad53802d201afd' | |||
'a55bd3b222d08dc6bb68d4e30ec3e544b303d93330131a310f3a2e20ca93f4b9' | |||
'2b4e223aed8ec9df431806c54bd3df923dbd34805e311006aba3f62682eeca56' | |||
'882d3ac8739184368a30991843db8581e3fd1aee639ddc110ac8cd9e8a89ea1f' | |||
'5d1a85e93b4c7626aa2cfa68201c2d93574647ab6ef0679d3ff4b4cc5c2ba042' | |||
'd06065357943599d515b7ea081da99981b68c4c6a9a5e6bb5e0f1019fea80104' | |||
'b323e44874873591b763b1926cac00d354323d32ff06941eefa415dbdb643cfb' | |||
'26fe3548c0e3997aa09077a5f4d1b4152c98c6c6e7ed64e26557704cc4758f73' | |||
'2b33a669fc281b69d6d3683402ea8d83a86f6bf625a14944d0ac553f414688d3' | |||
'86223efa8b47df1aec5bdecbe5321b29cfbba46e49bf268cf2d646423d8990c2' | |||
'd817ee8eeb04450de6c313db4cde76cca92236e14b60fb0fdb30014250b76fdb' | |||
'a8d7416f819963fb7d2e6800d51d27f5fdc74d804d2b559528eb6867c9e3b88a' | |||
'a492d1366f130122e4e54bee722b65a3d8a2afb30768026e2922edec0d11c9e4' | |||
'16ab24a074e2e06e6cee4bc06373b2b71e5d7990b71f60fa613a6e9bf55d6c12' | |||
'3245dc7c2e65e15c981b5a9c6372210dae582e7c7dfee632ec92a40868f3a63b' | |||
'168172f22ea13879b958179fee20d0b2d78136bc755501f108840a14a0b521f6' | |||
'5f6de8a7646cf755df9f8666346dbcff1005b5165b7b9aea75921344b3eceee6' | |||
'84d2457f89057d1f4c48cfe85a1fe4f397eaa6a4f2dd0bad36beccf9dfdb5819' | |||
'8fe0d9cb7b36faa27d2bb41661f4f9ea0298901d261c5daf702e29e97e46bd4c' | |||
'7e2652a26a8e7198b9b6fd2bfd476c514362f347ba75b1dd014faac443266fd7' | |||
'8ea5b335b10bfb4e492646902db043aee06c953941b3eca7fe24603a3238abf8' | |||
'a9977459a8e6c31f1643da7ede6ac7199dee96559d74188f5c9d3799787ac4fa' | |||
'7bab1dfb1d5b288e3270a61f9b1892c151f1dd1f8e32c07ae6adc37ef14844bb' | |||
'551047905350e113384f99e0e929e9381dc0a4ed514ca4ebe279dcdad798edce' | |||
'5e1ce61087a5f4acbd45cd7afca45744fa7df44b906eaf155dc519f870203360' | |||
'1da319664d39427156488b9b39ff39e33c53ef608f66319fdf9fb9bcdb29020d' | |||
'fc6164a90f0ca2a9341aaf4448b4334c3393459ca5cbad6d7149f8bcf70da5fe' | |||
'181672743d9e2449064a1b18764fa400af5d3cd268098e7b7e5069d0b128caa2' | |||
'6f2032347bb40e2ebe9b3a03062147ffa2f656d47c87821623c3b7d46dc15ddb' | |||
'c4670070e546317295071350872e1a00918fd3284609620f84beb44ed54c1ebd' | |||
'17bf1ea04f476ee66555bc4386ffbebfe6be6f75e67947b7f85511241ac46407' | |||
'0ded9e2792b95902d898aba91020103875f2987a9566b353f3e6988b08848f4a' | |||
'd3a0669c83e4df5d33606b4c3443d2c6c71b76cb4f6421d6d54ee630023be6c2' | |||
'a7fbf65a86889f95138360ca4dbd4e51de2e214384ee39740d9c6c381ff997d9' | |||
'ac0400fd7c9ceada1356fe4b7eae3892f35652f09f488b31fd011e0642d373a3' | |||
'6f1a48380445406709ba5c6b4b9c6f0301ea645324feb429f3719dc29b8f28ff' | |||
'b2f4083ada35c18876edf38220d84ca757cf710bc5c2d80ee8b5083dc6c2609f' | |||
'487c92837717975ad6c63fe2a1f8e8c5c9e0554e96000102d83c82f4a77fd9bd' | |||
'f6ecf2edc9468210111d77e396853af49cb8a43d9bc0d20212f88cf2bc33685d' | |||
'6efc39323d14239f2a55576a8b3f32cb79eeefdd5881ba813493c14be2939f3c' | |||
'd7bbac08482c68d7c45afb5ab7b76832e93ab0490524238eae5886535f35cb4a' | |||
'005381222cfef42ccc21151845b6d43d25c861f35c2192e5e23c2a14df7938f0' | |||
'24151631c3e70306ae92ffb8fea38992a752cd0a76771a5e53445f56c2be1f00' | |||
'589ad07c257aba8296df4de7f181a91bd498615f02ce5bc85231535cd25ebf3f') |
@@ -0,0 +1,128 @@ | |||
#!/usr/bin/env python3 | |||
# Copyright 2017 Christoph Reiter | |||
# | |||
# Permission is hereby granted, free of charge, to any person obtaining | |||
# a copy of this software and associated documentation files (the | |||
# "Software"), to deal in the Software without restriction, including | |||
# without limitation the rights to use, copy, modify, merge, publish, | |||
# distribute, sublicense, and/or sell copies of the Software, and to | |||
# permit persons to whom the Software is furnished to do so, subject to | |||
# the following conditions: | |||
# | |||
# The above copyright notice and this permission notice shall be included | |||
# in all copies or substantial portions of the Software. | |||
# | |||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |||
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | |||
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |||
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |||
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
"""The goal of this test suite is collect tests for update regressions | |||
and to test msys2 related modifications like for path handling. | |||
Feel free to extend. | |||
""" | |||
import os | |||
import unittest | |||
if "MSYSTEM" in os.environ: | |||
SEP = "/" | |||
else: | |||
SEP = "\\" | |||
class Tests(unittest.TestCase): | |||
def test_sep(self): | |||
self.assertEqual(os.sep, SEP) | |||
def test_module_file_path(self): | |||
import asyncio | |||
import zlib | |||
self.assertEqual(zlib.__file__, os.path.normpath(zlib.__file__)) | |||
self.assertEqual(asyncio.__file__, os.path.normpath(asyncio.__file__)) | |||
def test_importlib_frozen_path_sep(self): | |||
import importlib._bootstrap_external | |||
self.assertEqual(importlib._bootstrap_external.path_sep, SEP) | |||
def test_os_commonpath(self): | |||
self.assertEqual( | |||
os.path.commonpath( | |||
[os.path.join("C:", os.sep, "foo", "bar"), | |||
os.path.join("C:", os.sep, "foo")]), | |||
os.path.join("C:", os.sep, "foo")) | |||
def test_pathlib(self): | |||
import pathlib | |||
p = pathlib.Path("foo") / pathlib.Path("foo") | |||
self.assertEqual(str(p), os.path.normpath(p)) | |||
def test_modules_import(self): | |||
import sqlite3 | |||
import ssl | |||
import ctypes | |||
def test_socket_inet_ntop(self): | |||
import socket | |||
self.assertTrue(hasattr(socket, "inet_ntop")) | |||
def test_socket_inet_pton(self): | |||
import socket | |||
self.assertTrue(hasattr(socket, "inet_pton")) | |||
def test_multiprocessing_queue(self): | |||
from multiprocessing import Queue | |||
Queue(0) | |||
def test_socket_timout_normal_error(self): | |||
import urllib.request | |||
from urllib.error import URLError | |||
try: | |||
urllib.request.urlopen( | |||
'http://localhost', timeout=0.0001).close() | |||
except URLError: | |||
pass | |||
def test_threads(self): | |||
from concurrent.futures import ThreadPoolExecutor | |||
with ThreadPoolExecutor(1) as pool: | |||
for res in pool.map(lambda *x: None, range(10000)): | |||
pass | |||
def test_sysconfig(self): | |||
import sysconfig | |||
# This should be able to execute without exceptions | |||
sysconfig.get_config_vars() | |||
def test_sqlite_enable_load_extension(self): | |||
# Make sure --enable-loadable-sqlite-extensions is used | |||
import sqlite3 | |||
self.assertTrue(sqlite3.Connection.enable_load_extension) | |||
def test_venv_creation(self): | |||
import tempfile | |||
import venv | |||
import subprocess | |||
import shutil | |||
with tempfile.TemporaryDirectory() as tmp: | |||
builder = venv.EnvBuilder() | |||
builder.create(tmp) | |||
assert os.path.exists(os.path.join(tmp, "bin", "activate")) | |||
assert os.path.exists(os.path.join(tmp, "bin", "python.exe")) | |||
assert os.path.exists(os.path.join(tmp, "bin", "python3.exe")) | |||
subprocess.check_call([shutil.which("bash.exe"), os.path.join(tmp, "bin", "activate")]) | |||
def suite(): | |||
return unittest.TestLoader().loadTestsFromName(__name__) | |||
if __name__ == '__main__': | |||
unittest.main(defaultTest='suite') |
@@ -0,0 +1 @@ | |||
win32 |
@@ -73,6 +73,8 @@ if [ "${MACOS_UNIVERSAL}" -eq 1 ]; then | |||
SETUPTOOLS_SCM_VERSION=5.0.0 | |||
TOML_VERSION=0.10.2 | |||
ZIPP_VERSION=3.4.0 | |||
elif [ "${WIN32}" -eq 1 ]; then | |||
PYTHON_VERSION=3.8.7 | |||
else | |||
CXFREEZE_VERSION=6.1 | |||
PYTHON_VERSION=3.7.4 | |||