|
| 1 | +from __future__ import with_statement |
1 | 2 | import os, sys, shutil, zipfile |
2 | | -BASE_DIR = os.path.dirname(os.path.realpath(__file__)) |
| 3 | +from contextlib import closing |
| 4 | +from zipfile import ZipFile, ZIP_DEFLATED |
| 5 | +import os |
| 6 | + |
| 7 | +def zipdir(basedir, archivename): |
| 8 | + assert os.path.isdir(basedir) |
| 9 | + with closing(ZipFile(archivename, "w", ZIP_DEFLATED)) as z: |
| 10 | + for root, dirs, files in os.walk(basedir): |
| 11 | + #NOTE: ignore empty directories |
| 12 | + for fn in files: |
| 13 | + absfn = os.path.join(root, fn) |
| 14 | + zfn = absfn[len(basedir)+len(os.sep):] |
| 15 | + z.write(absfn, zfn) |
| 16 | +## Update this for each new release ## |
| 17 | + |
| 18 | + |
| 19 | + |
3 | 20 |
|
| 21 | +## |
| 22 | +BASE_DIR = os.path.dirname(os.path.realpath(__file__)) |
4 | 23 | WIN_DIR = os.path.join(BASE_DIR, "Windows") |
5 | 24 | MAC_DIR = os.path.join(BASE_DIR, "Mac") |
6 | 25 |
|
@@ -37,15 +56,15 @@ def check_if_dirs_exist(): |
37 | 56 | assert os.path.exists(MAC_DIR) |
38 | 57 | print "Success" |
39 | 58 |
|
40 | | - print "Trying to open WORK_DIR: ", |
| 59 | + print "Trying to open WORK_DIR: ", |
41 | 60 | assert os.path.exists(WORK_DIR) |
42 | 61 | print "Success" |
43 | 62 |
|
44 | | - print "Trying to open ICON_DIR: ", |
| 63 | + print "Trying to open ICON_DIR: ", |
45 | 64 | assert os.path.exists(ICON_DIR) |
46 | 65 | print "Success" |
47 | 66 |
|
48 | | - print "Trying to open EXE_DIR: ", |
| 67 | + print "Trying to open EXE_DIR: ", |
49 | 68 | assert os.path.exists(EXE_DIR) |
50 | 69 | print "Success" |
51 | 70 |
|
@@ -105,26 +124,30 @@ def run_inno(): |
105 | 124 | os.system(INNO_EXECUTABLE + " " + INNO_SCRIPT) |
106 | 125 |
|
107 | 126 | def run_no_installer(): |
108 | | - pass |
| 127 | + # pass |
| 128 | + zipdir(os.path.join('..', 'odmtools'), "Windows_Test_zip.zip") |
| 129 | + |
109 | 130 | # zf = zipfile.ZipFile('') |
110 | 131 |
|
111 | 132 | def run_iceberg(): |
112 | 133 | os.system(ICE_EXECUTABLE + " "+ ICE_SCRIPT) |
113 | 134 |
|
114 | | - |
| 135 | + |
115 | 136 | def main(): |
116 | | - delete_old_out_dir() |
117 | | - check_if_dirs_exist() |
| 137 | + # delete_old_out_dir() |
| 138 | + # check_if_dirs_exist() |
118 | 139 |
|
119 | 140 | if sys.platform == 'win32': |
120 | 141 | print "Creating Windows Executable..." |
121 | 142 | if (run_pyinstaller()): |
122 | 143 | run_inno() |
123 | 144 |
|
124 | | - |
125 | 145 | if sys.platform =='darwin': |
126 | 146 | if(mac_pyinstaller()): |
127 | 147 | run_iceberg() |
| 148 | + else: |
| 149 | + run_no_installer() |
| 150 | + |
128 | 151 |
|
129 | 152 | if __name__ == '__main__': |
130 | 153 | main() |
|
0 commit comments