@@ -49,12 +49,12 @@ def getpkginfopath(filename):
4949 stdout = subprocess .PIPE ,
5050 stderr = subprocess .PIPE )
5151 (bom , err ) = proc .communicate ()
52- bom = bom .strip ().split ('\n ' )
52+ bom = bom .strip ().split (b '\n ' )
5353 if proc .returncode == 0 :
5454 for entry in bom :
55- if entry .startswith ('PackageInfo' ):
55+ if entry .startswith (b 'PackageInfo' ):
5656 return entry
57- elif entry .endswith ('.pkg/PackageInfo' ):
57+ elif entry .endswith (b '.pkg/PackageInfo' ):
5858 return entry
5959 else :
6060 print ("Error: %s while extracting BOM for %s" % (err , filename ))
@@ -71,7 +71,7 @@ def extractpkginfo(filename):
7171 tmpFolder = tempfile .mkdtemp ()
7272 os .chdir (tmpFolder )
7373 # need to get path from BOM
74- pkgInfoPath = getpkginfopath (filename )
74+ pkgInfoPath = getpkginfopath (filename ). decode ( 'utf-8' )
7575
7676 extractedPkgInfoPath = os .path .join (tmpFolder , pkgInfoPath )
7777 cmd = ['/usr/bin/xar' , '-xf' , filename , pkgInfoPath ]
@@ -94,8 +94,8 @@ def getpkginfo(filename):
9494 dom = minidom .parse (pkgInfoPath )
9595 pkgRefs = dom .getElementsByTagName ('pkg-info' )
9696 for ref in pkgRefs :
97- pkgId = ref .attributes ['identifier' ].value . encode ( 'UTF-8' )
98- pkgVersion = ref .attributes ['version' ].value . encode ( 'UTF-8' )
97+ pkgId = ref .attributes ['identifier' ].value
98+ pkgVersion = ref .attributes ['version' ].value
9999 return pkgId , pkgVersion
100100
101101
0 commit comments