| 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() |