Skip to content

Commit b7fbe2b

Browse files
committed
Simplified build process
1 parent 2071b79 commit b7fbe2b

7 files changed

Lines changed: 44 additions & 17 deletions

File tree

.env

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
CI_DST=DataLab-WinPython
22
CI_VER=0.14.2
33
CI_CYR=Copyright (C) 2023 DataLab Platform Developers
4-
CI_WNM=WPy64-39100
54
CI_WPI=Winpython64-3.9.10.0dot.exe
6-
CI_SUF=Py39

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,6 @@ docs/_build/
7878
target/
7979

8080
/.spyproject
81+
82+
# Temporary files
83+
tmp/

scripts/build_distribution.bat

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,24 @@ cd %ROOTPATH%
1212

1313
@REM Build WinPython distribution
1414
@REM ===========================================================================
15-
"C:\Program Files\7-Zip\7z.exe" x -y -o"." "%CI_WPI%"
16-
call "%CI_WNM%\scripts\env_for_icons.bat" %*
17-
cd %CI_WNM%
15+
16+
@REM Extract WinPython distribution
17+
if not exist "%ROOTPATH%\dist" ( mkdir "%ROOTPATH%\dist" )
18+
if exist "%ROOTPATH%\dist\%CI_DST%" ( rmdir /s /q "%ROOTPATH%\dist\%CI_DST%" )
19+
20+
@REM Rename extracted folder to %CI_DST%
21+
if not exist ".\tmp" ( mkdir ".\tmp" )
22+
"C:\Program Files\7-Zip\7z.exe" x -y -o".\tmp" "%CI_WPI%"
23+
for /D %%I in (.\tmp\*) do set WP_FOLDER=%%~nxI
24+
pushd ".\tmp"
25+
ren %WP_FOLDER% %CI_DST%
26+
popd
27+
move ".\tmp\%CI_DST%" "%ROOTPATH%\dist\"
28+
rmdir /S /Q ".\tmp"
29+
30+
@REM Customize WinPython distribution
31+
call "%ROOTPATH%\dist\%CI_DST%\scripts\env_for_icons.bat" %*
32+
cd %ROOTPATH%\dist\%CI_DST%
1833
del IPython*.exe
1934
del Jupyter*.exe
2035
del Pyzo.exe
@@ -37,10 +52,10 @@ set NSIS_WORKDIR=$EXEDIR\scripts
3752
set NSIS_COMMAND=wscript.exe
3853
for %%f in (executables\*.bat) do (
3954
@REM Copy each .bat file to the "scripts" folder:
40-
copy "executables\%%~nxf" "%ROOTPATH%\%CI_WNM%\scripts"
55+
copy "executables\%%~nxf" "%ROOTPATH%\dist\%CI_DST%\scripts"
4156
@REM Set NSIS_ICON, NSIS_OUTFILE and NSIS_PARAMS for each .bat file:
4257
set NSIS_ICON=%ROOTPATH%\executables\%%~nf.ico
43-
set NSIS_OUTFILE=%ROOTPATH%\%CI_WNM%\%%~nf.exe
58+
set NSIS_OUTFILE=%ROOTPATH%\dist\%CI_DST%\%%~nf.exe
4459
set NSIS_PARAMS=Noshell.vbs %%~nxf
4560
"C:\Program Files (x86)\NSIS\makensis.exe" nsis\launcher.nsi
4661
)

scripts/build_installer.bat

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,23 @@ REM ------------------------------------------
55
REM Licensed under the terms of the BSD 3-Clause
66
REM (see cdl/LICENSE for details)
77
REM ======================================================
8+
setlocal enabledelayedexpansion
89
call %~dp0utils GetScriptPath SCRIPTPATH
910
call %FUNC% SetEnvVars
1011
set ROOTPATH=%SCRIPTPATH%\..\
1112
cd %ROOTPATH%
1213

