]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #24986: Allow building Python without external libraries on Windows
authorZachary Ware <zachary.ware@gmail.com>
Fri, 4 Sep 2015 04:27:05 +0000 (23:27 -0500)
committerZachary Ware <zachary.ware@gmail.com>
Fri, 4 Sep 2015 04:27:05 +0000 (23:27 -0500)
This modifies the behavior of the '-e' flag to PCbuild\build.bat: when '-e'
is not supplied, no attempt will be made to build extension modules that
require external libraries, even if the external libraries are present.

Also adds '--no-<module>' flags to PCbuild\build.bat, where '<module>' is
one of 'ssl', 'tkinter', or 'bsddb', to allow skipping just those modules
(if '-e' is given).

Misc/NEWS
PCbuild/build.bat
PCbuild/pcbuild.proj

index 9ae25b4dfc8abfe7636f440ec0e46300456d7fe1..e77ba3449f9663e644c4746ff2a49d4f8134c11a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -134,6 +134,9 @@ Library
 Build
 -----
 
+- Issue #24986: It is now possible to build Python on Windows without errors
+  when external libraries are not available.
+
 - Issue #24508: Backported the MSBuild project files from Python 3.5.  The
   backported files replace the old project files in PCbuild; the old files moved
   to PC/VS9.0 and remain supported.
index cd88d3b7a8c87115f1d080ec67c4bc2f51d0e339..70d88ea08e5b0e48c662dffd094b09e3c43b2716 100644 (file)
@@ -17,12 +17,20 @@ echo.  -h  Display this help message
 echo.  -r  Target Rebuild instead of Build\r
 echo.  -d  Set the configuration to Debug\r
 echo.  -e  Build external libraries fetched by get_externals.bat\r
+echo.      Extension modules that depend on external libraries will not attempt\r
+echo.      to build if this flag is not present\r
 echo.  -m  Enable parallel build\r
 echo.  -M  Disable parallel build (disabled by default)\r
 echo.  -v  Increased output messages\r
 echo.  -k  Attempt to kill any running Pythons before building (usually done\r
 echo.      automatically by the pythoncore project)\r
 echo.\r
+echo.Available flags to avoid building certain modules.\r
+echo.These flags have no effect if '-e' is not given:\r
+echo.  --no-ssl      Do not attempt to build _ssl\r
+echo.  --no-tkinter  Do not attempt to build Tkinter\r
+echo.  --no-bsddb    Do not attempt to build _bsddb\r
+echo.\r
 echo.Available arguments:\r
 echo.  -c Release ^| Debug ^| PGInstrument ^| PGUpdate\r
 echo.     Set the configuration (default: Release)\r
@@ -50,11 +58,22 @@ if "%~1"=="-p" (set platf=%2) & shift & shift & goto CheckOpts
 if "%~1"=="-r" (set target=Rebuild) & shift & goto CheckOpts\r
 if "%~1"=="-t" (set target=%2) & shift & shift & goto CheckOpts\r
 if "%~1"=="-d" (set conf=Debug) & shift & goto CheckOpts\r
-if "%~1"=="-e" call "%dir%get_externals.bat" & shift & goto CheckOpts\r
 if "%~1"=="-m" (set parallel=/m) & shift & goto CheckOpts\r
 if "%~1"=="-M" (set parallel=) & shift & goto CheckOpts\r
 if "%~1"=="-v" (set verbose=/v:n) & shift & goto CheckOpts\r
 if "%~1"=="-k" (set kill=true) & shift & goto CheckOpts\r
+rem These use the actual property names used by MSBuild.  We could just let\r
+rem them in through the environment, but we specify them on the command line\r
+rem anyway for visibility so set defaults after this\r
+if "%~1"=="-e" (set IncludeExternals=true) & call "%dir%get_externals.bat" & shift & goto CheckOpts\r
+if "%~1"=="--no-ssl" (set IncludeSSL=false) & shift & goto CheckOpts\r
+if "%~1"=="--no-tkinter" (set IncludeTkinter=false) & shift & goto CheckOpts\r
+if "%~1"=="--no-bsddb" (set IncludeBsddb=false) & shift & goto CheckOpts\r
+\r
+if "%IncludeExternals%"=="" set IncludeExternals=false\r
+if "%IncludeSSL%"=="" set IncludeSSL=true\r
+if "%IncludeTkinter%"=="" set IncludeTkinter=true\r
+if "%IncludeBsddb%"=="" set IncludeBsddb=true\r
 \r
 if "%platf%"=="x64" (set vs_platf=x86_amd64)\r
 \r
