From 96d97ec9c08a95201e9d7f0b7819ca6328002693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Sat, 28 Jul 2012 20:46:52 +0200 Subject: =?UTF-8?q?Issue=20#15431:=20Add=20=5Ffreeze=5Fimportlib=20project?= =?UTF-8?q?=20to=20regenerate=20importlib.h=20on=20Windows.=20Patch=20by?= =?UTF-8?q?=20Kristj=C3=A1n=20Valur=20J=C3=B3nsson.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Misc/NEWS | 3 + Modules/_freeze_importlib.c | 11 +- PCbuild/_freeze_importlib.vcxproj | 188 ++++++++++++++++++++++++++++++ PCbuild/_freeze_importlib.vcxproj.filters | 27 +++++ PCbuild/pcbuild.sln | 16 +++ 5 files changed, 241 insertions(+), 4 deletions(-) create mode 100644 PCbuild/_freeze_importlib.vcxproj create mode 100644 PCbuild/_freeze_importlib.vcxproj.filters diff --git a/Misc/NEWS b/Misc/NEWS index 382544c..31a99c8 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -256,6 +256,9 @@ Tests Build ----- +- Issue #15431: Add _freeze_importlib project to regenerate importlib.h + on Windows. Patch by Kristján Valur Jónsson. + - Issue #14197: For OS X framework builds, ensure links to the shared library are created with the proper ABI suffix. diff --git a/Modules/_freeze_importlib.c b/Modules/_freeze_importlib.c index 0900d37..a96e76e 100644 --- a/Modules/_freeze_importlib.c +++ b/Modules/_freeze_importlib.c @@ -8,7 +8,9 @@ #include #include #include +#ifndef MS_WINDOWS #include +#endif /* To avoid a circular dependency on frozen.o, we create our own structure @@ -19,9 +21,6 @@ static struct _frozen _PyImport_FrozenModules[] = { {0, 0, 0} /* sentinel */ }; -struct _frozen *PyImport_FrozenModules = _PyImport_FrozenModules; - - const char header[] = "/* Auto-generated by Modules/_freeze_importlib.c */"; int @@ -35,6 +34,8 @@ main(int argc, char *argv[]) unsigned char *data; PyObject *code, *marshalled; + PyImport_FrozenModules = _PyImport_FrozenModules; + if (argc != 3) { fprintf(stderr, "need to specify input and output paths\n"); return 2; @@ -89,7 +90,9 @@ main(int argc, char *argv[]) data = (unsigned char *) PyBytes_AS_STRING(marshalled); data_size = PyBytes_GET_SIZE(marshalled); - outfile = fopen(outpath, "wb"); + /* Open the file in text mode. The hg checkout should be using the eol extension, + which in turn should cause the existing file to use CRLF */ + outfile = fopen(outpath, "wt"); if (outfile == NULL) { fprintf(stderr, "cannot open '%s' for writing\n", outpath); return 1; diff --git a/PCbuild/_freeze_importlib.vcxproj b/PCbuild/_freeze_importlib.vcxproj new file mode 100644 index 0000000..55197af --- /dev/null +++ b/PCbuild/_freeze_importlib.vcxproj @@ -0,0 +1,188 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {19C0C13F-47CA-4432-AFF3-799A296A4DDC} + Win32Proj + _freeze_importlib + + + + Application + true + Unicode + + + Application + true + Unicode + + + Application + false + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + + + $(TargetPath) ..\Lib\importlib\_bootstrap.py ..\Python\importlib.h + + + creating importlib.h + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + + + $(TargetPath) ..\Lib\importlib\_bootstrap.py ..\Python\importlib.h + + + creating importlib.h + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + + + $(TargetPath) ..\Lib\importlib\_bootstrap.py ..\Python\importlib.h + + + creating importlib.h + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + + + $(TargetPath) ..\Lib\importlib\_bootstrap.py ..\Python\importlib.h + + + creating importlib.h + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + true + true + false + true + false + + + + + + + + + \ No newline at end of file diff --git a/PCbuild/_freeze_importlib.vcxproj.filters b/PCbuild/_freeze_importlib.vcxproj.filters new file mode 100644 index 0000000..50ec193 --- /dev/null +++ b/PCbuild/_freeze_importlib.vcxproj.filters @@ -0,0 +1,27 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + + + Source Files + + + \ No newline at end of file diff --git a/PCbuild/pcbuild.sln b/PCbuild/pcbuild.sln index 327757e..ee39e17 100644 --- a/PCbuild/pcbuild.sln +++ b/PCbuild/pcbuild.sln @@ -72,6 +72,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pylauncher", "pylauncher.vc EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pywlauncher", "pywlauncher.vcxproj", "{1D4B18D3-7C12-4ECB-9179-8531FF876CE6}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_freeze_importlib", "_freeze_importlib.vcxproj", "{19C0C13F-47CA-4432-AFF3-799A296A4DDC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -600,6 +602,20 @@ Global {1D4B18D3-7C12-4ECB-9179-8531FF876CE6}.Release|Win32.Build.0 = Release|Win32 {1D4B18D3-7C12-4ECB-9179-8531FF876CE6}.Release|x64.ActiveCfg = Release|Win32 {1D4B18D3-7C12-4ECB-9179-8531FF876CE6}.Release|x64.Build.0 = Release|Win32 + {19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Debug|Win32.ActiveCfg = Debug|Win32 + {19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Debug|Win32.Build.0 = Debug|Win32 + {19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Debug|x64.ActiveCfg = Debug|x64 + {19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Debug|x64.Build.0 = Debug|x64 + {19C0C13F-47CA-4432-AFF3-799A296A4DDC}.PGInstrument|Win32.ActiveCfg = Release|Win32 + {19C0C13F-47CA-4432-AFF3-799A296A4DDC}.PGInstrument|Win32.Build.0 = Release|Win32 + {19C0C13F-47CA-4432-AFF3-799A296A4DDC}.PGInstrument|x64.ActiveCfg = Release|Win32 + {19C0C13F-47CA-4432-AFF3-799A296A4DDC}.PGUpdate|Win32.ActiveCfg = Release|Win32 + {19C0C13F-47CA-4432-AFF3-799A296A4DDC}.PGUpdate|Win32.Build.0 = Release|Win32 + {19C0C13F-47CA-4432-AFF3-799A296A4DDC}.PGUpdate|x64.ActiveCfg = Release|Win32 + {19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Release|Win32.ActiveCfg = Release|Win32 + {19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Release|Win32.Build.0 = Release|Win32 + {19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Release|x64.ActiveCfg = Release|x64 + {19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE -- cgit v0.12