get_externals.bat revision 947f411b0d890925bc00ab88b120da725ab0e897
1@echo off
2setlocal
3rem Simple script to fetch source for external libraries
4
5if not exist "%~dp0..\externals" mkdir "%~dp0..\externals"
6pushd "%~dp0..\externals"
7
8if "%SVNROOT%"=="" set SVNROOT=http://svn.python.org/projects/external/
9
10rem Optionally clean up first.  Be warned that this can be very destructive!
11if not "%1"=="" (
12    for %%c in (-c --clean --clean-only) do (
13        if "%1"=="%%c" goto clean
14    )
15    goto usage
16)
17goto fetch
18
19:clean
20echo.Cleaning up external libraries.
21for /D %%d in (
22               bzip2-*
23               db-*
24               nasm-*
25               openssl-*
26               tcl-*
27               tcltk*
28               tk-*
29               tix-*
30               sqlite-*
31               xz-*
32               ) do (
33    echo.Removing %%d
34    rmdir /s /q %%d
35)
36if "%1"=="--clean-only" (
37    goto end
38)
39
40:fetch
41rem Fetch current versions
42
43svn --version > nul 2>&1
44if ERRORLEVEL 9009 (
45    echo.svn.exe must be on your PATH.
46    echo.Try TortoiseSVN (http://tortoisesvn.net/^) and be sure to check the
47    echo.command line tools option.
48    popd
49    exit /b 1
50)
51
52echo.Fetching external libraries...
53
54set libraries=
55set libraries=%libraries%                                    bzip2-1.0.6
56if NOT "%IncludeSSL%"=="false" set libraries=%libraries%     nasm-2.11.06
57if NOT "%IncludeSSL%"=="false" set libraries=%libraries%     openssl-1.0.2g
58set libraries=%libraries%                                    sqlite-3.8.11.0
59if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tcl-core-8.6.4.2
60if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tk-8.6.4.2
61if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tix-8.4.3.6
62set libraries=%libraries%                                    xz-5.0.5
63
64for %%e in (%libraries%) do (
65    if exist %%e (
66        echo.%%e already exists, skipping.
67    ) else (
68        echo.Fetching %%e...
69        svn export %SVNROOT%%%e
70    )
71)
72
73goto end
74
75:usage
76echo.invalid argument: %1
77echo.usage: %~n0 [[ -c ^| --clean ] ^| --clean-only ]
78echo.
79echo.Pull all sources necessary for compiling optional extension modules
80echo.that rely on external libraries.  Requires svn.exe to be on your PATH
81echo.and pulls sources from %SVNROOT%.
82echo.
83echo.Use the -c or --clean option to clean up all external library sources
84echo.before pulling in the current versions.
85echo.
86echo.Use the --clean-only option to do the same cleaning, without pulling in
87echo.anything new.
88echo.
89echo.Only the first argument is checked, all others are ignored.
90echo.
91echo.**WARNING**: the cleaning options unconditionally remove any directory
92echo.that is a child of
93echo.   %CD%
94echo.and matches wildcard patterns beginning with bzip2-, db-, nasm-, openssl-,
95echo.tcl-, tcltk, tk-, tix-, sqlite-, or xz-, and as such has the potential
96echo.to be very destructive if you are not aware of what it is doing.  Use with
97echo.caution!
98popd
99exit /b -1
100
101
102:end
103echo Finished.
104popd
105