Skip to content

Commit 8b54da5

Browse files
committed
Automated fixes courtesy of 2to3 tool
No further modifications (cleanup or corrections) have been made. refs #13
1 parent 1016f9b commit 8b54da5

2 files changed

Lines changed: 93 additions & 93 deletions

File tree

installer/build.py

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# $Id$
22
# $HeadURL$
33

4-
# Purpose:
4+
# Purpose:
55
# Build installers for upload to hosting services.The goal is to use
66
# this for development and release builds.
77

@@ -61,7 +61,7 @@ def main():
6161
# #####################
6262
# Project Files
6363
# #####################
64-
# These need to stay as separate values from
64+
# These need to stay as separate values from
6565
# files_with_placeholder_content var due to use in build functions?
6666
CX_FREEZE_SETUP = EXPORT_PATH + os.sep + 'setup_freeze.py'
6767

@@ -96,7 +96,7 @@ def main():
9696
def export_svn(url_or_wkco, EXPORT_PATH):
9797
"""Exports clean files from SVN working copy"""
9898

99-
if INFO_ON: print '[INFO] Exporting files from %s' % url_or_wkco
99+
if INFO_ON: print('[INFO] Exporting files from %s' % url_or_wkco)
100100
client = pysvn.Client()
101101

102102
# http://pysvn.tigris.org/docs/pysvn_prog_ref.html#pysvn_client_export
@@ -116,16 +116,16 @@ def compile_python_code(python_setup_file):
116116
installation of Python"""
117117

118118
if os.path.exists(PACKAGE_DIR):
119-
if INFO_ON:
120-
print '[INFO] Compiled Python code exists, skipping compilation'
119+
if INFO_ON:
120+
print('[INFO] Compiled Python code exists, skipping compilation')
121121

122122
else:
123-
if INFO_ON: print '[INFO] Compiling Python code'
123+
if INFO_ON: print('[INFO] Compiling Python code')
124124
# Using triple quotes to handle path with spaces
125125
compile_command = """python "%s" build """ % python_setup_file
126126
result = os.system(compile_command)
127127
if DEBUG_ON:
128-
print "The result of the Python code compile is: %s" % result
128+
print("The result of the Python code compile is: %s" % result)
129129

130130

131131
# FIXME: Function references several 'CONSTANTS' without them being passed.
@@ -136,7 +136,7 @@ def update_package_dir(PACKAGE_DIR):
136136
if not os.path.exists(PACKAGE_DIR):
137137

138138
# Move compiled files to 'package' dir.
139-
os.rename(EXPORT_PATH + os.sep + 'build\exe.win32-' \
139+
os.rename(EXPORT_PATH + os.sep + r'build\exe.win32-' \
140140
+ INSTALLED_PYTHON_VERSION, PACKAGE_DIR)
141141
os.rmdir(EXPORT_PATH + os.sep + 'build')
142142

@@ -159,13 +159,13 @@ def update_version_tag_in_files(files, release_version):
159159
"""Update placeholder version information within a list of files"""
160160

161161
for file in files:
162-
if INFO_ON: print "[INFO] Updating version tag in: %s" % file
162+
if INFO_ON: print("[INFO] Updating version tag in: %s" % file)
163163

164164
# Open tmp file, read in orig and make changes in tmp file.
165165
o = open("updated_file.tmp","a")
166166
for line in open(file):
167167
line = line.replace(APP_RELEASE_VER_PLACEHOLDER, release_version)
168-
o.write(line)
168+
o.write(line)
169169
o.close()
170170

171171
# Replace original with updated copy
@@ -181,7 +181,7 @@ def create_src_archive(src_dir, dst_dir, release_version):
181181

182182
dest_file = dst_dir + os.sep + dest_file
183183

184-
if INFO_ON: print "Creating source archive of %s" % src_dir
184+
if INFO_ON: print("Creating source archive of %s" % src_dir)
185185
# Max compression, Multi-threading on, Solid archive creation on
186186
archive_command = """%s -t7z -mx=9 -mmt=on -ms=on a "%s" "%s" """ % \
187187
(archive_app, dest_file, src_dir)
@@ -191,14 +191,14 @@ def create_binary_archive(src_dir, dst_dir, release_version):
191191
"""Create archives for distribution"""
192192

193193
os.chdir(src_dir)
194-
194+
195195
archive_app = "7z.exe"
196196
dest_file = """%s-%s-win32-bin.7z""" % \
197197
(APPLICATION_NAME.lower(), release_version)
198198

199199
dest_file = dst_dir + os.sep + dest_file
200200

201-
if INFO_ON: print "Creating binary archive of %s" % src_dir
201+
if INFO_ON: print("Creating binary archive of %s" % src_dir)
202202
# Max compression, Multi-threading on, Solid archive creation on
203203
archive_command = """%s -t7z -mx=9 -mmt=on -ms=on a "%s" "%s" """ % \
204204
(archive_app, dest_file, src_dir)
@@ -208,7 +208,7 @@ def build_innosetup_installer(project_file, release_version, OUTPUT_DIR, \
208208
revision):
209209
"""Produce an Inno Setup installer"""
210210

211-
if INFO_ON: print '[INFO] Compiling Inno Setup project'
211+
if INFO_ON: print('[INFO] Compiling Inno Setup project')
212212

213213
# Set iss_version to 1.0.SVNRevision
214214
# Note: This is the installer file version, NOT Synclosure version.
@@ -227,7 +227,7 @@ def build_innosetup_installer(project_file, release_version, OUTPUT_DIR, \
227227
"""iscc /Q %s /O"%s" "%s" """ % \
228228
(iscc_cmd_line_vars, OUTPUT_DIR, project_file)
229229

230-
if DEBUG_ON: print compile_command
230+
if DEBUG_ON: print(compile_command)
231231
os.system(compile_command)
232232

233233
def get_base_name(file_name):
@@ -243,7 +243,7 @@ def build_wix_project(src_files, project_file, release_version, \
243243

244244
os.chdir(src_files)
245245

246-
if INFO_ON: print '[INFO] Compiling WiX project'
246+
if INFO_ON: print('[INFO] Compiling WiX project')
247247

248248
# If this is a dev build, set WiX project version to 0.0.SVNRevision
249249
# Otherwise, set WiX project version to release_version
@@ -286,17 +286,17 @@ def build_wix_project(src_files, project_file, release_version, \
286286
project_files_dir, get_base_name(heat_file), src_files, \
287287
output_file_full_path, wix_extensions)
288288

289-
if DEBUG_ON: print "\nheat_command: %s" % heat_command
290-
if DEBUG_ON: print "\ncandle_command: %s" % candle_command
291-
if DEBUG_ON: print "\nlight_command: %s" % light_command
289+
if DEBUG_ON: print("\nheat_command: %s" % heat_command)
290+
if DEBUG_ON: print("\ncandle_command: %s" % candle_command)
291+
if DEBUG_ON: print("\nlight_command: %s" % light_command)
292292

293-
if INFO_ON: print " * Calling heat ..."
293+
if INFO_ON: print(" * Calling heat ...")
294294
os.system (heat_command)
295295

296-
if INFO_ON: print " * Calling candle ..."
296+
if INFO_ON: print(" * Calling candle ...")
297297
os.system (candle_command)
298298

299-
if INFO_ON: print "\n * Calling light ..."
299+
if INFO_ON: print("\n * Calling light ...")
300300
os.system (light_command)
301301

302302
def cleanup_build_env(dirs_to_remove, BUILD_DIR, MAX_ATTEMPTS, \
@@ -306,15 +306,15 @@ def cleanup_build_env(dirs_to_remove, BUILD_DIR, MAX_ATTEMPTS, \
306306
if cleanup_attempts == MAX_ATTEMPTS:
307307
sys.exit("[ERROR] Problems cleaning build env: %s" % cleanup_error)
308308

309-
if INFO_ON: print "[INFO] Cleaning build directory"
309+
if INFO_ON: print("[INFO] Cleaning build directory")
310310
os.chdir(BUILD_DIR)
311311

312312
for dir in dirs_to_remove:
313313
if os.path.exists(dir):
314-
if DEBUG_ON: print " * [DEBUG] Attempting to remove %s" % dir
314+
if DEBUG_ON: print(" * [DEBUG] Attempting to remove %s" % dir)
315315
try:
316316
shutil.rmtree(dir)
317-
except Exception, cleanup_error:
317+
except Exception as cleanup_error:
318318
# If there are problems removing exported files, wait a few
319319
# moments and try again until MAX_ATTEMPTS is reached.
320320
time.sleep(3)
@@ -332,8 +332,8 @@ def cleanup_build_env(dirs_to_remove, BUILD_DIR, MAX_ATTEMPTS, \
332332
# Initial Setup
333333
#####################################
334334

335-
if INFO_ON: print "[INFO] Starting %s (%s) " % \
336-
(os.path.basename(sys.argv[0]), DATE)
335+
if INFO_ON: print("[INFO] Starting %s (%s) " % \
336+
(os.path.basename(sys.argv[0]), DATE))
337337

338338
cleanup_build_env(DIRS_TO_REMOVE_DURING_CLEANUP, BUILD_DIR, MAX_ATTEMPTS)
339339

@@ -354,12 +354,12 @@ def cleanup_build_env(dirs_to_remove, BUILD_DIR, MAX_ATTEMPTS, \
354354
else:
355355
release_version = APPLICATION_RELEASE_VERSION
356356

357-
if DEBUG_ON:
358-
print "[DEBUG] release_version is %s" % release_version
357+
if DEBUG_ON:
358+
print("[DEBUG] release_version is %s" % release_version)
359359

360360
if INFO_ON:
361-
print '[INFO] Attempting to build %s %s' \
362-
% (APPLICATION_NAME, release_version)
361+
print('[INFO] Attempting to build %s %s' \
362+
% (APPLICATION_NAME, release_version))
363363

364364
update_version_tag_in_files(files_with_placeholder_content, release_version)
365365

0 commit comments

Comments
 (0)