Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: packager.py

Issue 9257092: More build tools improvements (Closed)
Patch Set: Created Jan. 25, 2013, 10:22 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « localeTools.py ('k') | packagerChrome.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packager.py
===================================================================
--- a/packager.py
+++ b/packager.py
@@ -40,16 +40,17 @@ def getBuildNum(baseDir):
except Exception:
return '0'
def getBuildVersion(baseDir, metadata, releaseBuild, buildNum=None):
version = metadata.get('general', 'version')
if not releaseBuild:
if buildNum == None:
buildNum = getBuildNum(baseDir)
+ buildNum = str(buildNum)
if len(buildNum) > 0:
if re.search(r'(^|\.)\d+$', version):
# Numerical version number - need to fill up with zeros to have three
# version components.
while version.count('.') < 2:
version += '.0'
version += '.' + buildNum
return version
@@ -86,23 +87,25 @@ class Files(dict):
self.read(os.path.join(path, file), name)
else:
file = open(path, 'rb')
if relpath in self:
print >>sys.stderr, 'Warning: File %s defined multiple times' % relpath
self[relpath] = file.read()
file.close()
- def readMappedFiles(self, baseDir, mappings):
- for target, source in mappings:
+ def readMappedFiles(self, mappings):
+ for item in mappings:
+ target, source = item
+
# Make sure the file is inside an included directory
if '/' in target and not self.isIncluded(target):
continue
parts = source.split('/')
- path = os.path.join(baseDir, *parts)
+ path = os.path.join(os.path.dirname(item.source), *parts)
if os.path.exists(path):
self.read(path, target)
else:
print >>sys.stderr, 'Warning: Mapped file %s doesn\'t exist' % source
def zip(self, outFile, sortKey=None):
zip = zipfile.ZipFile(outFile, 'w', zipfile.ZIP_DEFLATED)
names = self.keys()
« no previous file with comments | « localeTools.py ('k') | packagerChrome.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld