Commit 004f5b3c authored by carlosperate's avatar carlosperate
parent 82394c5c
#!/usr/bin/python
#!/usr/bin/python2.7
# Compresses the core Blockly files into a single JavaScript file.
#
# Copyright 2012 Google Inc.
......@@ -37,6 +37,7 @@
import errno, glob, httplib, json, os, re, subprocess, sys, threading, urllib
def import_path(fullpath):
"""Import a file with full path specification.
Allows one to import from any directory, something __import__ does not do.
......@@ -51,7 +52,7 @@ def import_path(fullpath):
filename, ext = os.path.splitext(filename)
sys.path.append(path)
module = __import__(filename)
reload(module) # Might be out of date
reload(module) # Might be out of date.
del sys.path[-1]
return module
......@@ -253,8 +254,8 @@ class Gen_compressed(threading.Thread):
if json_data.has_key('serverErrors'):
errors = json_data['serverErrors']
for error in errors:
print 'SERVER ERROR: %s' % target_filename
print error['error']
print('SERVER ERROR: %s' % target_filename)
print(error['error'])
elif json_data.has_key('errors'):
errors = json_data['errors']
for error in errors:
......@@ -321,7 +322,7 @@ class Gen_compressed(threading.Thread):
print('Size changed from %d KB to %d KB (%d%%).' % (
original_kb, compressed_kb, ratio))
else:
print 'UNKNOWN ERROR'
print('UNKNOWN ERROR')
class Gen_langfiles(threading.Thread):
......@@ -338,7 +339,7 @@ class Gen_langfiles(threading.Thread):
try:
return (max(os.path.getmtime(src) for src in srcs) >
min(os.path.getmtime(dest) for dest in dests))
except OSError, e:
except OSError as e:
# Was a file not found?
if e.errno == errno.ENOENT:
# If it was a source file, we can't proceed.
......@@ -363,7 +364,7 @@ class Gen_langfiles(threading.Thread):
'--input_file', 'msg/messages.js',
'--output_dir', 'msg/json/',
'--quiet'])
except (subprocess.CalledProcessError, OSError), e:
except (subprocess.CalledProcessError, OSError) as e:
# Documentation for subprocess.check_call says that CalledProcessError
# will be raised on failure, but I found that OSError is also possible.
print('Error running i18n/js_to_json.py: ', e)
......@@ -387,7 +388,7 @@ class Gen_langfiles(threading.Thread):
(file.endswith(('keys.json', 'synonyms.json', 'qqq.json')))]
cmd.extend(json_files)
subprocess.check_call(cmd)
except (subprocess.CalledProcessError, OSError), e:
except (subprocess.CalledProcessError, OSError) as e:
print('Error running i18n/create_messages.py: ', e)
sys.exit(1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment