]> dev.renevier.net Git - syj.git/blobdiff - scripts/release.py
allow release if yui-compressor is called yuicompressor
[syj.git] / scripts / release.py
index a95ddd6b6a7284b8293c104f0b35ed87a37740cf..3c5ded2be7eaf0dab35997879cb08ad7ae810ad5 100755 (executable)
@@ -7,6 +7,7 @@ pathjoin = os.path.join
 
 def updateversion():
     try:
+        version = None
         import git
         repo = git.Repo('.')
         master = repo.commits()[0]
@@ -29,7 +30,10 @@ def updateversion():
 
 def compress(path):
     tmpout = tempfile.TemporaryFile()
-    subprocess.Popen(['yui-compressor', path], stdout=tmpout).communicate()
+    try:
+        subprocess.Popen(['yui-compressor', path], stdout=tmpout).communicate()
+    except OSError:
+        subprocess.Popen(['yuicompressor', path], stdout=tmpout).communicate()
     tmpout.seek(0)
     with open(path, 'w') as output:
         output.write(tmpout.read())
@@ -39,7 +43,17 @@ def genscripts():
 
     # copy scripts OpenLayers.js
     for path in glob.glob('public/js/*.js'):
-        shutil.copy(path, tmpdir)
+        if os.path.islink(path):
+            shutil.copy(path, tmpdir)
+        else:
+            # remove "use strict"; directive
+            with open(path) as inp:
+                dest = pathjoin(tmpdir, os.path.basename(path))
+                with open(dest, "w") as out:
+                    for line in inp:
+                        sline = line.strip()
+                        if sline != '"use strict"' and sline != '"use strict";':
+                            out.write(line)
 
     # build OpenLayers.js
     subprocess.call(['python', 'buildUncompressed.py',