13-
ren %CI_WNM% %CI_DST%
14+
@REM CI_WPI=Winpython64-3.9.10.0dot.exe => PYSUFFIX=Py39
15+
for /f "tokens=2 delims=-" %%a in ("!CI_WPI!") do set VERSION_PART=%%a
16+
for /f "tokens=1-2 delims=." %%b in ("!VERSION_PART!") do (
17+
set MAJOR=%%b
18+
set MINOR=%%c
19+
)
20+
set PYSUFFIX=Py!MAJOR!!MINOR!
1421

1522
@REM Build installer
1623
@REM ===========================================================================
17-
set NSIS_DIST_PATH=%ROOTPATH%%CI_DST%
24+
set NSIS_DIST_PATH=%ROOTPATH%\DIST\%CI_DST%
1825
set NSIS_PRODUCT_NAME=%CI_DST%
1926
set NSIS_PRODUCT_ID=%CI_DST%
2027
set NSIS_INSTALLDIR=C:\%CI_DST%
@@ -25,8 +32,10 @@ set NSIS_COPYRIGHT_INFO=%CI_CYR%
2532

2633
@REM Create release directory
2734
@REM ===========================================================================
35+
if not exist "%ROOTPATH%\releases" ( mkdir "%ROOTPATH%\releases" )
36+
set RLSPTH=%ROOTPATH%\releases\%CI_DST%-%CI_VER%_release\
2837
if exist "%RLSPTH%" ( rmdir /s /q "%RLSPTH%" )
2938
mkdir %RLSPTH%
30-
move /Y %ROOTPATH%%CI_DST%-%CI_VER%.exe %RLSPTH%\%CI_DST%-%CI_VER%_%CI_SUF%.exe
39+
move /Y %ROOTPATH%\%CI_DST%-%CI_VER%.exe %RLSPTH%\%CI_DST%-%CI_VER%_%PYSUFFIX%.exe
3140

3241
call %FUNC% EndOfScript

scripts/clean_up.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ call %FUNC% SetEnvVars
1010
set ROOTPATH=%SCRIPTPATH%\..\
1111
cd %ROOTPATH%
1212

13-
if exist "%CI_WNM%" ( rmdir /s /q "%CI_WNM%" )
14-
if exist "%CI_DST%" ( rmdir /s /q "%CI_DST%" )
13+
if exist "tmp" ( rmdir /s /q "tmp" )
14+
if exist "dist" ( rmdir /s /q "dist" )
1515
if exist "packages" ( rmdir /s /q "packages" )
1616

1717
call %FUNC% EndOfScript

scripts/download.bat

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ cd %ROOTPATH%
77
if exist "packages" ( rmdir /s /q "packages" )
88
mkdir packages
99

10-
if not exist "%CI_WNM%" ( "C:\Program Files\7-Zip\7z.exe" x -y -o"." "%CI_WPI%" )
11-
12-
call "%CI_WNM%\scripts\env_for_icons.bat" %*
10+
if not exist ".\tmp" ( mkdir ".\tmp" )
11+
"C:\Program Files\7-Zip\7z.exe" x -y -o".\tmp" "%CI_WPI%"
12+
for /D %%I in (.\tmp\*) do set WP_FOLDER=%%~nxI
13+
call ".\tmp\%WP_FOLDER%\scripts\env_for_icons.bat" %*
1314

1415
%PYTHON% -m pip install --upgrade pip
1516
pip download cdl==%CI_VER% -d packages
16-
pip download -r requirements.txt -d packages
17+
pip download -r requirements.txt -d packages
18+
19+
rmdir /S /Q ".\tmp"

scripts/utils.bat

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ REM ======================================================
3131
for /F "tokens=*" %%A in (.env) do (
3232
set %%A
3333
)
34-
set RLSPTH=%~dp0..\%CI_DST%-%CI_VER%_release\
3534
goto:eof
3635

3736
:UseWinPython

0 commit comments

Comments
 (0)