Name files by separating the version with _.
authorJoe Wreschnig <joe.wreschnig@gmail.com>
Mon, 8 Sep 2014 09:59:20 +0000 (11:59 +0200)
committerJoe Wreschnig <joe.wreschnig@gmail.com>
Mon, 8 Sep 2014 09:59:20 +0000 (11:59 +0200)
Parse off the version number correctly during package.json generation.

BUGS.org
Makefile
rules/node-webkit.mk
tools/generate-nw

index dcde463..08497da 100644 (file)
--- a/BUGS.org
+++ b/BUGS.org
@@ -1,5 +1,5 @@
 * Next Version
-** Upgrade node-webkit wrapper to 0.10.4.
+** DONE Upgrade node-webkit wrapper to 0.10.4.
    This moves the Windows version of Chromium several steps forward,
    and fixes the stall that prevented the 0.10.x series from working
    properly on Windows before.
@@ -7,7 +7,8 @@
    Actually, they still do in most browsers, but as position: sticky
    support rolls out, they will work correctly.
 ** DONE Include DLLs necessary for broader Windows support
+** DONE Fix version number in OS X About dialog
+
 
 * Pending
-** TODO Fix version number in OS X About dialog
 ** TODO Detect WebGL failure on Windows and offer DX redistributable
index 3753998..0649138 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@ include rules/pngcrush.mk
 APPLICATION := pwl6
 DISTDIR := build/dist
 VERSION := $(call git-describe)
-DISTROOT := $(DISTDIR)/$(APPLICATION)-$(VERSION)
+DISTROOT := $(DISTDIR)/$(APPLICATION)_$(VERSION)
 
 FIND_FILES := -type f ! -name '.*'
 FIND_JS := -type f -name '*.js'
@@ -96,6 +96,6 @@ $(DISTROOT).bare.zip: | .git
 %.nw: %.bare.zip tools/generate-nw
        $(RM) -r $@ $@.tmp
        $(UNZIP) -d $@.tmp $<
-       tools/generate-nw $@.tmp
+       tools/generate-nw $@.tmp `echo $(*F) | sed -E 's/.+_[^0-9]+//'`
        cd $@.tmp && $(ZIP) -r ../$(@F) .
        $(RM) -r $@.tmp
index 79d8178..dd46e17 100644 (file)
@@ -55,7 +55,7 @@ define node-webkit-package-linux
        mkdir -p $(@:.tar.gz=)
        mv $(@D)/$(notdir $(2:.tar.gz=)) $(@:.tar.gz=)/nw
        cp -a $1 $(@:.tar.gz=)/nw/package.nw
-       cp -a tools/nw-linux-wrapper $(@:.tar.gz=)/`echo $(notdir $1) | sed -E 's/-[^-]+$$//'`
+       cp -a tools/nw-linux-wrapper $(@:.tar.gz=)/`echo $(notdir $1) | sed -E 's/_.+//'`
        $(RM) $(@:.tar.gz=)/nw/nwsnapshot
        mv $(@:.tar.gz=)/nw/credits.html $(@:.tar.gz=)/nw/node-webkit\ credits.html
        tar -czf $@ -C $(@D) $(@F:.tar.gz=)
@@ -84,7 +84,7 @@ define node-webkit-package-win
        mv $(@:.zip=)/credits.html $(@:.zip=)/node-webkit\ credits.html
        cp -a $< $(@:.zip=)/package.nw
        cp -a $(node-webkit-directx) $(@:.zip=)
-       mv $(@:.zip=)/nw.exe $(@:.zip=)/`echo $(notdir $1) | sed -E 's/-[^-]+$$/.exe/'`
+       mv $(@:.zip=)/nw.exe $(@:.zip=)/`echo $(notdir $1) | sed -E 's/_.+/.exe/'`
        cd $(@D) && $(ZIP) -r $(@F) $(@F:.zip=)
        $(RM) -r $(@:.zip=)
 endef
index a3cd564..61959f2 100755 (executable)
@@ -16,7 +16,7 @@ def is_html(filename):
 def attr(name):
     return "data-" + name + """=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?"""
 
-def main(appdir):
+def main(appdir, version=None):
     if not os.path.isdir(appdir):
         raise StandardError("input (%r) is not a directory" % appdir)
     indexes = []
@@ -36,7 +36,7 @@ def main(appdir):
     package = {
         "main": indexes[0],
         "name": name,
-        "version": "0.0.0",
+        "version": version or "0.0.0",
         "window": {
             "show": False,
             "toolbar": False,
@@ -79,11 +79,4 @@ def main(appdir):
 
 if __name__ == "__main__":
     import sys
-    try:
-        appdir = sys.argv[1]
-    except IndexError:
-        raise SystemExit("Usage: %s appdir" %(
-            sys.argv[0]))
-    else:
-        main(appdir)
-        
+    main(*sys.argv[1:])