-
Notifications
You must be signed in to change notification settings - Fork 7
/
build_windows_32.bat
89 lines (74 loc) · 2.27 KB
/
build_windows_32.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
@ECHO OFF
ECHO "BUILDING PEACHYSCANNER FOR WINDOWS"
ECHO ------------------------------------
ECHO Cleaning workspace
ECHO ------------------------------------
DEL /Q *.exe
RMDIR /S /Q build
RMDIR /S /Q dist
DEL /S *.pyc
ECHO ------------------------------------
ECHO Setting up Enviroment
ECHO ------------------------------------
CALL c:\scanner32\Scripts\activate.bat
IF NOT "%ERRORLEVEL%" == "0" (
ECHO FAILURE: Environment setup failed, check log
EXIT /B 23
)
ECHO ------------------------------------
ECHO Extracting Git Revision Number
ECHO ------------------------------------
SET SEMANTIC=0.1
SET /p SEMANTIC=<symantic.version
IF NOT DEFINED GIT_HOME (
git --version
IF "%ERRORLEVEL%" == "0" (
SET GIT_HOME=git
) ELSE (
ECHO "Could not find git."
PAUSE
EXIT /B 1
)
)
FOR /f "delims=" %%A in ('%GIT_HOME% rev-list HEAD --count') do SET "GIT_REV_COUNT=%%A"
FOR /f "delims=" %%A in ('%GIT_HOME% rev-parse HEAD') do SET "GIT_REV=%%A"
SET VERSION=%SEMANTIC%.%GIT_REV_COUNT%
ECHO Version: %VERSION%
ECHO # THIS IS A GENERATED FILE > version.properties
ECHO version='%VERSION%' >> version.properties
ECHO revision='%GIT_REV%' >> version.properties
ECHO Git Revision Number is %GIT_REV_COUNT%
copy version.properties src\VERSION.py
copy version.properties VERSION.py
echo ------------------------------------
echo Running Tests
echo ------------------------------------
set PYTHONPATH=%PYTHONPATH%;src
python test\run_all_tests.py
IF NOT "%ERRORLEVEL%" == "0" (
echo "FAILED TESTS ABORTING"
EXIT /B 2
)
ECHO ------------------------------------
ECHO Creating Package
ECHO ------------------------------------
COPY /Y PeachyScanner-win32.spec.source PeachyScanner.spec
IF NOT "%ERRORLEVEL%" == "0" (
ECHO FAILED executing command: COPY /Y PeachyScanner-win32.spec.source PeachyScanner.spec
EXIT /B 78
)
pyinstaller --clean --noconfirm PeachyScanner.spec
IF NOT "%ERRORLEVEL%" == "0" (
ECHO FAILED executing command: pyinstaller --clean --noconfirm PeachyScanner.spec
EXIT /B 78
)
ECHO ------------------------------------
ECHO Moving file
ECHO ------------------------------------
cd dist
python ..\make_zip.py PeachyScanner_x86-%VERSION% ..\PeachyScanner_x86-%VERSION%.zip
IF NOT "%ERRORLEVEL%" == "0" (
ECHO "FAILED moving files"
EXIT /B 798
)
cd ..