X-Git-Url: https://dev.renevier.net/?p=syj.git;a=blobdiff_plain;f=scripts%2Frelease.py;h=3b5c9ea5ae99cb3e017185d897ff457737019e47;hp=a95ddd6b6a7284b8293c104f0b35ed87a37740cf;hb=e0424f1a73703cc35801f8e9cd24d3a4340eca94;hpb=7ab93faefae14af39fc5449a2c3311dd68d2c0f9 diff --git a/scripts/release.py b/scripts/release.py index a95ddd6..3b5c9ea 100755 --- a/scripts/release.py +++ b/scripts/release.py @@ -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', @@ -81,8 +95,12 @@ def install(source, target): shutil.copy(source, buildtarget) else: + hascontent = False for item in glob.glob(source): + hascontent = True install(item, target) + if not hascontent: # not a directory or a file or a list of files + raise Exception(("%s does not exist" % source)) def main(): if os.path.isdir(__BUILD__):