summaryrefslogtreecommitdiffstats
path: root/py2exe-build.bat
blob: 6ea2cecaa0ee51dc26d6614ceea7e9977318e745 (plain)
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
@echo off

SET PATH=%PATH%;C:\WINDOWS;C:\WINDOWS\SYSTEM32;C:\PYTHON34;%ProgramFiles%\7-Zip

py -c "from awlsim.common.version import VERSION_MAJOR, VERSION_MINOR; print('%%d.%%d' %% (VERSION_MAJOR, VERSION_MINOR))" > version.txt
set /p version= < version.txt

set distdir=awlsim-win-standalone-%version%
set zipfile=awlsim-win-standalone-%version%.zip
set bindir=%distdir%\awlsim-bin

echo Building standalone Windows executable for awlsim v%version%...


rem ---
rem Create the py2exe distribution
rem ---
rd /s /q build 2>NUL
rd /s /q %distdir% 2>NUL
mkdir %distdir%
mkdir %bindir%
py setup.py py2exe ^
	--dist-dir=%bindir% ^
	--optimize=2 ^
	--bundle-files=3 ^
	--ignores=win32api,win32con,readline,awlsim_cython ^
	--packages=awlsimhw_debug,awlsimhw_dummy,awlsim.library.iec ^
	--quiet
if ERRORLEVEL 1 goto error_exe

rem ---
rem Copy additional files
rem ---
copy EXAMPLE.* %distdir%\
copy README.txt %distdir%\
copy COMPATIBILITY.txt %distdir%\
copy TODO.txt %distdir%\
xcopy doc\foreign-licenses %distdir%\licenses\ /E
copy COPYING.txt %distdir%\licenses\AWLSIM-LICENSE.txt
move %bindir%\server.exe %bindir%\awlsim-server-module.exe

rem ---
rem Make startup wrapper
rem ---
set wrapper=%distdir%\awlsim.bat
echo @echo off> %wrapper%
echo start /Dawlsim-bin awlsim-gui.exe %%1>> %wrapper%

rem ---
rem Create the distribution archive
rem ---
del %zipfile% 2>NUL
7z a -tzip %zipfile% %distdir%
if ERRORLEVEL 1 goto error_zip


echo ---
echo finished
pause
exit


:error_exe
echo FAILED to build exe
goto error

:error_zip
echo FAILED to create zip archive
goto error

:error
pause
exit
bues.ch cgit interface