2424# Location of Windows files
2525APP_FILE = os .path .join (BASE_DIR , "ODMTools.py" )
2626MAKE_FILE = os .path .realpath (__file__ )
27- VERSION_FILE = os .path .join (BASE_DIR , "version.txt" )
27+ VERSION_FILE = os .path .join (SETUP_DIR , "version.txt" )
2828
2929# Location of Innosetup Installer
3030INNO_SCRIPT = os .path .join (WIN_DIR , "odmtools_setup.iss" )
@@ -111,6 +111,14 @@ def printInfo():
111111
112112 check_if_dirs_exist ()
113113
114+ def obtain_exe_filename (console = False ):
115+ if console :
116+ return "{app}_{version}_{os}_{arch}_{type}" .format (app = data .app_name ,
117+ version = data .version , os = sys .platform , arch = 'x86_64' , type = "console" )
118+ else :
119+ return "{app}_{version}_{os}_{arch}" .format (app = data .app_name ,
120+ version = data .version , os = sys .platform , arch = 'x86_64' )
121+
114122def delete_old_out_dir ():
115123 loc_exists = os .path .exists (DIST_DIR )
116124 isFile = os .path .isfile (DIST_DIR )
@@ -125,16 +133,34 @@ def delete_old_out_dir():
125133 print "Nothing to remove"
126134
127135def run_pyinstaller ():
136+ """
137+ Create a non-console version and a console version
138+ """
139+
128140 try :
141+ ## No console
142+ os .system ('pyinstaller '
143+ '--clean '
144+ '-n %s ' % obtain_exe_filename () +
145+ '--distpath=%s ' % DIST_DIR +
146+ '--workpath=%s ' % WORK_DIR +
147+ '--specpath=%s ' % WIN_DIR +
148+ '--upx-dir=%s ' % BASE_DIR +
149+ '--icon=%s ' % WIN_ICON_FILE +
150+ '--version-file=%s ' % VERSION_FILE +
151+ '--windowed '
152+ '--noconfirm ' + APP_FILE )
153+
154+ ## Console
129155 os .system ('pyinstaller '
130156 '--clean '
131- '--distpath=%s ' % WIN_DIR +
157+ '-n %s ' % obtain_exe_filename (console = True ) +
158+ '--distpath=%s ' % DIST_DIR +
132159 '--workpath=%s ' % WORK_DIR +
133160 '--specpath=%s ' % WIN_DIR +
134161 '--upx-dir=%s ' % BASE_DIR +
135162 '--icon=%s ' % WIN_ICON_FILE +
136163 '--version-file=%s ' % VERSION_FILE +
137- # '--windowed '
138164 '--noconfirm ' + APP_FILE )
139165
140166 return True
@@ -146,7 +172,7 @@ def mac_pyinstaller():
146172 try :
147173 os .system ('pyinstaller '
148174 '--clean '
149- '--distpath=%s ' % MAC_DIR +
175+ '--distpath=%s ' % DIST_DIR +
150176 '--workpath=%s ' % MAC_WORK_DIR +
151177 '--specpath=%s ' % MAC_DIR +
152178 '--upx-dir=%s ' % BASE_DIR +
@@ -183,9 +209,9 @@ def run_inno():
183209 os .system (INNO_EXECUTABLE + " " + INNO_SCRIPT )
184210
185211def run_no_installer ():
186- # pass
187- filename = "{app}_{version}_{os}_{arch}_{type}.zip" . format ( app = data . app_name ,
188- version = data . version , os = sys . platform , arch = 'x86_64' , type = "No_Install" )
212+ # Need to finish, Not functional
213+ raise ( "Not functional yet" )
214+ filename = obtain_exe_filename ( )
189215
190216 zipdir (os .path .join ('odmtools' ), filename )
191217 move_to_dist (filename )
0 commit comments