Debian Codegraph @

cpython27/PCbuild/get_externals.bat

raw
1 @echo off
2 setlocal
3 rem Simple script to fetch source for external libraries
4
5 if NOT DEFINED PCBUILD (set PCBUILD=%~dp0)
6 if NOT DEFINED EXTERNALS_DIR (set EXTERNALS_DIR=%PCBUILD%\..\externals)
7
8 set DO_FETCH=true
9 set DO_CLEAN=false
10
11 :CheckOpts
12 if "%~1"=="--no-tkinter" (set IncludeTkinter=false) & shift & goto CheckOpts
13 if "%~1"=="--no-openssl" (set IncludeSSL=false) & shift & goto CheckOpts
14 if "%~1"=="--python" (set PYTHON_FOR_BUILD=%2) & shift & shift & goto CheckOpts
15 if "%~1"=="--organization" (set ORG=%2) & shift & shift & goto CheckOpts
16 if "%~1"=="-c" (set DO_CLEAN=true) & shift & goto CheckOpts
17 if "%~1"=="--clean" (set DO_CLEAN=true) & shift & goto CheckOpts
18 if "%~1"=="--clean-only" (set DO_FETCH=false) & goto clean
19 if "x%~1" NEQ "x" goto usage
20
21 if "%DO_CLEAN%"=="false" goto fetch
22 :clean
23 echo.Cleaning up external libraries.
24 if exist "%EXTERNALS_DIR%" (
25 rem Sometimes this fails the first time; try it twice
26 rmdir /s /q "%EXTERNALS_DIR%" || rmdir /s /q "%EXTERNALS_DIR%"
27 )
28
29 if "%DO_FETCH%"=="false" goto end
30 :fetch
31
32 if "%ORG%"=="" (set ORG=python)
33 call "%PCBUILD%\find_python.bat" "%PYTHON%"
34
35 git 2>&1 > nul
36 if ERRORLEVEL 9009 (
37 if NOT DEFINED PYTHON (
38 echo Python 3.6 could not be found or installed, and git.exe is not on your PATH && exit /B 1
39 )
40 )
41
42 echo.Fetching external libraries...
43
44 rem When updating these versions, remember to update the relevant property
45 rem files in both this dir and PC\VS9.0
46
47 set libraries=
48 set libraries=%libraries% bzip2-1.0.6
49 if NOT "%IncludeBsddb%"=="false" set libraries=%libraries% bsddb-4.7.25.0
50 if NOT "%IncludeSSL%"=="false" set libraries=%libraries% openssl-1.0.2t
51 set libraries=%libraries% sqlite-3.28.0.0
52 if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tcl-8.5.19.0
53 if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tk-8.5.19.0
54 if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tix-8.4.3.5
55
56 for %%e in (%libraries%) do (
57 if exist "%EXTERNALS_DIR%\%%e" (
58 echo.%%e already exists, skipping.
59 ) else if NOT DEFINED PYTHON (
60 echo.Fetching %%e with git...
61 git clone --depth 1 https://github.com/%ORG%/cpython-source-deps --branch %%e "%EXTERNALS_DIR%\%%e"
62 ) else (
63 echo.Fetching %%e...
64 %PYTHON% "%PCBUILD%\get_external.py" -O %ORG% %%e
65 )
66 )
67
68 echo.Fetching external binaries...
69
70 set binaries=
71 set binaries=%binaries%
72 if NOT "%IncludeSSL%"=="false" set binaries=%binaries% nasm-2.11.06
73
74 for %%b in (%binaries%) do (
75 if exist "%EXTERNALS_DIR%\%%b" (
76 echo.%%b already exists, skipping.
77 ) else if NOT DEFINED PYTHON (
78 echo.Fetching %%b with git...
79 git clone --depth 1 https://github.com/%ORG%/cpython-bin-deps --branch %%b "%EXTERNALS_DIR%\%%b"
80 ) else (
81 echo.Fetching %%b...
82 %PYTHON% "%PCBUILD%\get_external.py" -b -O %ORG% %%b
83 )
84 )
85
86 echo Finished.
87 goto end
88
89 :usage
90 echo.Valid options: -c, --clean, --clean-only, --organization, --python,
91 echo.--no-tkinter, --no-openssl
92 echo.
93 echo.Pull all sources and binaries necessary for compiling optional extension
94 echo.modules that rely on external libraries.
95 echo.
96 echo.The --organization option determines which github organization to download
97 echo.from, the --python option determines which Python 3.6+ interpreter to use
98 echo.with PCbuild\get_external.py.
99 echo.
100 echo.Use the -c or --clean option to remove the entire externals directory.
101 echo.
102 echo.Use the --clean-only option to do the same cleaning, without pulling in
103 echo.anything new.
104 echo.
105 exit /b -1
106
107 :end