Skip to content

Commit dce611f

Browse files
committed
Reorganized/simplified scripts
1 parent 8f91f37 commit dce611f

File tree

10 files changed

+77
-83
lines changed

10 files changed

+77
-83
lines changed

.env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CI_DST=DataLab-WinPython
2+
CI_VER=0.12.0
3+
CI_CYR=Copyright (C) 2023 DataLab Platform Developers
4+
CI_WNM=WPy64-31180
5+
CI_WPI=Winpython64-3.11.8.0dot.exe

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ nsis/icons/*.ico
1313
nsis/images/*.bmp
1414
packages/
1515
Win*.exe
16+
WPy*/
1617

1718
# Created by https://www.gitignore.io/api/python
1819

.vscode/tasks.json

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22
"version": "2.0.0",
33
"tasks": [
44
{
5-
"label": "Download",
5+
"label": "Clean up",
66
"type": "shell",
77
"command": "cmd",
88
"args": [
99
"/c",
10-
"download.bat"
10+
"clean_up.bat"
1111
],
1212
"options": {
1313
"cwd": "scripts",
14+
"env": {
15+
"UNATTENDED": "1",
16+
}
1417
},
1518
"group": {
1619
"kind": "build",
@@ -26,20 +29,15 @@
2629
}
2730
},
2831
{
29-
"label": "Clean up",
32+
"label": "Download",
3033
"type": "shell",
3134
"command": "cmd",
3235
"args": [
3336
"/c",
34-
"clean_up.bat"
37+
"download.bat"
3538
],
3639
"options": {
3740
"cwd": "scripts",
38-
"env": {
39-
"UNATTENDED": "1",
40-
"CI_DST": "DataLab-WinPython",
41-
"CI_WNM": "WPy64-31180",
42-
}
4341
},
4442
"group": {
4543
"kind": "build",
@@ -55,7 +53,7 @@
5553
}
5654
},
5755
{
58-
"label": "Create distribution",
56+
"label": "Build distribution",
5957
"type": "shell",
6058
"command": "cmd",
6159
"args": [
@@ -66,8 +64,6 @@
6664
"cwd": "scripts",
6765
"env": {
6866
"UNATTENDED": "1",
69-
"CI_WNM": "WPy64-31180",
70-
"CI_WPI": "Winpython64-3.11.8.0dot.exe",
7167
}
7268
},
7369
"group": {
@@ -84,7 +80,7 @@
8480
}
8581
},
8682
{
87-
"label": "Create installer",
83+
"label": "Build installer",
8884
"type": "shell",
8985
"command": "cmd",
9086
"args": [
@@ -95,11 +91,6 @@
9591
"cwd": "scripts",
9692
"env": {
9793
"UNATTENDED": "1",
98-
"CI_WNM": "WPy64-31180",
99-
"CI_DST": "DataLab-WinPython",
100-
"CI_WPI": "Winpython64-3.11.8.0dot.exe",
101-
"CI_CYR": "Copyright (C) 2023 DataLab Platform Developers",
102-
"CI_VER": "0.12.0",
10394
}
10495
},
10596
"group": {
@@ -124,8 +115,9 @@
124115
"dependsOrder": "sequence",
125116
"dependsOn": [
126117
"Clean up",
127-
"Create distribution",
128-
"Create installer",
118+
"Download",
119+
"Build distribution",
120+
"Build installer",
129121
]
130122
}
131123
]

create_installer.bat

Lines changed: 0 additions & 21 deletions
This file was deleted.

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
PyQt5
2-
cdl

scripts/build_distribution.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ REM Licensed under the terms of the BSD 3-Clause
66
REM (see cdl/LICENSE for details)
77
REM ======================================================
88
call %~dp0utils GetScriptPath SCRIPTPATH
9+
call %FUNC% SetEnvVars
910
set ROOTPATH=%SCRIPTPATH%\..\
1011
cd %ROOTPATH%
1112

@@ -26,6 +27,7 @@ rmdir /S /Q notebooks
2627
rmdir /S /Q t
2728
cd %ROOTPATH%
2829
@REM Install packages
30+
pip install --no-cache-dir --no-index --find-links=packages cdl==%CI_VER%
2931
pip install --no-cache-dir --no-index --find-links=packages -r requirements.txt
3032

3133
@REM Create additional launchers

scripts/build_installer.bat

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ REM Licensed under the terms of the BSD 3-Clause
66
REM (see cdl/LICENSE for details)
77
REM ======================================================
88
call %~dp0utils GetScriptPath SCRIPTPATH
9+
call %FUNC% SetEnvVars
910
set ROOTPATH=%SCRIPTPATH%\..\
1011
cd %ROOTPATH%
1112

@@ -24,13 +25,8 @@ set NSIS_COPYRIGHT_INFO=%CI_CYR%
2425

2526
@REM Create release directory
2627
@REM ===========================================================================
27-
set RLSPTH=%ROOTPATH%%CI_DST%-%CI_VER%_release\
28-
set SRCPTH=%RLSPTH%\source\
29-
rmdir /S /Q %RLSPTH%
28+
if exist "%RLSPTH%" ( rmdir /s /q "%RLSPTH%" )
3029
mkdir %RLSPTH%
3130
move %ROOTPATH%%CI_DST%-%CI_VER%.exe %RLSPTH%
32-
set AddToSource="C:\Program Files\7-Zip\7z.exe" a -mx1 "%RLSPTH%%CI_DST%-%CI_VER%_source.zip"
33-
%AddToSource% executables nsis packages prerequisites scripts
34-
%AddToSource% create_installer.bat README.md requirements.txt %CI_WPI%
3531

3632
call %FUNC% EndOfScript

scripts/clean_up.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ REM Licensed under the terms of the BSD 3-Clause
66
REM (see cdl/LICENSE for details)
77
REM ======================================================
88
call %~dp0utils GetScriptPath SCRIPTPATH
9+
call %FUNC% SetEnvVars
910
set ROOTPATH=%SCRIPTPATH%\..\
1011
cd %ROOTPATH%
1112

1213
if exist "%CI_WNM%" ( rmdir /s /q "%CI_WNM%" )
1314
if exist "%CI_DST%" ( rmdir /s /q "%CI_DST%" )
15+
if exist "packages" ( rmdir /s /q "packages" )
16+
if exist "%RLSPTH%" ( rmdir /s /q "%RLSPTH%" )
1417

1518
call %FUNC% EndOfScript

scripts/download.bat

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
@echo off
2-
cd %~dp0..
3-
call "WPy64-31180\scripts\env_for_icons.bat" %*
4-
rmdir /s /q packages
2+
call %~dp0utils GetScriptPath SCRIPTPATH
3+
call %FUNC% SetEnvVars
4+
set ROOTPATH=%SCRIPTPATH%\..\
5+
cd %ROOTPATH%
6+
7+
if exist "packages" ( rmdir /s /q "packages" )
58
mkdir packages
9+
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" %*
13+
14+
pip download cdl==%CI_VER% -d packages
615
pip download -r requirements.txt -d packages

scripts/utils.bat

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,47 +12,55 @@ REM (see LICENSE file for more details)
1212
REM ======================================================
1313

1414
:GetScriptPath
15-
set _tmp_=%~dp0
16-
if %_tmp_:~-1%==\ set %1=%_tmp_:~0,-1%
17-
EXIT /B 0
15+
set _tmp_=%~dp0
16+
if %_tmp_:~-1%==\ set %1=%_tmp_:~0,-1%
17+
EXIT /B 0
1818

1919
:GetLibName
20-
pushd %~dp0..
21-
for %%I in (.) do set %1=%%~nxI
22-
popd
23-
goto:eof
20+
pushd %~dp0..
21+
for %%I in (.) do set %1=%%~nxI
22+
popd
23+
goto:eof
2424

2525
:SetPythonPath
26-
set PYTHONPATH=%~dp0..
27-
goto:eof
26+
set PYTHONPATH=%~dp0..
27+
goto:eof
2828

29-
:UseWinPython
30-
if defined WINPYDIRBASE (
31-
call %WINPYDIRBASE%\scripts\env.bat
32-
call :ShowTitle "Using WinPython from %WINPYDIRBASE%"
33-
) else (
34-
echo Warning: WINPYDIRBASE environment variable is not defined, switching to system Python
35-
echo ********
36-
echo (if nothing happens, that's probably because Python is not installed either:
37-
echo please set the WINPYDIRBASE variable to select WinPython directory, or install Python)
29+
:SetEnvVars
30+
cd %~dp0..
31+
for /F "tokens=*" %%A in (.env) do (
32+
set %%A
3833
)
39-
goto:eof
34+
set RLSPTH=%~dp0..\%CI_DST%-%CI_VER%_release\
35+
goto:eof
36+
37+
:UseWinPython
38+
if defined WINPYDIRBASE (
39+
call %WINPYDIRBASE%\scripts\env.bat
40+
call :ShowTitle "Using WinPython from %WINPYDIRBASE%"
41+
) else (
42+
echo Warning: WINPYDIRBASE environment variable is not defined, switching to system Python
43+
echo ********
44+
echo (if nothing happens, that's probably because Python is not installed either:
45+
echo please set the WINPYDIRBASE variable to select WinPython directory, or install Python)
46+
)
47+
goto:eof
4048

4149
:ShowTitle
42-
@echo:
43-
@echo ========= %~1 =========
44-
@echo:
45-
goto:eof
50+
@echo:
51+
@echo ========= %~1 =========
52+
@echo:
53+
goto:eof
4654

4755
:EndOfScript
48-
@echo:
49-
@echo **********************************************************************************
50-
@echo:
51-
if not defined UNATTENDED (
52-
@echo End of script
53-
pause
54-
)
55-
goto:eof
56+
@echo:
57+
@echo **********************************************************************************
58+
@echo:
59+
if not defined UNATTENDED (
60+
@echo End of script
61+
pause
62+
)
63+
goto:eof
5664

5765
:Exit
58-
exit /b
66+
exit /b

0 commit comments

Comments
 (0)