Created
May 10, 2013 20:47
-
-
Save bruienne/5557275 to your computer and use it in GitHub Desktop.
Modification to adobeutils.py to account for CCP-generated pkgs which bury the expected payloads folder at an additional subdir level, hampering the installs key generation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def getCS5mediaSignature(dirpath): | |
| '''Returns the CS5 mediaSignature for an AAMEE CS5 install. | |
| dirpath is typically the root of a mounted dmg''' | |
| for (path, unused_dirs, unused_files) in os.walk(dirpath): | |
| if path.endswith("/payloads"): | |
| parentdir = path | |
| # now look for setup.xml | |
| setupxml = os.path.join(parentdir, "Setup.xml") | |
| if os.path.exists(setupxml) and os.path.isfile(setupxml): | |
| # parse the XML | |
| dom = minidom.parse(setupxml) | |
| setupElements = dom.getElementsByTagName("Setup") | |
| if setupElements: | |
| mediaSignatureElements = \ | |
| setupElements[0].getElementsByTagName("mediaSignature") | |
| if mediaSignatureElements: | |
| element = mediaSignatureElements[0] | |
| elementvalue = '' | |
| for node in element.childNodes: | |
| elementvalue += node.nodeValue | |
| return elementvalue | |
| return "" | |
Also, if there is no directory ending with "/payloads", parentdir is uninitialized and will cause and exception to be raised at line 10.
So how about this instead:
def getCS5mediaSignature(dirpath):
'''Returns the CS5 mediaSignature for an AAMEE CS5 install.
dirpath is typically the root of a mounted dmg'''
payloads_dir = ""
# look for a payloads folder
for (path, unused_dirs, unused_files) in os.walk(dirpath):
if path.endswith("/payloads"):
payloads_dir = path
# return empty-handed if we didn't find a payloads folder
if not payloads_dir:
return ""
# now look for setup.xml
setupxml = os.path.join(payloads_dir, "Setup.xml")
if os.path.exists(setupxml) and os.path.isfile(setupxml):
# parse the XML
dom = minidom.parse(setupxml)
setupElements = dom.getElementsByTagName("Setup")
if setupElements:
mediaSignatureElements = \
setupElements[0].getElementsByTagName("mediaSignature")
if mediaSignatureElements:
element = mediaSignatureElements[0]
elementvalue = ''
for node in element.childNodes:
elementvalue += node.nodeValue
return elementvalue
return ""
Author
Looks good, I actually had saved a version that initializes payloads_dir first but pasted without - definitely needs to be there.
Full tree of the CCP Resources folder is here: https://gist.github.com/bruienne/5557843
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'd love to see the corresponding directory trees of the same product packaged with AAMEE and with CCP.