diff options
-rw-r--r-- | Lib/distutils/sysconfig.py | 13 | ||||
-rw-r--r-- | Misc/NEWS | 3 | ||||
-rw-r--r-- | Modules/_multiprocessing/semaphore.c | 6 | ||||
-rw-r--r-- | Modules/timemodule.c | 2 | ||||
-rw-r--r-- | PC/launcher.c | 2 | ||||
-rw-r--r-- | Parser/myreadline.c | 2 | ||||
-rw-r--r-- | Python/condvar.h | 2 | ||||
-rw-r--r-- | Python/thread_nt.h | 2 | ||||
-rwxr-xr-x | configure | 8 | ||||
-rw-r--r-- | configure.ac | 8 |
10 files changed, 27 insertions, 21 deletions
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py index 91ed1a498c..71492f306c 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -24,7 +24,11 @@ BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix) # Path to the base directory of the project. On Windows the binary may # live in project/PCBuild9. If we're dealing with an x64 Windows build, # it'll live in project/PCbuild/amd64. -project_base = os.path.dirname(os.path.abspath(sys.executable)) +# set for cross builds +if "_PYTHON_PROJECT_BASE" in os.environ: + project_base = os.path.abspath(os.environ["_PYTHON_PROJECT_BASE"]) +else: + project_base = os.path.dirname(os.path.abspath(sys.executable)) if os.name == "nt" and "pcbuild" in project_base[-8:].lower(): project_base = os.path.abspath(os.path.join(project_base, os.path.pardir)) # PC/VS7.1 @@ -98,7 +102,7 @@ def get_python_inc(plat_specific=0, prefix=None): # the build directory may not be the source directory, we # must use "srcdir" from the makefile to find the "Include" # directory. - base = _sys_home or os.path.dirname(os.path.abspath(sys.executable)) + base = _sys_home or project_base if plat_specific: return base if _sys_home: @@ -244,8 +248,7 @@ def get_config_h_filename(): def get_makefile_filename(): """Return full pathname of installed Makefile from the Python build.""" if python_build: - return os.path.join(_sys_home or os.path.dirname(sys.executable), - "Makefile") + return os.path.join(_sys_home or project_base, "Makefile") lib_dir = get_python_lib(plat_specific=0, standard_lib=1) config_file = 'config-{}{}'.format(get_python_version(), build_flags) return os.path.join(lib_dir, config_file, 'Makefile') @@ -531,7 +534,7 @@ def get_config_vars(*args): # testing, for example, we might be running a non-installed python # from a different directory. if python_build and os.name == "posix": - base = os.path.dirname(os.path.abspath(sys.executable)) + base = project_base if (not os.path.isabs(_config_vars['srcdir']) and base != os.getcwd()): # srcdir is relative and we are not in the same directory @@ -749,6 +749,9 @@ Tests Build ----- +- Issue #15484: Fix _PYTHON_PROJECT_BASE for srcdir != builddir builds; + use _PYTHON_PROJECT_BASE in distutils/sysconfig.py. + - Drop support for Windows 2000. - Issue #17029: Let h2py search the multiarch system include directory. diff --git a/Modules/_multiprocessing/semaphore.c b/Modules/_multiprocessing/semaphore.c index eb3fa0ceb5..dcf3b42bc1 100644 --- a/Modules/_multiprocessing/semaphore.c +++ b/Modules/_multiprocessing/semaphore.c @@ -43,7 +43,7 @@ _GetSemaphoreValue(HANDLE handle, long *value) { long previous; - switch (WaitForSingleObject(handle, 0)) { + switch (WaitForSingleObjectEx(handle, 0, FALSE)) { case WAIT_OBJECT_0: if (!ReleaseSemaphore(handle, 1, &previous)) return MP_STANDARD_ERROR; @@ -99,7 +99,7 @@ semlock_acquire(SemLockObject *self, PyObject *args, PyObject *kwds) } /* check whether we can acquire without releasing the GIL and blocking */ - if (WaitForSingleObject(self->handle, 0) == WAIT_OBJECT_0) { + if (WaitForSingleObjectEx(self->handle, 0, FALSE) == WAIT_OBJECT_0) { self->last_tid = GetCurrentThreadId(); ++self->count; Py_RETURN_TRUE; @@ -118,7 +118,7 @@ semlock_acquire(SemLockObject *self, PyObject *args, PyObject *kwds) Py_BEGIN_ALLOW_THREADS if (sigint_event != NULL) ResetEvent(sigint_event); - res = WaitForMultipleObjects(nhandles, handles, FALSE, full_msecs); + res = WaitForMultipleObjectsEx(nhandles, handles, FALSE, full_msecs, FALSE); Py_END_ALLOW_THREADS /* handle result */ diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 8a81c8cf1e..d5ffdcccba 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -1574,7 +1574,7 @@ floatsleep(double secs) DWORD rc; HANDLE hInterruptEvent = _PyOS_SigintEvent(); ResetEvent(hInterruptEvent); - rc = WaitForSingleObject(hInterruptEvent, ul_millis); + rc = WaitForSingleObjectEx(hInterruptEvent, ul_millis, FALSE); if (rc == WAIT_OBJECT_0) { Py_BLOCK_THREADS errno = EINTR; diff --git a/PC/launcher.c b/PC/launcher.c index dfad44a359..df2580b337 100644 --- a/PC/launcher.c +++ b/PC/launcher.c @@ -535,7 +535,7 @@ run_child(wchar_t * cmdline) error(RC_CREATE_PROCESS, L"Unable to create process using '%s'", cmdline); AssignProcessToJobObject(job, pi.hProcess); CloseHandle(pi.hThread); - WaitForSingleObject(pi.hProcess, INFINITE); + WaitForSingleObjectEx(pi.hProcess, INFINITE, FALSE); ok = GetExitCodeProcess(pi.hProcess, &rc); if (!ok) error(RC_CREATE_PROCESS, L"Failed to get exit code of process"); diff --git a/Parser/myreadline.c b/Parser/myreadline.c index d864623f1a..8b27045f1d 100644 --- a/Parser/myreadline.c +++ b/Parser/myreadline.c @@ -68,7 +68,7 @@ my_fgets(char *buf, int len, FILE *fp) */ if (GetLastError()==ERROR_OPERATION_ABORTED) { hInterruptEvent = _PyOS_SigintEvent(); - switch (WaitForSingleObject(hInterruptEvent, 10)) { + switch (WaitForSingleObjectEx(hInterruptEvent, 10, FALSE)) { case WAIT_OBJECT_0: ResetEvent(hInterruptEvent); return 1; /* Interrupt */ diff --git a/Python/condvar.h b/Python/condvar.h index fe6bd74da8..72b08f98c0 100644 --- a/Python/condvar.h +++ b/Python/condvar.h @@ -242,7 +242,7 @@ _PyCOND_WAIT_MS(PyCOND_T *cv, PyMUTEX_T *cs, DWORD ms) * but we are safe because we are using a semaphore wich has an internal * count. */ - wait = WaitForSingleObject(cv->sem, ms); + wait = WaitForSingleObjectEx(cv->sem, ms, FALSE); PyMUTEX_LOCK(cs); if (wait != WAIT_OBJECT_0) --cv->waiting; diff --git a/Python/thread_nt.h b/Python/thread_nt.h index 938bf1e3fe..bd604fbdd3 100644 --- a/Python/thread_nt.h +++ b/Python/thread_nt.h @@ -130,7 +130,7 @@ FreeNonRecursiveMutex(PNRMUTEX mutex) DWORD EnterNonRecursiveMutex(PNRMUTEX mutex, DWORD milliseconds) { - return WaitForSingleObject(mutex, milliseconds); + return WaitForSingleObjectEx(mutex, milliseconds, FALSE); } BOOL @@ -2942,7 +2942,7 @@ $as_echo_n "checking for python interpreter for cross build... " >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $interp" >&5 $as_echo "$interp" >&6; } - PYTHON_FOR_BUILD="_PYTHON_PROJECT_BASE=$srcdir"' _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP) '$interp + PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP) '$interp fi elif test "$cross_compiling" = maybe; then as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH" "$LINENO" 5 @@ -3249,9 +3249,9 @@ if test -z "$MACHDEP" then # avoid using uname for cross builds if test "$cross_compiling" = yes; then - # ac_sys_system and ac_sys_release are only used for setting - # `define_xopen_source' in the case statement below. For the - # current supported cross builds, this macro is not adjusted. + # 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. case "$host" in *-*-linux*) ac_sys_system=Linux diff --git a/configure.ac b/configure.ac index 9379c040cf..b998b2481c 100644 --- a/configure.ac +++ b/configure.ac @@ -65,7 +65,7 @@ if test "$cross_compiling" = yes; then AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found]) fi AC_MSG_RESULT($interp) - PYTHON_FOR_BUILD="_PYTHON_PROJECT_BASE=$srcdir"' _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP) '$interp + PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP) '$interp fi elif test "$cross_compiling" = maybe; then AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH]) @@ -352,9 +352,9 @@ if test -z "$MACHDEP" then # avoid using uname for cross builds if test "$cross_compiling" = yes; then - # ac_sys_system and ac_sys_release are only used for setting - # `define_xopen_source' in the case statement below. For the - # current supported cross builds, this macro is not adjusted. + # 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. case "$host" in *-*-linux*) ac_sys_system=Linux |