forked from openpreserve/jpylyzer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuildWin32.bat
87 lines (63 loc) · 2 KB
/
buildWin32.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
:
:: Build 32 bit Windows jpylyzer binaries from Python script, and pack them in ZIP file
::
:: ZIP file includes PDF User Manual and test images
::
:: Johan van der Knijff, 2 March 2011
::
:: Dependencies:
::
:: - Python 2.7 (PyInstaller doesn't work with Python 3 yet!)
:: - PyInstaller: http://www.pyinstaller.org/
:: - PyWin32 (needed by PyInstaller): http://sourceforge.net/projects/pywin32/files/
:: - 7-zip file archiver: http://www.7-zip.org/
::
:: To do: 64 bit binaries?
@echo off
setlocal
::::::::: CONFIGURATION ::::::::::
:: Script base name (i.e. script name minus .py extension)
set scriptBaseName=jpylyzer
:: Python
set python=c:\python27\python
:: Path to PyInstaller
set pathPyInstaller=c:\pyinstall\
:: Path to 7-zip command-line tool
set zipCommand="C:\Program Files\7-Zip\7z"
:: Executes jpylyzer with -v option and stores output to
:: env variable 'version'
set vCommand=%python% %scriptBaseName%.py -v
%vCommand% 2> temp.txt
set /p version= < temp.txt
del temp.txt
::::::::: BUILD ::::::::::::::::::
:: Make spec file
%python% %pathPyInstaller%\MakeSpec.py %scriptBaseName%.py
:: Build binaries
%python% %pathPyInstaller%\build.py %scriptBaseName%.spec
:: Create examples file dir in dist directory
md .\dist\%scriptBaseName%\example_files
:: Copy directory with example files to dist directory
copy /Y .\example_files\* .\dist\%scriptBaseName%\example_files\
:: Create doc directory in dist directory
md .\dist\%scriptBaseName%\doc
:: Copy PDF documentation to doc dir
copy *.pdf .\dist\%scriptBaseName%\doc\
:: Generate name for ZIP file
set zipName=%scriptBaseName%_%version%_win32.zip
:: Create ZIP file
%zipCommand% a -r %zipName% .\dist\jpylyzer\*
:: Create Win32 directory
md win32
:: Move ZIP file to Win32 directory
move /Y %zipName% .\win32\
::::::::: CLEANUP :::::::::::::::::
:: Delete build directory
rmdir build /S /Q
:: Delete dist directory
rmdir dist /S /Q
:: Delete spec file
del %scriptBaseName%.spec
echo /
echo Done! Created %zipName% in directory .\win32\!
echo /