msys2-contrib / cpython-mingw

A friendly fork of CPython which adds support for Mingw-w64 + clang/gcc. See https://github.com/msys2-contrib/cpython-mingw/wiki for details
https://github.com/msys2-contrib/cpython-mingw/wiki
Other
39 stars 11 forks source link

Update to v3.10.4 #52

Closed naveen521kk closed 2 years ago

naveen521kk commented 2 years ago

Python 3.10 is released a few weeks ago. We should update it probably when Arch Linux does. I have rebased most of the patches in this branch mingw-v3.10.0. It still has some problems though.

Should we drop support for Windows 7 from this version?

Todos

lazka commented 2 years ago

Change of \ to / doesn't work. Probally issue with 088ba0b, should check

This is likely due to 4ad86b7afa525e56 missing. I can look into that if needed.

Should we drop support for Windows 7 from this version?

Do you know how much work it would be to get it working on win7?

Use os.winver for installing user packages. See _get_path() in Lib\site.py.

Is this related to #40 ?

naveen521kk commented 2 years ago

This is likely due to 4ad86b7 missing. I can look into that if needed.

:+1:

Do you know how much work it would be to get it working on win7?

I don't know, probably it should simply work because the patch from 3.9 simply applied on 3.10.

Is this related to #40 ?

Yes.

lazka commented 2 years ago

This is likely due to 4ad86b7 missing. I can look into that if needed.

๐Ÿ‘

added here: 2ea5fa382996dc480

lazka commented 2 years ago

things fail because of #11 now (maybe we should disable the source tree smoke tests)

naveen521kk commented 2 years ago

(maybe we should disable the source tree smoke tests)

I think we can simply disable the building c-ext test?

lazka commented 2 years ago

Here is the release schedule: https://www.python.org/dev/peps/pep-0619/#bugfix-releases

3.10.1: Monday, 2021-12-06

naveen521kk commented 2 years ago