@@ -69,4 +88,9 @@ rem Call on MSBuild to do the work, echo the command.
 rem Passing %1-9 is not the preferred option, but argument parsing in\r
 rem batch is, shall we say, "lackluster"\r
 echo on\r
-msbuild "%dir%pcbuild.proj" /t:%target% %parallel% %verbose% /p:Configuration=%conf% /p:Platform=%platf% %1 %2 %3 %4 %5 %6 %7 %8 %9\r
+msbuild "%dir%pcbuild.proj" /t:%target% %parallel% %verbose%^\r
+ /p:Configuration=%conf% /p:Platform=%platf%^\r
+ /p:IncludeExternals=%IncludeExternals%^\r
+ /p:IncludeSSL=%IncludeSSL% /p:IncludeTkinter=%IncludeTkinter%^\r
+ /p:IncludeBsddb=%IncludeBsddb%^\r
+ %1 %2 %3 %4 %5 %6 %7 %8 %9\r
index 09563974376de8c1b2ac5f16969706e40ff1e15f..1f95fa543ded192c3fce188ef2ed4ad40cc0d7c2 100644 (file)
@@ -5,8 +5,11 @@
     <Platform Condition="'$(Platform)' == ''">Win32</Platform>
     <Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
     <IncludeExtensions Condition="'$(IncludeExtensions)' == ''">true</IncludeExtensions>
+    <IncludeExternals Condition="'$(IncludeExternals)' == ''">true</IncludeExternals>
     <IncludeTests Condition="'$(IncludeTest)' == ''">true</IncludeTests>
     <IncludeSSL Condition="'$(IncludeSSL)' == ''">true</IncludeSSL>
+    <IncludeTkinter Condition="'$(IncludeTkinter)' == ''">true</IncludeTkinter>
+    <IncludeBsddb Condition="'$(IncludeBsddb)' == ''">true</IncludeBsddb>
   </PropertyGroup>
 
   <ItemDefinitionGroup>
     <!-- python[w].exe -->
     <Projects Include="python.vcxproj;pythonw.vcxproj" />
     <!-- Extension modules -->
-    <ExtensionModules Include="_bsddb;bz2;_ctypes;_elementtree;_msi;_multiprocessing;_sqlite3;_tkinter;tix;pyexpat;select;unicodedata;winsound" />
+    <ExtensionModules Include="_ctypes;_elementtree;_msi;_multiprocessing;pyexpat;select;unicodedata;winsound" />
+    <!-- Extension modules that require external sources -->
+    <ExternalModules Include="bz2;_sqlite3" />
     <!-- _ssl will build _socket as well, which may cause conflicts in parallel builds -->
-    <ExtensionModules Include="_socket" Condition="!$(IncludeSSL)" />
-    <ExtensionModules Include="_ssl;_hashlib" Condition="$(IncludeSSL)" />
+    <ExtensionModules Include="_socket" Condition="!$(IncludeSSL) or !$(IncludeExternals)" />
+    <ExternalModules Include="_ssl;_hashlib" Condition="$(IncludeSSL)" />
+    <ExternalModules Include="_tkinter;tix" Condition="$(IncludeTkinter)" />
+    <ExternalModules Include="_bsddb" Condition="$(IncludeBsddb)" />
+    <ExtensionModules Include="@(ExternalModules->'%(Identity)')" Condition="$(IncludeExternals)" />
     <Projects Include="@(ExtensionModules->'%(Identity).vcxproj')" Condition="$(IncludeExtensions)" />
     <!-- Test modules -->
     <TestModules Include="_ctypes_test;_testcapi" />