Revision: 12276
http://sourceforge.net/p/skim-app/code/12276
Author: hofman
Date: 2021-04-11 15:12:25 +0000 (Sun, 11 Apr 2021)
Log Message:
-----------
Print commands rather than messages, comapre numbers using == and !=
Modified Paths:
--------------
trunk/build_skim.py
Modified: trunk/build_skim.py
===================================================================
--- trunk/build_skim.py 2021-04-11 14:37:08 UTC (rev 12275)
+++ trunk/build_skim.py 2021-04-11 15:12:25 UTC (rev 12276)
@@ -111,6 +111,7 @@
# clean and rebuild the Xcode project
buildCmd = ["/usr/bin/xcodebuild", "clean", "-configuration", "Release",
"-target", "Skim", "-scheme", "Skim", "-derivedDataPath", DERIVED_DATA_DIR,
"SYMROOT=" + SYMROOT]
+ print(" ".join(buildCmd))
nullDevice = open("/dev/null", "w")
x = Popen(buildCmd, cwd=SOURCE_DIR)
rc = x.wait()
@@ -117,6 +118,7 @@
print("xcodebuild clean exited with status %s" % (rc))
buildCmd = ["/usr/bin/xcodebuild", "-configuration", "Release", "-target",
"Skim", "-scheme", "Skim", "-derivedDataPath", DERIVED_DATA_DIR, "SYMROOT=" +
SYMROOT, "CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO"]
+ print(" ".join(buildCmd))
nullDevice = open("/dev/null", "w")
x = Popen(buildCmd, cwd=SOURCE_DIR)#, stdout=nullDevice, stderr=nullDevice)
rc = x.wait()
@@ -125,9 +127,8 @@
def codesign(identity):
- print("codesign %s" % (BUILT_APP))
-
sign_cmd = [os.path.join(SOURCE_DIR, "codesign_skim.sh"), identity,
BUILT_APP]
+ print(" ".join(signCmd))
x = Popen(sign_cmd, cwd=SOURCE_DIR)
rc = x.wait()
print("codesign_skim.sh exited with status %s" % (rc))
@@ -135,10 +136,9 @@
def notarize_dmg_or_zip(archive_path, username, password):
- print("notarize %s" % (archive_path))
-
bundle_id = "net.sourceforce.skim-app.skim" +
os.path.splitext(archive_path)[1]
notarize_cmd = ["xcrun", "altool", "--notarize-app",
"--primary-bundle-id", bundle_id, "--username", username, "--password",
password, "--output-format", "xml", "--file", archive_path]
+ print(" ".join(notarize_cmd))
notarize_task = Popen(notarize_cmd, cwd=SOURCE_DIR, stdout=PIPE,
stderr=PIPE)
[output, error] = notarize_task.communicate()
rc = notarize_task.returncode
@@ -158,6 +158,7 @@
sleep(20)
notarize_cmd = ["xcrun", "altool", "--notarization-info",
request_uuid, "--username", username, "--password", password,
"--output-format", "xml"]
+ print(" ".join(notarize_cmd))
notarize_task = Popen(notarize_cmd, cwd=SOURCE_DIR, stdout=PIPE,
stderr=PIPE)
[output, error] = notarize_task.communicate()
rc = notarize_task.returncode
@@ -200,9 +201,8 @@
nullDevice = open("/dev/null", "w")
if create_new:
- print("wrap %s in disk image" % (BUILT_APP))
-
cmd = ["/usr/bin/hdiutil", "create", "-fs", "HFS+", "-srcfolder",
BUILT_APP, temp_dmg_path]
+ print(" ".join(cmd))
x = Popen(cmd, stdout=nullDevice, stderr=nullDevice)
rc = x.wait()
assert rc == 0, "hdiutil create failed"
@@ -213,8 +213,6 @@
# temporary volume
dst_volume_name = "/Volumes/Skim"
- print("wrap %s in disk image from %s" % (BUILT_APP, zip_dmg_name))
-
# see if this file already exists and bail
assert not os.path.exists(final_dmg_name), "%s exists" %
(final_dmg_name)
@@ -227,29 +225,29 @@
# when trying to unpack the resource fork/EA
nullDevice = open("/dev/null", "w")
- print("unzipping disk image %s to %s" % (zip_dmg_name, BUILD_ROOT))
cmd = ["/usr/bin/unzip", "-uo", zip_dmg_name, "-d", BUILD_ROOT]
+ print(" ".join(cmd))
x = Popen(cmd, stdout=nullDevice, stderr=nullDevice)
rc = x.wait()
assert rc == 0, "failed to unzip %s" % (zip_dmg_name)
# mount image
- print("mounting disk image %s" % (temp_dmg_path))
cmd = ["/usr/bin/hdiutil", "attach", "-nobrowse", "-noautoopen",
temp_dmg_path]
+ print(" ".join(cmd))
x = Popen(cmd, stdout=nullDevice, stderr=nullDevice)
rc = x.wait()
assert rc == 0, "failed to mount %s" % (temp_dmg_path)
# use cp to copy all files
- print("copying build product from %s to %s" % (BUILT_APP,
dst_volume_name))
cmd = ["/bin/cp", "-R", BUILT_APP, dst_volume_name]
+ print(" ".join(cmd))
x = Popen(cmd, stdout=nullDevice, stderr=nullDevice)
rc = x.wait()
assert rc == 0, "failed to copy %s" % (BUILT_APP)
# tell finder to set the icon position
- print("moving build product in disk image")
cmd = ["/usr/bin/osascript", "-e", """tell application "Finder" to set
the position of application file "Skim.app" of disk named "Skim" to {90,
206}"""]
+ print(" ".join(cmd))
x = Popen(cmd, stdout=nullDevice, stderr=nullDevice)
rc = x.wait()
assert rc == 0, "Finder failed to set position"
@@ -256,8 +254,8 @@
# data is copied, so unmount the volume, we may need to wait when the
volume is in use
n_tries = 0
- print("ejecting disk image %s" % (dst_volume_name))
cmd = ["/usr/sbin/diskutil", "eject", dst_volume_name]
+ print(" ".join(cmd))
x = Popen(cmd, stdout=nullDevice, stderr=nullDevice)
rc = x.wait()
while rc != 0:
@@ -268,8 +266,8 @@
rc = x.wait()
# resize image to fit
- print("resizing disk image %s" % (temp_dmg_path))
cmd = ["/usr/bin/hdiutil", "resize", temp_dmg_path]
+ print(" ".join(cmd))
x = Popen(cmd, stdout=PIPE, stderr=nullDevice)
size = x.communicate()[0].split(None, 1)[0]
cmd = ["/usr/bin/hdiutil", "resize", "-size", size + "b",
temp_dmg_path]
@@ -277,8 +275,8 @@
assert rc == 0, "failed to resize %s" % (temp_dmg_path)
# convert image to read only and compress
- print("converting disk image %s to read only disk image at %s" %
(temp_dmg_path, final_dmg_name))
cmd = ["/usr/bin/hdiutil", "convert", temp_dmg_path, "-format", "UDZO",
"-imagekey", "zlib-level=9", "-o", final_dmg_name]
+ print(" ".join(cmd))
x = Popen(cmd, stdout=nullDevice, stderr=nullDevice)
rc = x.wait()
assert rc == 0, "hdiutil convert failed"
@@ -294,9 +292,9 @@
# of date, since I sometimes want to upload multiple betas per day.
final_zip_name = os.path.join(BUILD_DIR,
os.path.splitext(os.path.basename(BUILT_APP))[0] + "-" + new_version_number +
".zip")
- print("zip %s" % (BUILT_APP))
nullDevice = open("/dev/null", "w")
cmd = ["/usr/bin/ditto", "-c", "-k", "--keepParent", BUILT_APP,
final_zip_name]
+ print(" ".join(cmd))
x = Popen(cmd)
rc = x.wait()
assert rc == 0, "zip creation failed"
@@ -318,9 +316,9 @@
noteString4 = "NOTE: "
changeStart = relNotes.find(changeString)
- if changeStart is not -1:
+ if changeStart != -1:
prevChangeStart = relNotes.find(changeString, changeStart +
len(changeString))
- if prevChangeStart is not -1:
+ if prevChangeStart != -1:
relNotes = relNotes[changeStart:prevChangeStart]
else:
relNotes = relNotes[changeStart]
@@ -333,11 +331,11 @@
start = relNotes.find("Bugs Fixed")
endBugs = len(relNotes)
endNew = len(relNotes)
- if start is not -1:
+ if start != -1:
endNew = start
while True:
start = relNotes.find(itemString, start, endBugs)
- if start is -1:
+ if start == -1:
break
start = start + len(itemString)
end = relNotes.find(endLineString, start, endBugs)
@@ -345,11 +343,11 @@
endNote = endNew
start = relNotes.find("New Features")
- if start is not -1:
+ if start != -1:
endNote = start
while True:
start = relNotes.find(itemString, start, endNew)
- if start is -1:
+ if start == -1:
break
start = start + len(itemString)
end = relNotes.find(endLineString, start, endNew)
@@ -357,13 +355,13 @@
note = ""
start = relNotes.find(noteString1, 0, endNote)
- if start is -1:
+ if start == -1:
start = relNotes.find(noteString2, 0, endNote)
- if start is -1:
+ if start == -1:
start = relNotes.find(noteString3, 0, endNote)
- if start is -1:
+ if start == -1:
start = relNotes.find(noteString4, 0, endNote)
- if start is not -1:
+ if start != -1:
end = relNotes.find(relNotes, start, endNote)
if end > start:
note = strip(relNotes[start:end])
@@ -382,7 +380,7 @@
stopString = "-----END DSA PRIVATE KEY-----"
stop = pwoutput.find(stopString)
- assert start is not -1 and stop is not -1, "failed to find DSA key in
secure note"
+ assert start != -1 and stop != -1, "failed to find DSA key in secure note"
key = pwoutput[start:stop] + stopString
@@ -463,11 +461,11 @@
insert = -1
start = -1
end = -1
- if appcastString.find("<title>Version " + newVersionString + "</title>")
is -1:
+ if appcastString.find("<title>Version " + newVersionString + "</title>")
== -1:
insert = appcastString.find("<channel>")
start = newItemString.find("<channel>")
end = newItemString.find("</item>")
- if insert is not -1 and start is not -1 and end is not -1:
+ if insert != -1 and start != -1 and end != -1:
appcastString = appcastString[:insert+9] +
newItemString[start+9:end+7] + appcastString[insert+9:]
appcastName = "skim.xml"
else:
@@ -548,8 +546,10 @@
notarize_dmg_or_zip(archive_path, username, password)
if archive_path.endswith("dmg"):
- # xcrun stapler staple Skim.app-1.4.dmg
- x = Popen(["xcrun", "stapler", "staple", archive_path])
+ # xcrun stapler staple Skim-1.4.dmg
+ staple_cmd = ["xcrun", "stapler", "staple", archive_path]
+ print(" ".join(staple_cmd))
+ x = Popen(staple_cmd)
rc = x.wait()
assert rc == 0, "stapler failed"
else:
@@ -556,7 +556,9 @@
# staple the application, then delete the zip we notarized
# and make a new zip of the stapled application, because stapler
# won't staple a damn zip file
https://developer.apple.com/forums/thread/115670
- x = Popen(["xcrun", "stapler", "staple", BUILT_APP])
+ staple_cmd = ["xcrun", "stapler", "staple", BUILT_APP]
+ print(" ".join(staple_cmd))
+ x = Popen(staple_cmd)
rc = x.wait()
assert rc == 0, "stapler failed"
os.unlink(archive_path)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit