mirror of https://github.com/python/cpython
gh-111650: Ensure pyconfig.h includes Py_GIL_DISABLED on Windows (GH-112778)
This commit is contained in:
parent
498a096a51
commit
79dad03747
|
@ -16,7 +16,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build CPython
|
- name: Build CPython
|
||||||
run: .\PCbuild\build.bat -e -d -p Win32 ${{ inputs.free-threaded && '--disable-gil' || '' }}
|
run: .\PCbuild\build.bat -e -d -v -p Win32 ${{ inputs.free-threaded && '--disable-gil' || '' }}
|
||||||
- name: Display build info
|
- name: Display build info
|
||||||
run: .\python.bat -m test.pythoninfo
|
run: .\python.bat -m test.pythoninfo
|
||||||
- name: Tests
|
- name: Tests
|
||||||
|
@ -33,7 +33,7 @@ jobs:
|
||||||
- name: Register MSVC problem matcher
|
- name: Register MSVC problem matcher
|
||||||
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
|
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
|
||||||
- name: Build CPython
|
- name: Build CPython
|
||||||
run: .\PCbuild\build.bat -e -d -p x64 ${{ inputs.free-threaded && '--disable-gil' || '' }}
|
run: .\PCbuild\build.bat -e -d -v -p x64 ${{ inputs.free-threaded && '--disable-gil' || '' }}
|
||||||
- name: Display build info
|
- name: Display build info
|
||||||
run: .\python.bat -m test.pythoninfo
|
run: .\python.bat -m test.pythoninfo
|
||||||
- name: Tests
|
- name: Tests
|
||||||
|
@ -50,4 +50,4 @@ jobs:
|
||||||
- name: Register MSVC problem matcher
|
- name: Register MSVC problem matcher
|
||||||
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
|
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
|
||||||
- name: Build CPython
|
- name: Build CPython
|
||||||
run: .\PCbuild\build.bat -e -d -p arm64 ${{ inputs.free-threaded && '--disable-gil' || '' }}
|
run: .\PCbuild\build.bat -e -d -v -p arm64 ${{ inputs.free-threaded && '--disable-gil' || '' }}
|
||||||
|
|
|
@ -404,7 +404,16 @@ def get_config_h_filename():
|
||||||
"""Return the path of pyconfig.h."""
|
"""Return the path of pyconfig.h."""
|
||||||
if _PYTHON_BUILD:
|
if _PYTHON_BUILD:
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
inc_dir = os.path.join(_PROJECT_BASE, "PC")
|
# This ought to be as simple as dirname(sys._base_executable), but
|
||||||
|
# if a venv uses symlinks to a build in the source tree, then this
|
||||||
|
# fails. So instead we guess the subdirectory name from sys.winver
|
||||||
|
if sys.winver.endswith('-32'):
|
||||||
|
arch = 'win32'
|
||||||
|
elif sys.winver.endswith('-arm64'):
|
||||||
|
arch = 'arm64'
|
||||||
|
else:
|
||||||
|
arch = 'amd64'
|
||||||
|
inc_dir = os.path.join(_PROJECT_BASE, 'PCbuild', arch)
|
||||||
else:
|
else:
|
||||||
inc_dir = _PROJECT_BASE
|
inc_dir = _PROJECT_BASE
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -472,11 +472,15 @@ class TestSysConfig(unittest.TestCase):
|
||||||
# should be a full source checkout.
|
# should be a full source checkout.
|
||||||
Python_h = os.path.join(srcdir, 'Include', 'Python.h')
|
Python_h = os.path.join(srcdir, 'Include', 'Python.h')
|
||||||
self.assertTrue(os.path.exists(Python_h), Python_h)
|
self.assertTrue(os.path.exists(Python_h), Python_h)
|
||||||
# <srcdir>/PC/pyconfig.h always exists even if unused on POSIX.
|
# <srcdir>/PC/pyconfig.h.in always exists even if unused
|
||||||
pyconfig_h = os.path.join(srcdir, 'PC', 'pyconfig.h')
|
pyconfig_h = os.path.join(srcdir, 'PC', 'pyconfig.h.in')
|
||||||
self.assertTrue(os.path.exists(pyconfig_h), pyconfig_h)
|
self.assertTrue(os.path.exists(pyconfig_h), pyconfig_h)
|
||||||
pyconfig_h_in = os.path.join(srcdir, 'pyconfig.h.in')
|
pyconfig_h_in = os.path.join(srcdir, 'pyconfig.h.in')
|
||||||
self.assertTrue(os.path.exists(pyconfig_h_in), pyconfig_h_in)
|
self.assertTrue(os.path.exists(pyconfig_h_in), pyconfig_h_in)
|
||||||
|
if os.name == 'nt':
|
||||||
|
# <executable dir>/pyconfig.h exists on Windows in a build tree
|
||||||
|
pyconfig_h = os.path.join(sys.executable, '..', 'pyconfig.h')
|
||||||
|
self.assertTrue(os.path.exists(pyconfig_h), pyconfig_h)
|
||||||
elif os.name == 'posix':
|
elif os.name == 'posix':
|
||||||
makefile_dir = os.path.dirname(sysconfig.get_makefile_filename())
|
makefile_dir = os.path.dirname(sysconfig.get_makefile_filename())
|
||||||
# Issue #19340: srcdir has been realpath'ed already
|
# Issue #19340: srcdir has been realpath'ed already
|
||||||
|
|
|
@ -46,14 +46,18 @@ if is_emscripten or is_wasi:
|
||||||
def check_output(cmd, encoding=None):
|
def check_output(cmd, encoding=None):
|
||||||
p = subprocess.Popen(cmd,
|
p = subprocess.Popen(cmd,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE)
|
||||||
encoding=encoding)
|
|
||||||
out, err = p.communicate()
|
out, err = p.communicate()
|
||||||
if p.returncode:
|
if p.returncode:
|
||||||
if verbose and err:
|
if verbose and err:
|
||||||
print(err.decode('utf-8', 'backslashreplace'))
|
print(err.decode(encoding or 'utf-8', 'backslashreplace'))
|
||||||
raise subprocess.CalledProcessError(
|
raise subprocess.CalledProcessError(
|
||||||
p.returncode, cmd, out, err)
|
p.returncode, cmd, out, err)
|
||||||
|
if encoding:
|
||||||
|
return (
|
||||||
|
out.decode(encoding, 'backslashreplace'),
|
||||||
|
err.decode(encoding, 'backslashreplace'),
|
||||||
|
)
|
||||||
return out, err
|
return out, err
|
||||||
|
|
||||||
class BaseTest(unittest.TestCase):
|
class BaseTest(unittest.TestCase):
|
||||||
|
@ -281,8 +285,8 @@ class BasicTest(BaseTest):
|
||||||
('get_config_h_filename()', sysconfig.get_config_h_filename())):
|
('get_config_h_filename()', sysconfig.get_config_h_filename())):
|
||||||
with self.subTest(call):
|
with self.subTest(call):
|
||||||
cmd[2] = 'import sysconfig; print(sysconfig.%s)' % call
|
cmd[2] = 'import sysconfig; print(sysconfig.%s)' % call
|
||||||
out, err = check_output(cmd)
|
out, err = check_output(cmd, encoding='utf-8')
|
||||||
self.assertEqual(out.strip(), expected.encode(), err)
|
self.assertEqual(out.strip(), expected, err)
|
||||||
|
|
||||||
@requireVenvCreate
|
@requireVenvCreate
|
||||||
@unittest.skipUnless(can_symlink(), 'Needs symlinks')
|
@unittest.skipUnless(can_symlink(), 'Needs symlinks')
|
||||||
|
@ -303,8 +307,8 @@ class BasicTest(BaseTest):
|
||||||
('get_config_h_filename()', sysconfig.get_config_h_filename())):
|
('get_config_h_filename()', sysconfig.get_config_h_filename())):
|
||||||
with self.subTest(call):
|
with self.subTest(call):
|
||||||
cmd[2] = 'import sysconfig; print(sysconfig.%s)' % call
|
cmd[2] = 'import sysconfig; print(sysconfig.%s)' % call
|
||||||
out, err = check_output(cmd)
|
out, err = check_output(cmd, encoding='utf-8')
|
||||||
self.assertEqual(out.strip(), expected.encode(), err)
|
self.assertEqual(out.strip(), expected, err)
|
||||||
|
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
ENV_SUBDIRS = (
|
ENV_SUBDIRS = (
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
Ensures the ``Py_GIL_DISABLED`` preprocessor variable is defined in
|
||||||
|
:file:`pyconfig.h` so that extension modules written in C are able to use
|
||||||
|
it.
|
|
@ -1,6 +1,4 @@
|
||||||
#ifndef _MSC_VER
|
|
||||||
#include "pyconfig.h" // Py_GIL_DISABLED
|
#include "pyconfig.h" // Py_GIL_DISABLED
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef Py_GIL_DISABLED
|
#ifndef Py_GIL_DISABLED
|
||||||
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
|
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
* using the SystemConfiguration framework.
|
* using the SystemConfiguration framework.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
|
||||||
#include "pyconfig.h" // Py_GIL_DISABLED
|
#include "pyconfig.h" // Py_GIL_DISABLED
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef Py_GIL_DISABLED
|
#ifndef Py_GIL_DISABLED
|
||||||
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
|
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
|
||||||
|
|
|
@ -11,9 +11,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
|
||||||
#include "pyconfig.h" // Py_GIL_DISABLED
|
#include "pyconfig.h" // Py_GIL_DISABLED
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef Py_GIL_DISABLED
|
#ifndef Py_GIL_DISABLED
|
||||||
// Need limited C API version 3.13 for PyModule_Add() on Windows
|
// Need limited C API version 3.13 for PyModule_Add() on Windows
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
#ifndef _MSC_VER
|
|
||||||
#include "pyconfig.h" // Py_GIL_DISABLED
|
#include "pyconfig.h" // Py_GIL_DISABLED
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef Py_GIL_DISABLED
|
#ifndef Py_GIL_DISABLED
|
||||||
#define Py_LIMITED_API 0x030c0000 // 3.12
|
#define Py_LIMITED_API 0x030c0000 // 3.12
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
/* Test Vectorcall in the limited API */
|
/* Test Vectorcall in the limited API */
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
|
||||||
#include "pyconfig.h" // Py_GIL_DISABLED
|
#include "pyconfig.h" // Py_GIL_DISABLED
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef Py_GIL_DISABLED
|
#ifndef Py_GIL_DISABLED
|
||||||
#define Py_LIMITED_API 0x030c0000 // 3.12
|
#define Py_LIMITED_API 0x030c0000 // 3.12
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
#undef Py_BUILD_CORE_MODULE
|
#undef Py_BUILD_CORE_MODULE
|
||||||
#undef Py_BUILD_CORE_BUILTIN
|
#undef Py_BUILD_CORE_BUILTIN
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
|
||||||
#include "pyconfig.h" // Py_GIL_DISABLED
|
#include "pyconfig.h" // Py_GIL_DISABLED
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef Py_GIL_DISABLED
|
#ifndef Py_GIL_DISABLED
|
||||||
// For now, only limited C API 3.13 is supported
|
// For now, only limited C API 3.13 is supported
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
* foo, bar), only the first one is called the same as the compiled file.
|
* foo, bar), only the first one is called the same as the compiled file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
|
||||||
#include "pyconfig.h" // Py_GIL_DISABLED
|
#include "pyconfig.h" // Py_GIL_DISABLED
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef Py_GIL_DISABLED
|
#ifndef Py_GIL_DISABLED
|
||||||
#define Py_LIMITED_API 0x03020000
|
#define Py_LIMITED_API 0x03020000
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
* DCE compatible Universally Unique Identifier library.
|
* DCE compatible Universally Unique Identifier library.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
|
||||||
#include "pyconfig.h" // Py_GIL_DISABLED
|
#include "pyconfig.h" // Py_GIL_DISABLED
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef Py_GIL_DISABLED
|
#ifndef Py_GIL_DISABLED
|
||||||
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
|
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
/* Errno module */
|
/* Errno module */
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
|
||||||
#include "pyconfig.h" // Py_GIL_DISABLED
|
#include "pyconfig.h" // Py_GIL_DISABLED
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef Py_GIL_DISABLED
|
#ifndef Py_GIL_DISABLED
|
||||||
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
|
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
#ifndef _MSC_VER
|
|
||||||
#include "pyconfig.h" // Py_GIL_DISABLED
|
#include "pyconfig.h" // Py_GIL_DISABLED
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef Py_GIL_DISABLED
|
#ifndef Py_GIL_DISABLED
|
||||||
// Need limited C API version 3.13 for PySys_Audit()
|
// Need limited C API version 3.13 for PySys_Audit()
|
||||||
|
|
|
@ -62,9 +62,7 @@
|
||||||
pass
|
pass
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
|
||||||
#include "pyconfig.h" // Py_GIL_DISABLED
|
#include "pyconfig.h" // Py_GIL_DISABLED
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef Py_GIL_DISABLED
|
#ifndef Py_GIL_DISABLED
|
||||||
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
|
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
* See the xxlimited module for an extension module template.
|
* See the xxlimited module for an extension module template.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
|
||||||
#include "pyconfig.h" // Py_GIL_DISABLED
|
#include "pyconfig.h" // Py_GIL_DISABLED
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef Py_GIL_DISABLED
|
#ifndef Py_GIL_DISABLED
|
||||||
#define Py_LIMITED_API 0x03050000
|
#define Py_LIMITED_API 0x03050000
|
||||||
|
|
|
@ -73,7 +73,10 @@ def copy_if_modified(src, dest):
|
||||||
)
|
)
|
||||||
|
|
||||||
if do_copy:
|
if do_copy:
|
||||||
|
try:
|
||||||
shutil.copy2(src, dest)
|
shutil.copy2(src, dest)
|
||||||
|
except FileNotFoundError:
|
||||||
|
raise FileNotFoundError(src) from None
|
||||||
|
|
||||||
|
|
||||||
def get_lib_layout(ns):
|
def get_lib_layout(ns):
|
||||||
|
@ -208,8 +211,7 @@ def get_layout(ns):
|
||||||
|
|
||||||
for dest, src in rglob(ns.source / "Include", "**/*.h"):
|
for dest, src in rglob(ns.source / "Include", "**/*.h"):
|
||||||
yield "include/{}".format(dest), src
|
yield "include/{}".format(dest), src
|
||||||
src = ns.source / "PC" / "pyconfig.h"
|
yield "include/pyconfig.h", ns.build / "pyconfig.h"
|
||||||
yield "include/pyconfig.h", src
|
|
||||||
|
|
||||||
for dest, src in get_tcltk_lib(ns):
|
for dest, src in get_tcltk_lib(ns):
|
||||||
yield dest, src
|
yield dest, src
|
||||||
|
|
|
@ -739,4 +739,7 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
|
||||||
/* Define if libssl has X509_VERIFY_PARAM_set1_host and related function */
|
/* Define if libssl has X509_VERIFY_PARAM_set1_host and related function */
|
||||||
#define HAVE_X509_VERIFY_PARAM_SET1_HOST 1
|
#define HAVE_X509_VERIFY_PARAM_SET1_HOST 1
|
||||||
|
|
||||||
|
/* Define if you want to disable the GIL */
|
||||||
|
#undef Py_GIL_DISABLED
|
||||||
|
|
||||||
#endif /* !Py_CONFIG_H */
|
#endif /* !Py_CONFIG_H */
|
|
@ -35,6 +35,8 @@
|
||||||
winsound.PlaySound(None, 0)
|
winsound.PlaySound(None, 0)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "pyconfig.h" // Py_GIL_DISABLED
|
||||||
|
|
||||||
#ifndef Py_GIL_DISABLED
|
#ifndef Py_GIL_DISABLED
|
||||||
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
|
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
|
||||||
#define Py_LIMITED_API 0x030c0000
|
#define Py_LIMITED_API 0x030c0000
|
||||||
|
|
|
@ -89,6 +89,7 @@
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>Py_NO_ENABLE_SHARED;Py_BUILD_CORE;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>Py_NO_ENABLE_SHARED;Py_BUILD_CORE;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -257,6 +258,9 @@
|
||||||
<ClCompile Include="..\Python\traceback.c" />
|
<ClCompile Include="..\Python\traceback.c" />
|
||||||
<ClCompile Include="..\Python\tracemalloc.c" />
|
<ClCompile Include="..\Python\tracemalloc.c" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\PC\pyconfig.h.in" />
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<!-- BEGIN frozen modules -->
|
<!-- BEGIN frozen modules -->
|
||||||
<None Include="..\Lib\importlib\_bootstrap.py">
|
<None Include="..\Lib\importlib\_bootstrap.py">
|
||||||
|
@ -414,6 +418,32 @@
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
|
||||||
|
<!-- Direct copy from pythoncore.vcxproj, but this one is only used for our
|
||||||
|
own build. All other extension modules will use the copy that pythoncore
|
||||||
|
generates. -->
|
||||||
|
<Target Name="_UpdatePyconfig" BeforeTargets="PrepareForBuild">
|
||||||
|
<MakeDir Directories="$(IntDir)" Condition="!Exists($(IntDir))" />
|
||||||
|
<ItemGroup>
|
||||||
|
<PyConfigH Remove="@(PyConfigH)" />
|
||||||
|
<PyConfigH Include="@(ClInclude)" Condition="'%(Filename)%(Extension)' == 'pyconfig.h.in'" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Error Text="Did not find pyconfig.h" Condition="@(ClInclude) == ''" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PyConfigH>@(PyConfigH->'%(FullPath)', ';')</PyConfigH>
|
||||||
|
<PyConfigHText>$([System.IO.File]::ReadAllText($(PyConfigH)))</PyConfigHText>
|
||||||
|
<OldPyConfigH Condition="Exists('$(IntDir)pyconfig.h')">$([System.IO.File]::ReadAllText('$(IntDir)pyconfig.h'))</OldPyConfigH>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="$(DisableGil) == 'true'">
|
||||||
|
<PyConfigHText>$(PyConfigHText.Replace('#undef Py_GIL_DISABLED', '#define Py_GIL_DISABLED 1'))</PyConfigHText>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Message Text="Updating pyconfig.h" Condition="$(PyConfigHText.TrimEnd()) != $(OldPyConfigH.TrimEnd())" />
|
||||||
|
<WriteLinesToFile File="$(IntDir)pyconfig.h"
|
||||||
|
Lines="$(PyConfigHText)"
|
||||||
|
Overwrite="true"
|
||||||
|
Condition="$(PyConfigHText.TrimEnd()) != $(OldPyConfigH.TrimEnd())" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
<Target Name="_RebuildGetPath" AfterTargets="_RebuildFrozen" Condition="$(Configuration) != 'PGUpdate'">
|
<Target Name="_RebuildGetPath" AfterTargets="_RebuildFrozen" Condition="$(Configuration) != 'PGUpdate'">
|
||||||
<Exec Command='"$(TargetPath)" "%(GetPath.ModName)" "%(GetPath.FullPath)" "%(GetPath.IntFile)"' />
|
<Exec Command='"$(TargetPath)" "%(GetPath.ModName)" "%(GetPath.FullPath)" "%(GetPath.IntFile)"' />
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
<Py_IntDir Condition="'$(Py_IntDir)' == ''">$(MSBuildThisFileDirectory)obj\</Py_IntDir>
|
<Py_IntDir Condition="'$(Py_IntDir)' == ''">$(MSBuildThisFileDirectory)obj\</Py_IntDir>
|
||||||
<IntDir>$(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)$(ArchName)_$(Configuration)\$(ProjectName)\</IntDir>
|
<IntDir>$(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)$(ArchName)_$(Configuration)\$(ProjectName)\</IntDir>
|
||||||
<IntDir>$(IntDir.Replace(`\\`, `\`))</IntDir>
|
<IntDir>$(IntDir.Replace(`\\`, `\`))</IntDir>
|
||||||
|
<!-- pyconfig.h is updated by pythoncore.vcxproj, so it's always in pythoncore's IntDir -->
|
||||||
|
<GeneratedPyConfigDir>$(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)$(ArchName)_$(Configuration)\pythoncore\</GeneratedPyConfigDir>
|
||||||
<TargetName Condition="'$(TargetName)' == ''">$(ProjectName)</TargetName>
|
<TargetName Condition="'$(TargetName)' == ''">$(ProjectName)</TargetName>
|
||||||
<TargetName>$(TargetName)$(PyDebugExt)</TargetName>
|
<TargetName>$(TargetName)$(PyDebugExt)</TargetName>
|
||||||
<GenerateManifest>false</GenerateManifest>
|
<GenerateManifest>false</GenerateManifest>
|
||||||
|
@ -38,9 +40,8 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)Include\internal;$(PySourcePath)Include\internal\mimalloc;$(PySourcePath)PC;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)Include\internal;$(PySourcePath)Include\internal\mimalloc;$(GeneratedPyConfigDir);$(PySourcePath)PC;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;$(_Py3NamePreprocessorDefinition);$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;$(_Py3NamePreprocessorDefinition);$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(DisableGil)' == 'true'">Py_GIL_DISABLED=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<PreprocessorDefinitions Condition="'$(SupportPGO)' and ($(Configuration) == 'PGInstrument' or $(Configuration) == 'PGUpdate')">_Py_USING_PGO=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(SupportPGO)' and ($(Configuration) == 'PGInstrument' or $(Configuration) == 'PGUpdate')">_Py_USING_PGO=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
@ -60,6 +61,7 @@
|
||||||
<AdditionalOptions Condition="$(PlatformToolset) == 'ClangCL'">-Wno-deprecated-non-prototype -Wno-unused-label -Wno-pointer-sign -Wno-incompatible-pointer-types-discards-qualifiers -Wno-unused-function %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions Condition="$(PlatformToolset) == 'ClangCL'">-Wno-deprecated-non-prototype -Wno-unused-label -Wno-pointer-sign -Wno-incompatible-pointer-types-discards-qualifiers -Wno-unused-function %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalOptions Condition="$(Configuration) != 'Debug' and $(PlatformToolset) == 'ClangCL'">-flto %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions Condition="$(Configuration) != 'Debug' and $(PlatformToolset) == 'ClangCL'">-flto %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalOptions Condition="$(MSVCHasBrokenARM64Clamping) == 'true' and $(Platform) == 'ARM64'">-d2pattern-opt-disable:-932189325 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions Condition="$(MSVCHasBrokenARM64Clamping) == 'true' and $(Platform) == 'ARM64'">-d2pattern-opt-disable:-932189325 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<AdditionalOptions Condition="$(GenerateSourceDependencies) == 'true'">/sourceDependencies "$(IntDir.Trim(`\`))" %(AdditionalOptions)</AdditionalOptions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Condition="$(Configuration) == 'Debug'">
|
<ClCompile Condition="$(Configuration) == 'Debug'">
|
||||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||||
|
|
|
@ -378,7 +378,7 @@
|
||||||
<ClInclude Include="..\Parser\string_parser.h" />
|
<ClInclude Include="..\Parser\string_parser.h" />
|
||||||
<ClInclude Include="..\Parser\pegen.h" />
|
<ClInclude Include="..\Parser\pegen.h" />
|
||||||
<ClInclude Include="..\PC\errmap.h" />
|
<ClInclude Include="..\PC\errmap.h" />
|
||||||
<ClInclude Include="..\PC\pyconfig.h" />
|
<ClInclude Include="..\PC\pyconfig.h.in" />
|
||||||
<ClInclude Include="..\Python\condvar.h" />
|
<ClInclude Include="..\Python\condvar.h" />
|
||||||
<ClInclude Include="..\Python\stdlib_module_names.h" />
|
<ClInclude Include="..\Python\stdlib_module_names.h" />
|
||||||
<ClInclude Include="..\Python\thread_nt.h" />
|
<ClInclude Include="..\Python\thread_nt.h" />
|
||||||
|
@ -646,6 +646,35 @@
|
||||||
<Import Project="regen.targets" />
|
<Import Project="regen.targets" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<Target Name="_TriggerRegen" BeforeTargets="PrepareForBuild" DependsOnTargets="Regen" />
|
<Target Name="_TriggerRegen" BeforeTargets="PrepareForBuild" DependsOnTargets="Regen" />
|
||||||
|
|
||||||
|
<Target Name="_UpdatePyconfig" BeforeTargets="PrepareForBuild">
|
||||||
|
<MakeDir Directories="$(IntDir)" Condition="!Exists($(IntDir))" />
|
||||||
|
<ItemGroup>
|
||||||
|
<PyConfigH Remove="@(PyConfigH)" />
|
||||||
|
<PyConfigH Include="@(ClInclude)" Condition="'%(Filename)%(Extension)' == 'pyconfig.h.in'" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Error Text="Did not find pyconfig.h" Condition="@(ClInclude) == ''" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PyConfigH>@(PyConfigH->'%(FullPath)', ';')</PyConfigH>
|
||||||
|
<PyConfigHText>$([System.IO.File]::ReadAllText($(PyConfigH)))</PyConfigHText>
|
||||||
|
<OldPyConfigH Condition="Exists('$(IntDir)pyconfig.h')">$([System.IO.File]::ReadAllText('$(IntDir)pyconfig.h'))</OldPyConfigH>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="$(DisableGil) == 'true'">
|
||||||
|
<PyConfigHText>$(PyConfigHText.Replace('#undef Py_GIL_DISABLED', '#define Py_GIL_DISABLED 1'))</PyConfigHText>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Message Text="Updating pyconfig.h" Condition="$(PyConfigHText.TrimEnd()) != $(OldPyConfigH.TrimEnd())" />
|
||||||
|
<WriteLinesToFile File="$(IntDir)pyconfig.h"
|
||||||
|
Lines="$(PyConfigHText)"
|
||||||
|
Overwrite="true"
|
||||||
|
Condition="$(PyConfigHText.TrimEnd()) != $(OldPyConfigH.TrimEnd())" />
|
||||||
|
</Target>
|
||||||
|
<Target Name="_CopyPyconfig" Inputs="$(IntDir)pyconfig.h" Outputs="$(OutDir)pyconfig.h" AfterTargets="Build" DependsOnTargets="_UpdatePyconfig">
|
||||||
|
<Copy SourceFiles="$(IntDir)pyconfig.h" DestinationFolder="$(OutDir)" />
|
||||||
|
</Target>
|
||||||
|
<Target Name="_CleanPyconfig" AfterTargets="Clean">
|
||||||
|
<Delete Files="$(IntDir)pyconfig.h;$(OutDir)pyconfig.h" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
<Target Name="_GetBuildInfo" BeforeTargets="PrepareForBuild">
|
<Target Name="_GetBuildInfo" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<GIT Condition="$(GIT) == ''">git</GIT>
|
<GIT Condition="$(GIT) == ''">git</GIT>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<ComponentGroup Id="dev_pyconfig">
|
<ComponentGroup Id="dev_pyconfig">
|
||||||
<Component Id="include_pyconfig.h" Directory="include" Guid="*">
|
<Component Id="include_pyconfig.h" Directory="include" Guid="*">
|
||||||
<File Id="include_pyconfig.h" Name="pyconfig.h" Source="!(bindpath.src)PC\pyconfig.h" KeyPath="yes" />
|
<File Id="include_pyconfig.h" Name="pyconfig.h" Source="pyconfig.h" KeyPath="yes" />
|
||||||
</Component>
|
</Component>
|
||||||
</ComponentGroup>
|
</ComponentGroup>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
|
|
|
@ -143,6 +143,10 @@ def compile_c_extension(
|
||||||
str(MOD_DIR.parent.parent.parent / "Parser" / "lexer"),
|
str(MOD_DIR.parent.parent.parent / "Parser" / "lexer"),
|
||||||
str(MOD_DIR.parent.parent.parent / "Parser" / "tokenizer"),
|
str(MOD_DIR.parent.parent.parent / "Parser" / "tokenizer"),
|
||||||
]
|
]
|
||||||
|
if sys.platform == "win32":
|
||||||
|
# HACK: The location of pyconfig.h has moved within our build, and
|
||||||
|
# setuptools hasn't updated for it yet. So add the path manually for now
|
||||||
|
include_dirs.append(pathlib.Path(sysconfig.get_config_h_filename()).parent)
|
||||||
extension = Extension(
|
extension = Extension(
|
||||||
extension_name,
|
extension_name,
|
||||||
sources=[generated_source_path],
|
sources=[generated_source_path],
|
||||||
|
|
Loading…
Reference in New Issue