33import argparse
44import string
55import os
6-
6+ import subprocess
77
88
99quickpkg_version = '0.0'
@@ -18,6 +18,7 @@ def logger(log, v=0):
1818 if args .verbosity >= v :
1919 print log
2020
21+
2122def cmdexec (command ):
2223 """Execute a command."""
2324 # if 'command' is a string, split the string into components
@@ -32,47 +33,49 @@ def cmdexec(command):
3233 # strip trailing whitespace, which would mess with string comparisons
3334 return {"return_code" : proc .returncode , "stderr" : stderr .rstrip (), "stdout" : stdout .rstrip ()}
3435
36+
3537def attachdmg (dmgpath ):
36-
37- #command to run
38- #hdiutil attach ~/Downloads/BBEdit_11.1.4.dmg -mountrandom /tmp -plist -nobrowse
39-
40- # returns
41- #<?xml version="1.0" encoding="UTF-8"?>
42- #<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
43- #<plist version="1.0">
44- #<dict>
45- # <key>system-entities</key>
46- # <array>
47- # <dict>
48- # <key>content-hint</key>
49- # <string>Apple_HFS</string>
50- # <key>dev-entry</key>
51- # <string>/dev/disk4s1</string>
52- # <key>mount-point</key>
53- # <string>/private/tmp/dmg.6fzBvH</string>
54- # <key>potentially-mountable</key>
55- # <true/>
56- # <key>unmapped-content-hint</key>
57- # <string>48465300-0000-11AA-AA11-00306543ECAC</string>
58- # <key>volume-kind</key>
59- # <string>hfs</string>
60- # </dict>
61- # <dict>
62- # <key>content-hint</key>
63- # <string>GUID_partition_scheme</string>
64- # <key>dev-entry</key>
65- # <string>/dev/disk4</string>
66- # <key>potentially-mountable</key>
67- # <false/>
68- # <key>unmapped-content-hint</key>
69- # <string>GUID_partition_scheme</string>
70- # </dict>
71- # </array>
72- #</dict>
73- #</plist>
74-
75-
38+ return
39+
40+
41+ # command to run
42+ # hdiutil attach ~/Downloads/BBEdit_11.1.4.dmg -mountrandom /tmp -plist -nobrowse
43+ #
44+ # returns
45+ # <?xml version="1.0" encoding="UTF-8"?>
46+ # <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
47+ # <plist version="1.0">
48+ # <dict>
49+ # <key>system-entities</key>
50+ # <array>
51+ # <dict>
52+ # <key>content-hint</key>
53+ # <string>Apple_HFS</string>
54+ # <key>dev-entry</key>
55+ # <string>/dev/disk4s1</string>
56+ # <key>mount-point</key>
57+ # <string>/private/tmp/dmg.6fzBvH</string>
58+ # <key>potentially-mountable</key>
59+ # <true/>
60+ # <key>unmapped-content-hint</key>
61+ # <string>48465300-0000-11AA-AA11-00306543ECAC</string>
62+ # <key>volume-kind</key>
63+ # <string>hfs</string>
64+ # </dict>
65+ # <dict>
66+ # <key>content-hint</key>
67+ # <string>GUID_partition_scheme</string>
68+ # <key>dev-entry</key>
69+ # <string>/dev/disk4</string>
70+ # <key>potentially-mountable</key>
71+ # <false/>
72+ # <key>unmapped-content-hint</key>
73+ # <string>GUID_partition_scheme</string>
74+ # </dict>
75+ # </array>
76+ # </dict>
77+ # </plist>
78+
7679
7780if __name__ == "__main__" :
7881 # for convenience link to argparse tutorial:
@@ -98,16 +101,14 @@ if __name__ == "__main__":
98101 # get file extension
99102 (item_basename , item_extension ) = os .path .splitext (item_path )
100103 item_extension = string .lstrip (item_extension , '.' )
101-
104+
102105 # is extension supported
103- if not item_extension in supported_extensions :
106+ if item_extension not in supported_extensions :
104107 print ".%s is not a supported extension!" % item_extension
105108 exit (1 )
106-
109+
107110 # if item is a dmg, mount it and find useful contents
108-
111+
109112 # extract version and other metadata
110-
113+
111114 # run pkgutil to build result
112-
113-
0 commit comments