Making closure.py also work with Python 2.5
This commit is contained in:
+4
-6
@@ -7,16 +7,14 @@ if not os.path.exists(path):
|
|||||||
raise Exception("No closure-compiler.jar at %s; read README.txt!" % path)
|
raise Exception("No closure-compiler.jar at %s; read README.txt!" % path)
|
||||||
|
|
||||||
def minimize(code):
|
def minimize(code):
|
||||||
ntf = tempfile.NamedTemporaryFile(delete=False)
|
ntf = tempfile.NamedTemporaryFile()
|
||||||
ntf.write(code)
|
ntf.write(code)
|
||||||
ntf.flush()
|
ntf.flush()
|
||||||
|
|
||||||
ntf2 = tempfile.NamedTemporaryFile(delete=False)
|
ntf2 = tempfile.NamedTemporaryFile()
|
||||||
ntf.close()
|
|
||||||
ntf2.close()
|
|
||||||
|
|
||||||
os.system("java -jar %s --js %s --js_output_file %s" % (path, ntf.name, ntf2.name))
|
os.system("java -jar %s --js %s --js_output_file %s" % (path, ntf.name, ntf2.name))
|
||||||
data = open(ntf2.name).read()
|
data = open(ntf2.name).read()
|
||||||
os.unlink(ntf.name)
|
ntf.close()
|
||||||
os.unlink(ntf2.name)
|
ntf2.close()
|
||||||
return data
|
return data
|
||||||
|
|||||||
Reference in New Issue
Block a user