Fix paths inside created zips

This commit is contained in:
James Turner
2015-09-24 20:39:03 -05:00
parent 8823d89f42
commit b11fae7f37
+10 -9
View File
@@ -64,7 +64,7 @@ class PackageData:
@property @property
def scmRevision(self): def scmRevision(self):
currentRev = self._scm.scmRevisionForPath(self._path) currentRev = self._scm.scmRevisionForPath(self.path)
if (currentRev is None): if (currentRev is None):
raise RuntimeError("Unable to query SCM revision of files") raise RuntimeError("Unable to query SCM revision of files")
@@ -84,11 +84,11 @@ class PackageData:
foundPrimary = False foundPrimary = False
foundMultiple = False foundMultiple = False
for f in os.listdir(self._path): for f in os.listdir(self.path):
if not f.endswith("-set.xml"): if not f.endswith("-set.xml"):
continue continue
p = os.path.join(self._path, f) p = os.path.join(self.path, f)
node = sgprops.readProps(p, includePaths = includes) node = sgprops.readProps(p, includePaths = includes)
if not node.hasChild("sim"): if not node.hasChild("sim"):
continue continue
@@ -106,7 +106,7 @@ class PackageData:
if foundPrimary: if foundPrimary:
if not foundMultiple: if not foundMultiple:
print "Multiple primary -set.xml files at:" + self._path print "Multiple primary -set.xml files at:" + self.path
foundMultiple = True foundMultiple = True
continue continue
else: else:
@@ -116,11 +116,11 @@ class PackageData:
self.parsePrimarySetNode(simNode) self.parsePrimarySetNode(simNode)
for n in thumbnailNames: for n in thumbnailNames:
if os.path.exists(os.path.join(self._path, n)): if os.path.exists(os.path.join(self.path, n)):
self._thumbnails.append(n) self._thumbnails.append(n)
if not foundPrimary: if not foundPrimary:
raise RuntimeError("No primary -set.xml found at:" + self._path) raise RuntimeError("No primary -set.xml found at:" + self.path)
@@ -158,13 +158,14 @@ class PackageData:
def validate(self): def validate(self):
for t in self._thumbnails: for t in self._thumbnails:
if not os.path.exists(os.path.join(self._path, t)): if not os.path.exists(os.path.join(self.path, t)):
raise RuntimeError("missing thumbnail:" + t); raise RuntimeError("missing thumbnail:" + t);
def generateZip(self, outDir, globalExcludePath): def generateZip(self, outDir, globalExcludePath):
self._revision = self._previousRevision + 1 self._revision = self._previousRevision + 1
zipName = os.path.basename(self.path) + ".zip" baseName = os.path.basename(self.path)
zipName = baseName + ".zip"
zipFilePath = os.path.join(outDir, zipName) zipFilePath = os.path.join(outDir, zipName)
os.chdir(os.path.dirname(self.path)) os.chdir(os.path.dirname(self.path))
@@ -181,7 +182,7 @@ class PackageData:
print self.id, "has zip exclude list" print self.id, "has zip exclude list"
zipArgs += ["-x@" + excludePath] zipArgs += ["-x@" + excludePath]
zipArgs += [zipFilePath, self.path] zipArgs += [zipFilePath, baseName]
subprocess.call(zipArgs) subprocess.call(zipArgs)
zipFile = open(zipFilePath, 'r') zipFile = open(zipFilePath, 'r')