import sys
import os
import tempfile

path = os.path.abspath(os.path.join(os.path.dirname(__file__), "closure-compiler.jar"))
if not os.path.exists(path):
    raise Exception("No closure-compiler.jar at %s; read README.txt!" % path)

def minimize(code):
    ntf = tempfile.NamedTemporaryFile()
    ntf.write(code)
    ntf.flush()

    ntf2 = tempfile.NamedTemporaryFile()

    os.system("java -jar %s --js %s --js_output_file %s" % (path, ntf.name, ntf2.name))
    ntf2.seek(0)
    data = ntf2.read()
    ntf.close()
    ntf2.close()
    return data

@@ -42,65 +42,18 @@
 h = 
-os.path.abspath(os.path.join(os.path.dirname(__file__), %22
+%22../tools/
 clos
@@ -69,18 +69,16 @@
 ler.jar%22
-))
 %0Aif not 
@@ -236,16 +236,28 @@
 aryFile(
+delete=False
 )%0A    nt
@@ -326,16 +326,61 @@
 aryFile(
+delete=False)%0A    ntf.close()%0A    ntf2.close(
 )%0A%0A    o
@@ -470,75 +470,85 @@
     
-ntf2.seek(0)%0A    data = ntf2.read()%0A    ntf.close()%0A    ntf2.close(
+data = open(ntf2.name).read()%0A    os.unlink(ntf.name)%0A    os.unlink(ntf2.name
 )%0A  

fix closure build on Windows, p=jorix, r=me, thanks to mprins and scaddenp, I've verified that the build still works on OSX (closes #3158)