summaryrefslogtreecommitdiff
path: root/PCbuild
diff options
context:
space:
mode:
authorZachary Ware <zachary.ware@gmail.com>2015-09-03 23:27:05 -0500
committerZachary Ware <zachary.ware@gmail.com>2015-09-03 23:27:05 -0500
commit1db43f98d525ab108160f92b67c8851080507804 (patch)
treee99cd4330fe6560e2449412b89e312d0128e1f42 /PCbuild
parent7ab6cb44e46ce36e8cbb7c6fcfee032c638c8f7b (diff)
downloadcpython-git-1db43f98d525ab108160f92b67c8851080507804.tar.gz
Issue #24986: Allow building Python without external libraries on Windows
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).
Diffstat (limited to 'PCbuild')
-rw-r--r--PCbuild/build.bat28
-rw-r--r--PCbuild/pcbuild.proj14
2 files changed, 37 insertions, 5 deletions
diff --git a/PCbuild/build.bat b/PCbuild/build.bat
index cd88d3b7a8..70d88ea08e 100644
--- a/PCbuild/build.bat
+++ b/PCbuild/build.bat
@@ -17,12 +17,20 @@ echo. -h Display this help message
echo. -r Target Rebuild instead of Build
echo. -d Set the configuration to Debug
echo. -e Build external libraries fetched by get_externals.bat
+echo. Extension modules that depend on external libraries will not attempt
+echo. to build if this flag is not present
echo. -m Enable parallel build
echo. -M Disable parallel build (disabled by default)
echo. -v Increased output messages
echo. -k Attempt to kill any running Pythons before building (usually done
echo. automatically by the pythoncore project)
echo.
+echo.Available flags to avoid building certain modules.
+echo.These flags have no effect if '-e' is not given:
+echo. --no-ssl Do not attempt to build _ssl
+echo. --no-tkinter Do not attempt to build Tkinter
+echo. --no-bsddb Do not attempt to build _bsddb
+echo.
echo.Available arguments:
echo. -c Release ^| Debug ^| PGInstrument ^| PGUpdate
echo. Set the configuration (default: Release)
@@ -50,11 +58,22 @@ if "%~1"=="-p" (set platf=%2) & shift & shift & goto CheckOpts
if "%~1"=="-r" (set target=Rebuild) & shift & goto CheckOpts
if "%~1"=="-t" (set target=%2) & shift & shift & goto CheckOpts
if "%~1"=="-d" (set conf=Debug) & shift & goto CheckOpts
-if "%~1"=="-e" call "%dir%get_externals.bat" & shift & goto CheckOpts
if "%~1"=="-m" (set parallel=/m) & shift & goto CheckOpts
if "%~1"=="-M" (set parallel=) & shift & goto CheckOpts
if "%~1"=="-v" (set verbose=/v:n) & shift & goto CheckOpts
if "%~1"=="-k" (set kill=true) & shift & goto CheckOpts
+rem These use the actual property names used by MSBuild. We could just let
+rem them in through the environment, but we specify them on the command line
+rem anyway for visibility so set defaults after this
+if "%~1"=="-e" (set IncludeExternals=true) & call "%dir%get_externals.bat" & shift & goto CheckOpts
+if "%~1"=="--no-ssl" (set IncludeSSL=false) & shift & goto CheckOpts
+if "%~1"=="--no-tkinter" (set IncludeTkinter=false) & shift & goto CheckOpts
+if "%~1"=="--no-bsddb" (set IncludeBsddb=false) & shift & goto CheckOpts
+
+if "%IncludeExternals%"=="" set IncludeExternals=false
+if "%IncludeSSL%"=="" set IncludeSSL=true
+if "%IncludeTkinter%"=="" set IncludeTkinter=true
+if "%IncludeBsddb%"=="" set IncludeBsddb=true
if "%platf%"=="x64" (set vs_platf=x86_amd64)
@@ -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
rem batch is, shall we say, "lackluster"
echo on
-msbuild "%dir%pcbuild.proj" /t:%target% %parallel% %verbose% /p:Configuration=%conf% /p:Platform=%platf% %1 %2 %3 %4 %5 %6 %7 %8 %9
+msbuild "%dir%pcbuild.proj" /t:%target% %parallel% %verbose%^
+ /p:Configuration=%conf% /p:Platform=%platf%^
+ /p:IncludeExternals=%IncludeExternals%^
+ /p:IncludeSSL=%IncludeSSL% /p:IncludeTkinter=%IncludeTkinter%^
+ /p:IncludeBsddb=%IncludeBsddb%^
+ %1 %2 %3 %4 %5 %6 %7 %8 %9
diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj
index 0956397437..1f95fa543d 100644
--- a/PCbuild/pcbuild.proj
+++ b/PCbuild/pcbuild.proj
@@ -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>
@@ -34,10 +37,15 @@
<!-- 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" />