Revision: 27212
          http://sourceforge.net/p/bibdesk/svn/27212
Author:   hofman
Date:     2022-01-05 14:39:11 +0000 (Wed, 05 Jan 2022)
Log Message:
-----------
Extra option to set the new version numbers in build script

Modified Paths:
--------------
    trunk/bibdesk/build_release.py

Modified: trunk/bibdesk/build_release.py
===================================================================
--- trunk/bibdesk/build_release.py      2022-01-05 10:34:54 UTC (rev 27211)
+++ trunk/bibdesk/build_release.py      2022-01-05 14:39:11 UTC (rev 27212)
@@ -9,7 +9,7 @@
 
 #
 # SYNOPSIS
-#   build_release.sh [-s sign_id] [-n notarize_password] [-o out] [-a zip|dmg|]
+#   build_release.sh [-s sign_id] [-n notarize_password] [-o out] [-a 
zip|dmg|] [-v version]
 #
 # OPTIONS
 #   -s --sign
@@ -20,6 +20,8 @@
 #      Output directory for the final archive and appcast, defaults to the 
user's Desktop
 #   -a, --archive
 #      The type of archive the app bundle is wrapped in, the prepared disk 
image when empty
+#   -v, --version
+#      The new short version string, also bumps the version when this is passed
 #
 
 #
@@ -96,8 +98,24 @@
 PLIST_PATH = os.path.join(BUILT_APP, "Contents", "Info.plist")
 RELNOTES_PATH = os.path.join(BUILT_APP, "Contents", "Resources", 
"RelNotes.rtf")
 
+def bump_versions(newVersion):
+    
+    # bump the version number
+    bumpCmd = ["/usr/bin/agvtool", "bump"]
+    print(" ".join(bumpCmd))
+    x = Popen(bumpCmd, cwd=SOURCE_DIR)
+    rc = x.wait()
+    assert rc == 0, "agvtool bump failed"
+    
+    # change CFBundleVersion and rewrite the Info.plist
+    infoPlist = plistlib.readPlist(PLIST_PATH)
+    assert infoPlist is not None, "unable to read Info.plist"
+    infoPlist["CFBundleShortVersionString"] = newVersion
+    minimumSystemVersion = infoPlist["LSMinimumSystemVersion"]
+    plistlib.writePlist(infoPlist, PLIST_PATH)
+
 def read_versions():
-
+    
     # read CFBundleVersion, CFBundleShortVersionString, LSMinimumSystemVersion 
and from Info.plist
     infoPlist = plistlib.readPlist(PLIST_PATH)
     assert infoPlist is not None, "unable to read Info.plist"
@@ -483,10 +501,10 @@
     notarize = ""
     out = os.path.join(os.getenv("HOME"), "Desktop")
     archive = ""
-    test = False
+    version = ""
     
     try:
-        opts, args = getopt.getopt(sys.argv[1:], "s:n:o:a:t", ["sign=", 
"notarize=", "out=", "archive=", "test"])
+        opts, args = getopt.getopt(sys.argv[1:], "s:n:o:a:v:", ["sign=", 
"notarize=", "out=", "archive=", "version="])
     except:
         sys.stderr.write("error reading options\n")
     
@@ -499,15 +517,18 @@
             out = arg
         elif opt in ["-a", "--archive"]:
             archive = arg
-        elif opt in ["-t", "--test"]:
-            test = True
+        elif opt in ["-v", "--version"]:
+            version = arg
     
-    return sign, notarize, out, archive, test
+    return sign, notarize, out, archive, version
 
 if __name__ == '__main__':
     
-    sign_id, notarize_password, out, archive, test = get_options()
+    sign_id, notarize_password, out, archive, version = get_options()
     
+    if version != "":
+        bump_versions(version)
+    
     clean_and_build()
     
     if sign_id != "":

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to