Also, here is the range-diff (I didn't know there existed something like that before https://github.com/msys2-contrib/cpython-mingw/pull/78 ๐Ÿ˜…). Also, if anything looks wrong please report.

Range Diff ``` $ git range-diff v3.9.7..mingw-v3.9.7 v3.10.0..mingw-v3.10.0 1: 6ca397e7d4 = 1: 1cb98a152b sysconfig: make _sysconfigdata.py relocatable 2: 2a25da9a57 ! 2: 2df5b8d470 restore setup config @@ Modules/Setup.config.in (new) + ## configure.ac ## -@@ configure.ac: AC_DEFINE_UNQUOTED(PY_BUILTIN_HASHLIB_HASHES, "$default_hashlib_hashes") - ]) +@@ configure.ac: AC_SUBST(TEST_MODULES) + # generate output files -AC_CONFIG_FILES(Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh) 3: 80666900d8 ! 3: 5807031b08 build: add --with-nt-threads and make it default on mingw @@ configure.ac: dnl AC_MSG_RESULT($cpp_type) 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 \ -@@ configure.ac: sys/endian.h sys/sysmacros.h linux/memfd.h linux/wait.h sys/memfd.h sys/mman.h) +@@ configure.ac: sys/mman.h sys/eventfd.h) AC_HEADER_DIRENT AC_HEADER_MAJOR @@ configure.ac: else + 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 \ + clock confstr close_range copy_file_range ctermid dup3 execv explicit_bzero \ + explicit_memset faccessat fchmod fchmodat fchown fchownat \ @@ configure.ac: AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include ]]) # the kernel module that provides POSIX semaphores # isn't loaded by default, so an attempt to call 4: 96c0543238 = 4: 709e6d2759 MINGW translate gcc internal defines to python platf 5: c2c04f16d3 = 5: ebf4ba240c MINGW configure MACHDEP and platform for build 6: 3cdb748058 = 6: d9039731ee MINGW preset configure defaults 7: 0d783f83aa = 7: 59ec39b948 MINGW configure largefile support for windows builds 8: af4cca0744 ! 8: 3b04dfe2dd MINGW add srcdir PC to CPPFLAGS @@ configure.ac: do +esac + AC_SUBST(SRCDIRS) - SRCDIRS="Parser Parser/pegen Objects Python Modules Modules/_io Programs" + SRCDIRS="Parser Objects Python Modules Modules/_io Programs" +case $host in + *-*-mingw*) SRCDIRS="$SRCDIRS PC";; +esac 9: a2e178675d = 9: dd953baf4b MINGW init system calls 10: 08880ce168 = 10: 3c73f57503 MINGW build in windows modules winreg 11: 892c8b9194 ! 11: dbf09c9037 MINGW determine if pwdmodule should be used @@ Modules/Setup: PYTHONPATH=$(COREPYTHONPATH) 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 + _sre -DPy_BUILD_CORE_BUILTIN _sre.c # Fredrik Lundh's new regular expressions _codecs _codecsmodule.c # access to the builtin codecs and codec registry _weakref _weakref.c # weak references 12: b04a5d9e04 = 12: ebe0f8b477 issue6672 v2 Add Mingw recognition to pyport.h to al 13: ed8995bda0 = 13: e0901ec1d7 MINGW configure for shared build 14: 4eb264922b ! 14: 4a4fe925bc MINGW dynamic loading support @@ Python/dynload_win.c PYD_TAGGED_SUFFIX, PYD_UNTAGGED_SUFFIX, NULL -@@ Python/dynload_win.c: _Py_COMP_DIAG_POP +@@ Python/dynload_win.c: dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix, ensure DLLs adjacent to the PYD are preferred. */ Py_BEGIN_ALLOW_THREADS hDLL = LoadLibraryExW(wpathname, NULL, @@ Python/dynload_win.c: _Py_COMP_DIAG_POP - LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR); + LOAD_WITH_ALTERED_SEARCH_PATH); Py_END_ALLOW_THREADS - - /* restore old error mode settings */ + #if !USE_UNICODE_WCHAR_CACHE + PyMem_Free(wpathname); ## configure.ac ## @@ configure.ac: if test -z "$SHLIB_SUFFIX"; then 15: bd06581551 ! 15: 294d164d12 MINGW ignore main program for frozen scripts @@ configure.ac: case $host in +esac + AC_SUBST(SRCDIRS) - SRCDIRS="Parser Parser/pegen Objects Python Modules Modules/_io Programs" + SRCDIRS="Parser Objects Python Modules Modules/_io Programs" case $host in 16: 0dca777395 < -: ---------- MINGW setup _multiprocessing module -: ---------- > 16: b0bb46047d MINGW setup _multiprocessing module 17: 1dcb2cc12d ! 17: 75fe2f8665 MINGW setup select module @@ setup.py: def detect_simple_extensions(self): + self.add(Extension('select', ['selectmodule.c'], + libraries=select_libs)) - # Fred Drake's interface to the Python parser - self.add(Extension('parser', ['parsermodule.c'])) + # Memory-mapped files (also works on Win32). + self.add(Extension('mmap', ['mmapmodule.c'])) 18: f863b526f3 = 18: 8909f15653 MINGW setup _ctypes module with system libffi 19: 0a6c242ff9 ! 19: 5841494ecb MINGW defect winsock2 and setup _socket module @@ Misc/config_mingw: ac_cv_func_alarm=ignore +ac_cv_func_getpeername=yes ## Modules/socketmodule.c ## -@@ Modules/socketmodule.c: if_indextoname(index) -- return the corresponding interface name\n\ +@@ Modules/socketmodule.c: shutdown(how) -- shut down traffic in one or both directions\n\ # endif /* Macros based on the IPPROTO enum, see: https://bugs.python.org/issue29515 */ @@ Modules/socketmodule.c: if_indextoname(index) -- return the corresponding interf #define IPPROTO_ICMP IPPROTO_ICMP #define IPPROTO_IGMP IPPROTO_IGMP #define IPPROTO_GGP IPPROTO_GGP -@@ Modules/socketmodule.c: if_indextoname(index) -- return the corresponding interface name\n\ +@@ Modules/socketmodule.c: shutdown(how) -- shut down traffic in one or both directions\n\ #define IPPROTO_PGM IPPROTO_PGM // WinSock2 only #define IPPROTO_L2TP IPPROTO_L2TP // WinSock2 only #define IPPROTO_SCTP IPPROTO_SCTP // WinSock2 only @@ pyconfig.h.in #undef HAVE_ADDRINFO /* Define to 1 if you have the `alarm' function. */ -@@ - /* 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 header file. */ -+#undef HAVE_WS2TCPIP_H -+ - /* Define if the zlib library has inflateCopy */ - #undef HAVE_ZLIB_COPY - @@ /* Define to `unsigned int' if does not define. */ #undef size_t @@ pyconfig.h.in ## setup.py ## @@ setup.py: def detect_socket(self): - if MACOS: - # Issue #35569: Expose RFC 3542 socket options. - kwargs['extra_compile_args'] = ['-D__APPLE_USE_RFC_3542'] -+ if MS_WINDOWS: -+ kwargs['libraries'] = ['ws2_32', 'iphlpapi'] + if MACOS: + # Issue #35569: Expose RFC 3542 socket options. + kwargs['extra_compile_args'] = ['-D__APPLE_USE_RFC_3542'] ++ if MS_WINDOWS: ++ kwargs['libraries'] = ['ws2_32', 'iphlpapi'] + + self.add(Extension('_socket', ['socketmodule.c'], **kwargs)) - self.add(Extension('_socket', ['socketmodule.c'], **kwargs)) - elif self.compiler.find_library_file(self.lib_dirs, 'net'): 20: 43127485a0 ! 20: 082275b5ae MINGW exclude unix only modules @@ setup.py: def detect_simple_extensions(self): self.add(Extension('_csv', ['_csv.c'])) # POSIX subprocess module helper. -- self.add(Extension('_posixsubprocess', ['_posixsubprocess.c'])) +- self.add(Extension('_posixsubprocess', ['_posixsubprocess.c'], + if not MS_WINDOWS: -+ self.add(Extension('_posixsubprocess', ['_posixsubprocess.c'])) ++ self.add(Extension('_posixsubprocess', ['_posixsubprocess.c'], + extra_compile_args=['-DPy_BUILD_CORE_MODULE'])) + else: + self.missing.append('_posixsubprocess') def detect_test_extensions(self): # Python C API test module @@ setup.py: def detect_crypt(self): - # the encryption. + self.missing.append('_crypt') return - if self.compiler.find_library_file(self.lib_dirs, 'crypt'): @@ setup.py: def detect_crypt(self): + else: + libs = [] -- self.add(Extension('_crypt', ['_cryptmodule.c'], -- libraries=libs)) -+ self.add(Extension('_crypt', ['_cryptmodule.c'], -+ libraries=libs)) +- self.add(Extension('_crypt', ['_cryptmodule.c'], libraries=libs)) ++ self.add(Extension('_crypt', ['_cryptmodule.c'], libraries=libs)) + else: + self.missing.append('_crypt') 21: 71342683a2 = 21: c277710a51 MINGW setup msvcrt and _winapi modules 22: 81df7b0556 = 22: 19fdfa0a75 sysconfig: MINGW build extensions with GCC 23: 3d38194a6e ! 23: 269009f193 MINGW setup _ssl module @@ Commit message ## setup.py ## @@ setup.py: def split_var(name, sep): - openssl_includes = split_var('OPENSSL_INCLUDES', '-I') openssl_libdirs = split_var('OPENSSL_LDFLAGS', '-L') openssl_libs = split_var('OPENSSL_LIBS', '-l') + openssl_rpath = config_vars.get('OPENSSL_RPATH') + if MS_WINDOWS: + openssl_libs += tuple(['ws2_32']) if not openssl_libs: 24: 9cd7f11ee8 ! 24: 3ca50850b9 MINGW generalization of posix build in sysconfig.py @@ Commit message ## Lib/sysconfig.py ## @@ - _CONFIG_VARS = None - _USER_BASE = None + }, + } +# GCC[mingw*] use posix build system +_POSIX_BUILD = os.name == 'posix' or \ + (os.name == "nt" and 'GCC' in sys.version) ++ ++ - def _safe_realpath(path): - try: -@@ Lib/sysconfig.py: def _expand_vars(scheme, vars): - - - 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 + # NOTE: site.py has copy of this function. + # Sync it when modify this function. @@ Lib/sysconfig.py: def _getuserbase(): def joinuser(*args): return os.path.expanduser(os.path.join(*args)) @@ Lib/sysconfig.py: def _getuserbase(): base = os.environ.get("APPDATA") or "~" return joinuser(base, "Python") +@@ Lib/sysconfig.py: def joinuser(*args): + _findvar1_rx = r"\$\(([A-Za-z][A-Za-z0-9_]*)\)" + _findvar2_rx = r"\${([A-Za-z][A-Za-z0-9_]*)}" + +- + def _safe_realpath(path): + try: + return realpath(path) +@@ Lib/sysconfig.py: def _expand_vars(scheme, vars): + + + def _get_preferred_schemes(): +- if os.name == 'nt': ++ if os.name == 'nt' and not _POSIX_BUILD: + return { + 'prefix': 'nt', + 'home': 'posix_home', @@ Lib/sysconfig.py: def parse_config_h(fp, vars=None): def get_config_h_filename(): """Return the path of pyconfig.h.""" @@ Lib/sysconfig.py: def parse_config_h(fp, vars=None): else: inc_dir = _sys_home or _PROJECT_BASE @@ Lib/sysconfig.py: def get_config_vars(*args): - # sys.abiflags may not be defined on all platforms. - _CONFIG_VARS['abiflags'] = '' + except AttributeError: + _CONFIG_VARS['py_version_nodot_plat'] = '' - if os.name == 'nt': + if os.name == 'nt' and not _POSIX_BUILD: _init_non_posix(_CONFIG_VARS) - _CONFIG_VARS['TZPATH'] = '' - if os.name == 'posix': + if _POSIX_BUILD: _init_posix(_CONFIG_VARS) 25: 15b977a7de = 25: 5ad01e32d7 MINGW support stdcall without underscore 26: b14a7592f5 ! 26: 3a1c612498 use replace instead rename to avoid failure on windo @@ setup.py @@ setup.py: def copy_scripts(self): else: newfilename = filename + minoronly - log.info('renaming %s to %s', filename, newfilename) + log.info(f'renaming {filename} to {newfilename}') - os.rename(filename, newfilename) + os.replace(filename, newfilename) newoutfiles.append(newfilename) 27: 7edbdbe649 < -: ---------- MINGW customize site -: ---------- > 27: 7394d9621b MINGW customize site 28: 6c65a9a824 = 28: 0b1fadbb73 add python config sh 29: 28b76e2a3d = 29: 65e323a174 cross darwin feature 30: 97a76defea = 30: bec52d036a mingw system libffi 31: eef4cbef80 ! 31: 621f2aa0e8 msys mingw prefer unix sep if MSYSTEM @@ Lib/ntpath.py: def expandvars(path): curdir = '.' pardir = '..' special_prefixes = ('\\\\.\\', '\\\\?\\') -@@ Lib/ntpath.py: def realpath(path): +@@ Lib/ntpath.py: def realpath(path, *, strict=False): # strip the prefix anyway. if ex.winerror == initial_winerror: path = spath @@ Lib/ntpath.py: def realpath(path): return path -@@ Lib/ntpath.py: def realpath(path): +@@ Lib/ntpath.py: def realpath(path, *, strict=False): def relpath(path, start=None): """Return a relative version of a path""" path = os.fspath(path) @@ Modules/posixmodule.c: os__getfinalpathname_impl(PyObject *module, path_t *path) ## Python/initconfig.c ## @@ Python/initconfig.c: static const char usage_6[] = - "PYTHONDEVMODE: enable the development mode.\n" - "PYTHONPYCACHEPREFIX: root directory for bytecode cache (pyc) files.\n"; + "PYTHONPYCACHEPREFIX: root directory for bytecode cache (pyc) files.\n" + "PYTHONWARNDEFAULTENCODING: enable opt-in EncodingWarning for 'encoding=None'.\n"; -#if defined(MS_WINDOWS) +#if defined(_MSC_VER) 32: 81023c047f ! 32: d5ed544f32 mingw use posix getpath @@ Modules/getpath.c: calculate_argv0_path(PyCalculatePath *calculate, reduce(calculate->argv0_path); @@ Modules/getpath.c: calculate_zip_path(PyCalculatePath *calculate) - calculate->zip_path[len - 6] = VERSION[0]; - calculate->zip_path[len - 5] = VERSION[2]; + goto done; + } + Py_NormalizeSepsW(calculate->zip_path); -+ res = _PyStatus_OK(); done: @@ Modules/posixmodule.c: _listdir_windows_no_opendir(path_t *path, PyObject *list) ## Python/dynload_win.c ## @@ Python/dynload_win.c: dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix, + dl_funcptr p; char funcname[258], *import_python; - const wchar_t *wpathname; +#if defined(_MSC_VER) _Py_CheckPython3(); +#endif - _Py_COMP_DIAG_PUSH - _Py_COMP_DIAG_IGNORE_DEPR_DECLS + #if USE_UNICODE_WCHAR_CACHE + const wchar_t *wpathname = _PyUnicode_AsUnicode(pathname); ## Python/fileutils.c ## @@ Python/fileutils.c: _Py_wrealpath(const wchar_t *path, 33: 1a866712f7 = 33: b7d61297d2 mingw add ModuleFileName dir to PATH 34: e9e44cbc99 = 34: 38c266c153 mingw add BUILDIN_WIN32_MODULEs time msvcrt 35: 87605ef6c8 ! 35: ecae83c7c5 msys cygwin semi native build sysconfig @@ Commit message Co-authored-by: ะะปะตะบัะตะน ## Lib/sysconfig.py ## -@@ Lib/sysconfig.py: def _parse_makefile(filename, vars=None): +@@ Lib/sysconfig.py: def _parse_makefile(filename, vars=None, keep_unresolved=True): if isinstance(v, str): done[k] = v.strip() 36: ab96d425d2 ! 36: 1399e3c1af sysconfig: mingw sysconfig like posix @@ Lib/sysconfig.py + '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': { + } +@@ Lib/sysconfig.py: def joinuser(*args): + _INSTALL_SCHEMES |= { + # NOTE: When modifying "purelib" scheme, update site._get_path() too. + 'nt_user': { +- 'stdlib': '{userbase}/Python{py_version_nodot_plat}', +- 'platstdlib': '{userbase}/Python{py_version_nodot_plat}', +- 'purelib': '{userbase}/Python{py_version_nodot_plat}/site-packages', +- 'platlib': '{userbase}/Python{py_version_nodot_plat}/site-packages', +- 'include': '{userbase}/Python{py_version_nodot_plat}/Include', +- 'scripts': '{userbase}/Python{py_version_nodot_plat}/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': { @@ Lib/sysconfig.py: def _init_non_posix(vars): vars['INCLUDEPY'] = get_path('include') vars['EXT_SUFFIX'] = _imp.extension_suffixes()[0] @@ Lib/sysconfig.py: def _init_non_posix(vars): - vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT + vars['VERSION'] = _PY_VERSION_SHORT vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable)) + vars['TZPATH'] = '' - # 37: fa3d5a3529 = 37: d5d18dfe95 build _winapi earlier so we can use it in distutils via subprocess 38: 64886b38c5 = 38: 8c08bc18c5 cross dont add multiarch paths if cross compiling 39: 47c94ca56a = 39: d691d67b2a mingw use backslashes in compileall py 40: 22fc2593de = 40: cc0fbe2888 msys convert_path fix and root hack 41: 096b2ca2e0 = 41: c42bbc3cda allow static tcltk 42: 2b8402c1ca = 42: 64f3f91087 mingw pdcurses_ISPAD 43: 36b85a2879 < -: ---------- grammar fixes 44: e835e97afd ! 43: 92456f734e builddir fixes @@ Commit message Co-authored-by: Christoph Reiter ## Makefile.pre.in ## -@@ Makefile.pre.in: Programs/_testembed: Programs/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) +@@ Makefile.pre.in: Programs/_testembed: Programs/_testembed.o $(LIBRARY_DEPS) Programs/_freeze_importlib.o: Programs/_freeze_importlib.c Makefile 45: 74ee0fa7cb = 44: 4a690d4435 msys monkeypatch os system via sh exe 46: a85ea70acc ! 45: 4859bff1e3 msys replace slashes used in io redirection @@ setup.py: def add_multiarch_paths(self): if not os.path.exists(self.build_temp): os.makedirs(self.build_temp) ret = run_command( -@@ setup.py: def add_multiarch_paths(self): +@@ setup.py: def add_search_path(line): def add_cross_compiling_paths(self): cc = sysconfig.get_config_var('CC') 47: 01d2127df3 = 46: c8c429f02b remove_path_max.default 48: 9b3cfc647b = 47: f84ed3dee0 dont link with gettext 49: 2a0f9b8311 = 48: b5185ce931 ctypes python dll 50: 34ca4e0b61 = 49: b0cc025c9e gdbm module includes 51: c25ea3b876 = 50: 5a2085bcb4 use gnu_printf in format 52: f5d305af4e = 51: fea589f9c4 mingw fix ssl dont use enum_certificates 53: 70aae126fd ! 52: dad1af4c44 fix using dllhandle and winver mingw @@ Python/sysmodule.c: Data members: /* A string loaded from the DLL at startup: */ extern const char *PyWin_DLLVersionString; @@ Python/sysmodule.c: _PySys_InitCore(PyThreadState *tstate, PyObject *sysdict) - PyUnicode_FromString("little")); + SET_SYS_FROM_STRING("byteorder", "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", + SET_SYS("dllhandle", PyLong_FromVoidPtr(PyWin_DLLhModule)); + SET_SYS_FROM_STRING("winver", PyWin_DLLVersionString); + #endif 54: 887b0e7895 ! 53: 82b13bb515 Add AMD64 to sys config so msvccompiler get_build_version works @@ Commit message ## Python/getcompiler.c ## @@ #if defined(__clang__) - #define COMPILER "\n[Clang " __clang_version__ "]" + #define COMPILER "[Clang " __clang_version__ "]" #elif defined(__GNUC__) --#define COMPILER "\n[GCC " __VERSION__ "]" +-#define COMPILER "[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 55: 1d8904ee69 = 54: 5186de5e48 MINGW link with additional library 56: 63cdce7b08 < -: ---------- install msilib -: ---------- > 55: 9b7ab0570d install msilib 57: 9aea35d5ab ! 56: d4cf88fdd7 fix signal module build @@ Commit message ## Modules/Setup ## @@ Modules/Setup: _collections _collectionsmodule.c # Container types - _abc _abc.c # Abstract base classes + _abc -DPy_BUILD_CORE_BUILTIN _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 58: 3ebd25cabf ! 57: f6c2060b4a build: build winconsoleio and _testconsole @@ setup.py: def detect_test_extensions(self): + def detect_readline_curses(self): # readline - do_readline = self.compiler.find_library_file(self.lib_dirs, 'readline') + readline_termcap_library = "" 59: 9aca6a2893 < -: ---------- expose sem_unlink -: ---------- > 58: c3feeee17a expose sem_unlink 60: 0255306a40 ! 59: 0f9064a477 cygpty isatty @@ Python/bltinmodule.c #include "Python.h" +#include "iscygpty.h" #include - #include "ast.h" - #undef Yield /* undefine macro conflicting with */ + #include "pycore_ast.h" // _PyAST_Validate() + #include "pycore_compile.h" // _PyAST_Compile() @@ Python/bltinmodule.c: builtin_input_impl(PyObject *module, PyObject *prompt) Py_DECREF(tmp); if (fd < 0 && PyErr_Occurred()) @@ Python/fileutils.c @@ #include "Python.h" +#include "iscygpty.h" - #include "pycore_fileutils.h" + #include "pycore_fileutils.h" // fileutils definitions + #include "pycore_runtime.h" // _PyRuntime #include "osdefs.h" // SEP - #include @@ Python/fileutils.c: _Py_device_encoding(int fd) - #endif + { int valid; _Py_BEGIN_SUPPRESS_IPH - valid = isatty(fd); @@ Python/iscygpty.c (new) ## Python/pylifecycle.c ## @@ + #include "pycore_sysmodule.h" // _PySys_ClearAuditHooks() #include "pycore_traceback.h" // _Py_DumpTracebackThreads() - #include "grammar.h" // PyGrammar_RemoveAccelerators() +#include "iscygpty.h" #include // setlocale() - #ifdef HAVE_SIGNAL_H -@@ Python/pylifecycle.c: _Py_RestoreSignals(void) + #if defined(__APPLE__) +@@ Python/pylifecycle.c: Py_Exit(int sts) int Py_FdIsInteractive(FILE *fp, const char *filename) { 61: 391cfafdf3 = 60: 0566135dcf disable broken gdbm module 62: 17ac3e7063 ! 61: 8bed36a023 build: link win resource files and build pythonw @@ Makefile.pre.in: LIBOBJS= @LIBOBJS@ +BUILDPYTHONW= pythonw$(BUILDEXE) PYTHON_FOR_REGEN?=@PYTHON_FOR_REGEN@ - UPDATE_FILE=@PYTHON_FOR_REGEN@ $(srcdir)/Tools/scripts/update_file.py + UPDATE_FILE=$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/update_file.py @@ Makefile.pre.in: DTRACE_DEPS = \ # Default target @@ Makefile.pre.in: DTRACE_DEPS = \ Programs/_testembed python-config # Check that the source is clean when building out of source. -@@ Makefile.pre.in: coverage-report: regen-grammar regen-token regen-importlib +@@ Makefile.pre.in: coverage-report: regen-token regen-importlib clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c $(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --srcdir $(srcdir) @@ Makefile.pre.in: coverage-report: regen-grammar regen-token regen-importlib + $(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) $(EXPORTSYMS) +-$(BUILDPYTHON): Programs/python.o $(LIBRARY_DEPS) - $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) -+$(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) python_exe.o ++$(BUILDPYTHON): Programs/python.o $(LIBRARY_DEPS) python_exe.o + $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -municode -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) python_exe.o platform: $(BUILDPYTHON) pybuilddir.txt 63: a15d5dafd3 < -: ---------- 3.7 mpdec mingw 64: 7dc48f709c < -: ---------- disable readline -: ---------- > 62: ddd3b00fd4 disable readline 65: 27e5727fb4 = 63: ec3c1f7dc0 fix isselectable 66: c217628934 = 64: e51bd20295 use _wcsnicmp instead wcsncasecmp 67: c392c6966b = 65: d19ed6053b _xxsubinterpretersmodule 68: fdb194111c < -: ---------- sqlite3 module defines -: ---------- > 66: de08a7d3fb sqlite3 module defines 69: e76cda7b6d = 67: 38c03d44ee configure.ac: fix inet_pton check 70: 737d758a51 = 68: a41578b844 set venv activate path unix 71: c82449ed5f = 69: 244e5e5b29 venv creation fixes 72: 6e6cac92a9 = 70: af723e4d8e pass gen profile ldflags 73: 95164a8ced = 71: 071ad00d1e pkg config windows must link ext with python lib 74: 3fa40ebd03 < -: ---------- importlib bootstrap path sep -: ---------- > 72: 088ba0b2b0 importlib bootstrap path sep 75: 81189e3707 = 73: 8801fd78e5 pathlib path sep 76: 92b8d29b62 = 74: 50c8b0c3e0 warnings fixes 77: 08145aec08 = 75: 111574d551 fix build testinternalcapi 78: b3cac7696a = 76: 7bbbdb552e extend MS_WINDOWS flag 79: 61eb03c579 ! 77: 5132d7826b clang arm64 @@ Metadata ## Commit message ## clang arm64 + Co-authored-by: Naveen M K + ## Python/getcompiler.c ## @@ @@ Python/getcompiler.c // clang pretends to be GCC. -#if defined(__clang__) +#if defined(__clang__) && !defined(_WIN32) - #define COMPILER "\n[Clang " __clang_version__ "]" + #define COMPILER "[Clang " __clang_version__ "]" #elif defined(__GNUC__) /* To not break compatibility with things that determine @@ 80: 2a92ce2774 ! 78: f471e4d6b2 configure.ac: set MINGW stack reserve @@ Commit message ## configure.ac ## @@ configure.ac: then VxWorks*) - LINKFORSHARED='--export-dynamic';; + LINKFORSHARED='-Wl,-export-dynamic';; esac + case $host in + *-*-mingw*) 81: c791a76636 = 79: df2bdfbe3c Don't use os.pathsep to find EOF not all distributions in win32 have them as \ instead check using sys.platform 82: cda85af5ff ! 80: 9705142463 Fix extension suffix for c-extensions on mingw @@ Makefile.pre.in: Python/dynload_hpux.o: $(srcdir)/Python/dynload_hpux.c Makefile Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile $(srcdir)/Include/pydtrace.h @@ Makefile.pre.in: libainstall: @DEF_MAKE_RULE@ python-config - done - @if test -d $(LIBRARY); then :; else \ - if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ -- if test "$(SHLIB_SUFFIX)" = .dll; then \ -+ if test "$(SHLIB_SUFFIX)" = .dll -o "$(SHLIB_SUFFIX)" = .pyd; then \ - $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \ - else \ - $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ + @if test "$(STATIC_LIBPYTHON)" = 1; then \ + if test -d $(LIBRARY); then :; else \ + if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ +- if test "$(SHLIB_SUFFIX)" = .dll; then \ ++ if test "$(SHLIB_SUFFIX)" = .dll -o "$(SHLIB_SUFFIX)" = .pyd; then \ + $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \ + else \ + $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ ## Python/dynload_win.c ## @@ 83: ff2b019fd2 = 81: 7d6ec09499 Change the `get_platform()` method in sysconfig 84: 68b961fb34 ! 82: 21e726ba50 distutils: compiler customize mingw cygwin compilers @@ Metadata ## Commit message ## distutils: compiler customize mingw cygwin compilers - Co-authored-by: ะะปะตะบัะตะน + Co-authored-by: Naveen M K ## Lib/distutils/sysconfig.py ## @@ Lib/distutils/sysconfig.py: def customize_compiler(compiler): @@ Lib/distutils/sysconfig.py: def customize_compiler(compiler): if sys.platform == "darwin": # Perform first-time customization of compiler-related # config vars on OS X now that we know we need a compiler. -@@ Lib/distutils/sysconfig.py: def customize_compiler(compiler): - # 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 85: fc9e160c08 = 83: 7fbf2669ec distutils: compiler enable new dtags 86: bc18b4c3c9 = 84: 59fb3e5bc3 distutils: MINGW build extensions with GCC 87: 40bf9e42ca = 85: 6bf0cc4d29 distutils: use Mingw32CCompiler as default compiler for m 88: 41d8050684 = 86: 7e592f1acd distutils: find import library 89: a4abb467ae = 87: 743f08acb0 distutils: avoid circular dependency from time module dur 90: 24eed4bff4 < -: ---------- distutils: generalization of posix build in distutils sys -: ---------- > 88: 07ce9c8988 distutils: generalization of posix build in distutils sys 91: a0d9baa8dc = 89: 5e59c7ba3a distutils: mingw sysconfig like posix 92: 985a20ad50 = 90: eca059099c distutils: get_versions() fixes 93: 71cd2a0390 ! 91: d7924f967e distutils: install layout as posix @@ Metadata ## Commit message ## distutils: install layout as posix - Co-authored-by: ะะปะตะบัะตะน + Co-authored-by: Naveen M K ## Lib/distutils/command/install.py ## -@@ - 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', - } - @@ INSTALL_SCHEMES['nt_user'] = { 'purelib': '$usersite', 94: 1ed69d8e50 ! 92: 810c367f10 distutils: msys convert_path fix and root hack @@ Metadata ## Commit message ## distutils: msys convert_path fix and root hack + Co-authored-by: Naveen M K + ## Lib/distutils/command/install.py ## @@ Lib/distutils/command/install.py: def finalize_options(self): @@ Lib/distutils/command/install.py: def finalize_options(self): - self.convert_paths('lib', 'purelib', 'platlib', + self.convert_paths('base', 'platbase', + 'lib', 'purelib', 'platlib', - 'scripts', 'data', 'headers', - 'userbase', 'usersite') - + 'scripts', 'data', 'headers') + if HAS_USER_SITE: + self.convert_paths('userbase', 'usersite') ## Lib/distutils/util.py ## @@ Lib/distutils/util.py: def convert_path (pathname): 95: 1da2752289 = 93: c13e972bd2 distutils: mingw build optimized ext 96: 6d88060965 = 94: a971f45dfc distutils: cygwinccompiler dont strip modules if pydebug 97: b1f1cbeefc = 95: edbda23fbc distutils: get compilers from env vars 98: 0c751ecfc0 = 96: 9c089d5a41 distutils: add windmc to cygwinccompiler 99: d947ead836 = 97: 3f2d640f0c distutils: fix msvc9 import 100: 609d9e23ff = 98: d7aa0ff8ef distutils: mingw add LIBPL to library dirs 101: 5a61407b52 = 99: c347c9bbb8 distutils: Change the `get_platform()` method in distutils to match sysconfig 102: 7f0e7c9672 = 100: 97d01b9103 build: Fix ncursesw include lookup 103: dee249e62d = 101: 14dd62fba0 tests: fix test_bytes 104: 72e058ef4f = 102: 1dba7da22b time: fix strftime not raising for invalid year values 105: bf97e2d2da = 103: db63bc4065 ctypes: find_library('c') should return None with ucrt 106: 3357517138 ! 104: 38bf0a1b25 build: Disable checks for dlopen/dlfcn @@ configure.ac: dnl AC_MSG_RESULT($cpp_type) fcntl.h grp.h \ ieeefp.h io.h langinfo.h libintl.h process.h \ shadow.h signal.h stropts.h termios.h \ -@@ configure.ac: sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ - libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ +@@ configure.ac: libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \ - sys/endian.h sys/sysmacros.h linux/memfd.h linux/wait.h sys/memfd.h sys/mman.h) + sys/endian.h sys/sysmacros.h linux/memfd.h linux/wait.h sys/memfd.h \ + sys/mman.h sys/eventfd.h) + +case $host in + *-*-mingw*) ;; 107: 212191d85f < -: ---------- Fix install location of the import library -: ---------- > 105: e94e691603 Fix install location of the import library 108: be91fcc4aa = 106: d6a1a6cb23 Set MSYS2_ARG_CONV_EXCL for the shared Python module install 109: f86fcd93f6 ! 107: 3159763aba build: Integrate venvlauncher build/installation into the Makefile @@ Makefile.pre.in: LIBOBJS= @LIBOBJS@ +BUILDVENVWLAUNCHER= venvwlauncher$(BUILDEXE) PYTHON_FOR_REGEN?=@PYTHON_FOR_REGEN@ - UPDATE_FILE=@PYTHON_FOR_REGEN@ $(srcdir)/Tools/scripts/update_file.py + UPDATE_FILE=$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/update_file.py @@ Makefile.pre.in: DTRACE_DEPS = \ # Default target @@ Makefile.pre.in: DTRACE_DEPS = \ # Check that the source is clean when building out of source. @@ Makefile.pre.in: $(BUILDPYTHONW): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) pythonw - $(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) python_exe.o + $(BUILDPYTHON): Programs/python.o $(LIBRARY_DEPS) python_exe.o $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -municode -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) python_exe.o +# FIXME: build these from PC/launcher.c instead 110: 3724005ffa = 108: 2b83ecfaa7 configure.ac: set _WIN32_WINNT version 111: 80640c7c44 = 109: 59069e28f6 configure.ac: don't check for clock_ functions 112: 2748eca808 ! 110: 92f9f46cde expanduser: normpath paths coming from env vars @@ Lib/ntpath.py: def expanduser(path): try: drive = os.environ['HOMEDRIVE'] @@ Lib/ntpath.py: def expanduser(path): - if i != 1: #~user - userhome = join(dirname(userhome), path[1:i]) + if isinstance(path, bytes): + userhome = os.fsencode(userhome) - return userhome + path[i:] + return os.path.normpath(userhome) + path[i:] 113: 0f459a423f ! 111: 8f8495c957 Add support for Windows 7 Python 3.9 @@ Modules/posixmodule.c +# include #endif - #include "pycore_ceval.h" // _PyEval_ReInitThreads() + #ifdef __VXWORKS__ @@ Modules/posixmodule.c: os__path_splitroot_impl(PyObject *module, path_t *path) wchar_t *buffer; wchar_t *end; 114: 4ad86b7afa < -: ---------- Commit regenerated importlib 115: dace5a0283 = 112: fd0133e2c1 CI: test the build and add some mingw specific tests 116: f9d77130f2 < -: ---------- decimal: backport build fixes 117: b7d2e9e271 = 113: c6765ac66c smoketests: test that _decimal exists 118: ac9f30ac5c = 114: 210c8cdff3 Prefer sysconfig.python_build -: ---------- > 115: 5354bf6801 Define PY3_DLLNAME to fix build -: ---------- > 116: 2ea5fa3829 Commit regenerated importlib 119: 8ec77b61a8 = 117: d25b39355a distutils: remove checks for ancient gcc/binutils 120: 8736112bab = 118: 8dde5997e6 distutils: split CC env var before passing to subprocess 121: 11779b2113 = 119: b2ff1b7944 _testconsole.c: Fix casing & path sep 122: 8bcd28b1e2 = 120: a3fb8f22fa Return consistent architecture markers for python on mingw/armv7 123: 825cae1878 = 121: cd29814a5a distutils: add back gcc_version 124: aa916ed5c9 = 122: e4efd6db37 fix mingw cross compiling in setup.py -: ---------- > 123: 11d06c3d15 Use actions/setup-python for setting up correct version in cross build -: ---------- > 124: 8301f68909 Fix buffer overflow in Py_GetSepW(). -: ---------- > 125: b21ef8bae4 Remove unnecessary strlen() in Py_NormalizeSepsW(). -: ---------- > 126: 911ee4af06 handle ncursesw pkg-config when cross-compiling -: ---------- > 127: c331b79b64 CI: add cross llvm-mingw jobs -: ---------- > 128: 931aa351e8 fixup! Define PY3_DLLNAME to fix build -: ---------- > 129: 2f3cb98e43 Skip building c-extensions if python is running in build tree -: ---------- > 130: ecb8ff960c mingw_smoketests: fix _UCRT condition ```
lazka commented 2 years ago

I guess this can be closed?

naveen521kk commented 2 years ago

I guess this can be closed?

I guess so. The update in the repo can be tracked at https://github.com/msys2/MINGW-packages/issues/10515.