Skip to content

Commit e4b2481

Browse files
committed
Batch improvements to extract version number and check paths valid
1 parent a9df220 commit e4b2481

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

installer/buildInstaller.bat

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,18 @@ IF NOT EXIST "buildPaths.bat" (
1616

1717
CALL buildPaths.bat
1818

19-
SET PYTHONSCRIPTVERSION=1.0.0.0
19+
IF NOT EXIST "%PYTHONBUILDDIR%\pcbuild\python.exe" (
20+
echo Your PYTHONBUILDDIR in buildPaths.bat does not contain PCBuild\python.exe. Please set PYTHONBUILDDIR to the root of a built Python 2.7
21+
goto error
22+
)
23+
24+
IF NOT EXIST "%PYTHONBUILDDIR%\pcbuild\python27.dll" (
25+
echo Your PYTHONBUILDDIR in buildPaths.bat does not contain PCBuild\python27.dll. Please set PYTHONBUILDDIR to the root of a built Python 2.7
26+
goto error
27+
)
28+
29+
%PYTHONBUILDDIR%\pcbuild\python extractVersion.py > temp\version.txt
30+
SET /p PYTHONSCRIPTVERSION= < temp\version.txt
2031

2132

2233
echo Generating WiX information for ..\pythonlib\full
@@ -84,6 +95,10 @@ if NOT [%ERRORLEVEL%]==[0] (
8495
goto error
8596
)
8697

98+
echo.
99+
echo.
100+
echo Installer created - build\PythonScript_%PYTHONSCRIPTVERSION%.msi
101+
87102
goto end
88103

89104
:error

installer/extractVersion.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""Extracts the version number of PythonScript"""
2+
3+
import sys, os
4+
import re
5+
6+
pathToVersionFile = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), '..\PythonScript\src\PythonScriptVersion.h')
7+
8+
versionHeader = open(pathToVersionFile, 'r')
9+
versionRegex = re.compile(r'PYSCR_VERSION_STRING\s+"([0-9.]+)"')
10+
11+
for line in versionHeader:
12+
match = versionRegex.search(line)
13+
if match:
14+
print match.group(1),
15+
break
16+
17+
18+

0 commit comments

Comments
 (0)