def showDescriptions(baseDir, scriptName, opts, args, type): locales = None for option, value in opts: if option in ('-l', '--locales'): locales = value.split(',') import buildtools.packagerGecko as packager if locales == None: locales = packager.getLocales(baseDir) elif locales == 'all': locales = packager.getLocales(baseDir, True) data = packager.readLocaleMetadata(baseDir, locales) localeCodes = data.keys() localeCodes.sort() for localeCode in localeCodes: locale = data[localeCode] print ('''%s %s %s %s %s ''' % (localeCode, locale['name'] if 'name' in locale else 'None', locale['description'] if 'description' in locale else 'None', locale['description.short'] if 'description.short' in locale else 'None', locale['description.long'] if 'description.long' in locale else 'None', )).encode('utf-8')
def run(baseDir, version, keyFile, downloadsRepo): # Replace version number in metadata file "manually", ConfigParser will mess # up the order of lines. handle = open(packager.getMetadataPath(baseDir), 'rb') rawMetadata = handle.read() handle.close() versionRegExp = re.compile(r'^(\s*version\s*=\s*).*', re.I | re.M) rawMetadata = re.sub(versionRegExp, r'\g<1>%s' % version, rawMetadata) handle = open(packager.getMetadataPath(baseDir), 'wb') handle.write(rawMetadata) handle.close() # Read extension name and branch name locales = packager.readLocaleMetadata(baseDir, [packager.defaultLocale]) extensionName = locales[packager.defaultLocale]['name'] metadata = packager.readMetadata(baseDir) # Now commit the change and tag it subprocess.Popen(['hg', 'commit', '-R', baseDir, '-m', 'Releasing %s %s' % (extensionName, version)]).communicate() subprocess.Popen(['hg', 'tag', '-R', baseDir, '-f', version]).communicate() # Create a release build buildPath = os.path.join(downloadsRepo, packager.getDefaultFileName(baseDir, metadata, version)) packager.createBuild(baseDir, outFile=buildPath, releaseBuild=True, keyFile=keyFile) # Create source archive archivePath = os.path.splitext(buildPath)[0] + '-source.tgz' archiveHandle = open(archivePath, 'wb') archive = tarfile.open(fileobj=archiveHandle, name=os.path.basename(archivePath), mode='w:gz') (data, dummy) = subprocess.Popen(['hg', 'archive', '-R', baseDir, '-t', 'tar', '-S', '-'], stdout=subprocess.PIPE).communicate() repoArchive = tarfile.open(fileobj=StringIO(data), mode='r:') for fileInfo in repoArchive: if os.path.basename(fileInfo.name) in ('.hgtags', '.hgignore'): continue fileData = repoArchive.extractfile(fileInfo) fileInfo.name = re.sub(r'^[^/]+/', '', fileInfo.name) archive.addfile(fileInfo, fileData) repoArchive.close() archive.close() archiveHandle.close() # Now add the downloads and commit subprocess.Popen(['hg', 'add', '-R', downloadsRepo, buildPath, archivePath]).communicate() subprocess.Popen(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing %s %s' % (extensionName, version)]).communicate() # Push all changes subprocess.Popen(['hg', 'push', '-R', baseDir]).communicate() subprocess.Popen(['hg', 'push', '-R', downloadsRepo]).communicate()
def run(baseDir, type, version, keyFile, downloadsRepo): if type == 'gecko': import buildtools.packagerGecko as packager elif type == 'safari': import buildtools.packagerSafari as packager elif type == 'edge': import buildtools.packagerEdge as packager elif type == 'chrome': import buildtools.packagerChrome as packager # Replace version number in metadata file "manually", ConfigParser will mess # up the order of lines. metadata = readMetadata(baseDir, type) with open(metadata.option_source('general', 'version'), 'r+b') as file: rawMetadata = file.read() rawMetadata = re.sub(r'^(\s*version\s*=\s*).*', r'\g<1>%s' % version, rawMetadata, flags=re.I | re.M) file.seek(0) file.write(rawMetadata) file.truncate() # Read extension name from locale data import buildtools.packagerGecko as packagerGecko if type == 'gecko': locales_base = baseDir else: # This is somewhat of a hack but reading out locale import config here would be too much locales_base = os.path.join(baseDir, 'adblockplus') locales = packagerGecko.readLocaleMetadata(locales_base, [packagerGecko.defaultLocale]) extensionName = locales[packagerGecko.defaultLocale]['name'] # Now commit the change and tag it subprocess.check_call([ 'hg', 'commit', '-R', baseDir, '-m', 'Releasing %s %s' % (extensionName, version) ]) tag_name = version if type in {'safari', 'edge'}: tag_name = '{}-{}'.format(tag_name, type) subprocess.check_call(['hg', 'tag', '-R', baseDir, '-f', tag_name]) # Create a release build downloads = [] if type == 'gecko': buildPath = os.path.join(downloadsRepo, getDefaultFileName(metadata, version, 'xpi')) packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild=True) downloads.append(buildPath) elif type == 'chrome': # Create both signed and unsigned Chrome builds (the latter for Chrome Web Store). buildPath = os.path.join(downloadsRepo, getDefaultFileName(metadata, version, 'crx')) packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild=True, keyFile=keyFile) downloads.append(buildPath) buildPathUnsigned = os.path.join( baseDir, getDefaultFileName(metadata, version, 'zip')) packager.createBuild(baseDir, type=type, outFile=buildPathUnsigned, releaseBuild=True, keyFile=None) elif type == 'safari': buildPath = os.path.join( downloadsRepo, getDefaultFileName(metadata, version, 'safariextz')) packager.createBuild(baseDir, type='safari', outFile=buildPath, releaseBuild=True, keyFile=keyFile) downloads.append(buildPath) elif type == 'edge': # We only offer the Edge extension for use through the Windows Store buildPath = os.path.join(downloadsRepo, getDefaultFileName(metadata, version, 'appx')) packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild=True) downloads.append(buildPath) # Create source archive archivePath = os.path.splitext(buildPath)[0] + '-source.tgz' create_sourcearchive(baseDir, archivePath) downloads.append(archivePath) # Now add the downloads and commit subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) subprocess.check_call([ 'hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing %s %s' % (extensionName, version) ]) # Push all changes subprocess.check_call(['hg', 'push', '-R', baseDir]) subprocess.check_call(['hg', 'push', '-R', downloadsRepo])
def run(baseDir, type, version, keyFile, downloadsRepo): if type == "gecko": import buildtools.packagerGecko as packager elif type == "chrome": import buildtools.packagerChrome as packager # Replace version number in metadata file "manually", ConfigParser will mess # up the order of lines. handle = open(packager.getMetadataPath(baseDir, type), 'rb') rawMetadata = handle.read() handle.close() versionRegExp = re.compile(r'^(\s*version\s*=\s*).*', re.I | re.M) rawMetadata = re.sub(versionRegExp, r'\g<1>%s' % version, rawMetadata) handle = open(packager.getMetadataPath(baseDir, type), 'wb') handle.write(rawMetadata) handle.close() # Read extension name from locale data import buildtools.packagerGecko as packagerGecko if type == "gecko": locales_base = baseDir else: # This is somewhat of a hack but reading out locale import config here would be too much locales_base = os.path.join(baseDir, "adblockplus") locales = packagerGecko.readLocaleMetadata(locales_base, [packagerGecko.defaultLocale]) extensionName = locales[packagerGecko.defaultLocale]['name'] # Now commit the change and tag it subprocess.check_call([ 'hg', 'commit', '-R', baseDir, '-m', 'Releasing %s %s' % (extensionName, version) ]) subprocess.check_call(['hg', 'tag', '-R', baseDir, '-f', version]) # Create a release build downloads = [] if type == "gecko": metadata = packager.readMetadata(baseDir, type) buildPath = os.path.join( downloadsRepo, packager.getDefaultFileName(baseDir, metadata, version, 'xpi')) packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild=True, keyFile=keyFile) downloads.append(buildPath) elif type == "chrome": # We actually have to create three different builds for Chrome: signed a unsigned Chrome builds # (the latter for Chrome Web Store) and a signed Opera build. metadata = packager.readMetadata(baseDir, type) buildPath = os.path.join( downloadsRepo, packager.getDefaultFileName(baseDir, metadata, version, 'crx')) packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild=True, keyFile=keyFile) downloads.append(buildPath) buildPathUnsigned = os.path.join( baseDir, packager.getDefaultFileName(baseDir, metadata, version, 'zip')) packager.createBuild(baseDir, type=type, outFile=buildPathUnsigned, releaseBuild=True, keyFile=None) metadataOpera = packager.readMetadata(baseDir, "opera") buildPathOpera = os.path.join( downloadsRepo, packager.getDefaultFileName(baseDir, metadataOpera, version, 'crx')) packager.createBuild(baseDir, type="opera", outFile=buildPathOpera, releaseBuild=True, keyFile=keyFile) downloads.append(buildPathOpera) # Create source archive archivePath = os.path.splitext(buildPath)[0] + '-source.tgz' archiveHandle = open(archivePath, 'wb') archive = tarfile.open(fileobj=archiveHandle, name=os.path.basename(archivePath), mode='w:gz') data = subprocess.check_output( ['hg', 'archive', '-R', baseDir, '-t', 'tar', '-S', '-']) repoArchive = tarfile.open(fileobj=StringIO(data), mode='r:') for fileInfo in repoArchive: if os.path.basename(fileInfo.name) in ('.hgtags', '.hgignore'): continue fileData = repoArchive.extractfile(fileInfo) fileInfo.name = re.sub(r'^[^/]+/', '', fileInfo.name) archive.addfile(fileInfo, fileData) repoArchive.close() archive.close() archiveHandle.close() downloads.append(archivePath) # Now add the downloads and commit subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) subprocess.check_call([ 'hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing %s %s' % (extensionName, version) ]) # Push all changes subprocess.check_call(['hg', 'push', '-R', baseDir]) subprocess.check_call(['hg', 'push', '-R', downloadsRepo])
def run(baseDir, type, version, keyFiles, downloadsRepo): if type == "gecko": import buildtools.packagerGecko as packager elif type == "chrome": import buildtools.packagerChrome as packager # Replace version number in metadata file "manually", ConfigParser will mess # up the order of lines. metadata = packager.readMetadata(baseDir, type) with open(metadata.option_source("general", "version"), 'r+b') as file: rawMetadata = file.read() rawMetadata = re.sub( r'^(\s*version\s*=\s*).*', r'\g<1>%s' % version, rawMetadata, flags=re.I | re.M ) file.seek(0) file.write(rawMetadata) file.truncate() # Read extension name from locale data import buildtools.packagerGecko as packagerGecko if type == "gecko": locales_base = baseDir else: # This is somewhat of a hack but reading out locale import config here would be too much locales_base = os.path.join(baseDir, "adblockcash") locales = packagerGecko.readLocaleMetadata(locales_base, [packagerGecko.defaultLocale]) extensionName = locales[packagerGecko.defaultLocale]['name'] # Now commit the change and tag it subprocess.check_call(['hg', 'commit', '-R', baseDir, '-m', 'Releasing %s %s' % (extensionName, version)]) subprocess.check_call(['hg', 'tag', '-R', baseDir, '-f', version]) # Create a release build downloads = [] if type == "gecko": keyFile = keyFiles[0] if keyFiles else None metadata = packager.readMetadata(baseDir, type) buildPath = os.path.join(downloadsRepo, packager.getDefaultFileName(baseDir, metadata, version, 'xpi')) packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild=True, keyFile=keyFile) downloads.append(buildPath) elif type == "chrome": # We actually have to create four different builds for Chrome: signed a unsigned Chrome builds # (the latter for Chrome Web Store), a signed Opera build and a signed Safari build. metadata = packager.readMetadata(baseDir, type) buildPath = os.path.join(downloadsRepo, packager.getDefaultFileName(baseDir, metadata, version, 'crx')) packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild=True, keyFile=keyFiles[0]) downloads.append(buildPath) buildPathUnsigned = os.path.join(baseDir, packager.getDefaultFileName(baseDir, metadata, version, 'zip')) packager.createBuild(baseDir, type=type, outFile=buildPathUnsigned, releaseBuild=True, keyFile=None) metadataOpera = packager.readMetadata(baseDir, "opera") buildPathOpera = os.path.join(downloadsRepo, packager.getDefaultFileName(baseDir, metadataOpera, version, 'crx')) packager.createBuild(baseDir, type="opera", outFile=buildPathOpera, releaseBuild=True, keyFile=keyFiles[0]) downloads.append(buildPathOpera) import buildtools.packagerSafari as packagerSafari metadataSafari = packagerSafari.readMetadata(baseDir, "safari") buildPathSafari = os.path.join(downloadsRepo, packagerSafari.getDefaultFileName(baseDir, metadataSafari, version, 'safariextz')) packagerSafari.createBuild(baseDir, type="safari", outFile=buildPathSafari, releaseBuild=True, keyFile=keyFiles[1]) downloads.append(buildPathSafari) # Create source archive archivePath = os.path.splitext(buildPath)[0] + '-source.tgz' create_sourcearchive(baseDir, archivePath) downloads.append(archivePath) # Now add the downloads and commit subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) subprocess.check_call(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing %s %s' % (extensionName, version)]) # Push all changes subprocess.check_call(['hg', 'push', '-R', baseDir]) subprocess.check_call(['hg', 'push', '-R', downloadsRepo])
def run(baseDir, version, keyFile, downloadsRepo): # Replace version number in metadata file "manually", ConfigParser will mess # up the order of lines. handle = open(packager.getMetadataPath(baseDir), 'rb') rawMetadata = handle.read() handle.close() versionRegExp = re.compile(r'^(\s*version\s*=\s*).*', re.I | re.M) rawMetadata = re.sub(versionRegExp, r'\g<1>%s' % version, rawMetadata) handle = open(packager.getMetadataPath(baseDir), 'wb') handle.write(rawMetadata) handle.close() # Read extension name and branch name locales = packager.readLocaleMetadata(baseDir, [packager.defaultLocale]) extensionName = locales[packager.defaultLocale]['name'] metadata = packager.readMetadata(baseDir) # Now commit the change and tag it subprocess.Popen([ 'hg', 'commit', '-R', baseDir, '-m', 'Releasing %s %s' % (extensionName, version) ]).communicate() subprocess.Popen(['hg', 'tag', '-R', baseDir, '-f', version]).communicate() # Create a release build buildPath = os.path.join( downloadsRepo, packager.getDefaultFileName(baseDir, metadata, version)) packager.createBuild(baseDir, outFile=buildPath, releaseBuild=True, keyFile=keyFile) # Create source archive archivePath = os.path.splitext(buildPath)[0] + '-source.tgz' archiveHandle = open(archivePath, 'wb') archive = tarfile.open(fileobj=archiveHandle, name=os.path.basename(archivePath), mode='w:gz') (data, dummy) = subprocess.Popen( ['hg', 'archive', '-R', baseDir, '-t', 'tar', '-S', '-'], stdout=subprocess.PIPE).communicate() repoArchive = tarfile.open(fileobj=StringIO(data), mode='r:') for fileInfo in repoArchive: if os.path.basename(fileInfo.name) in ('.hgtags', '.hgignore'): continue fileData = repoArchive.extractfile(fileInfo) fileInfo.name = re.sub(r'^[^/]+/', '', fileInfo.name) archive.addfile(fileInfo, fileData) repoArchive.close() archive.close() archiveHandle.close() # Now add the downloads and commit subprocess.Popen( ['hg', 'add', '-R', downloadsRepo, buildPath, archivePath]).communicate() subprocess.Popen([ 'hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing %s %s' % (extensionName, version) ]).communicate() # Push all changes subprocess.Popen(['hg', 'push', '-R', baseDir]).communicate() subprocess.Popen(['hg', 'push', '-R', downloadsRepo]).communicate()
def run(baseDir, type, version, keyFiles, downloadsRepo): if type == "gecko": import buildtools.packagerGecko as packager elif type == "chrome": import buildtools.packagerChrome as packager # Replace version number in metadata file "manually", ConfigParser will mess # up the order of lines. metadata = packager.readMetadata(baseDir, type) with open(metadata.option_source("general", "version"), 'r+b') as file: rawMetadata = file.read() rawMetadata = re.sub( r'^(\s*version\s*=\s*).*', r'\g<1>%s' % version, rawMetadata, flags=re.I | re.M ) file.seek(0) file.write(rawMetadata) file.truncate() # Read extension name from locale data import buildtools.packagerGecko as packagerGecko if type == "gecko": locales_base = baseDir else: # This is somewhat of a hack but reading out locale import config here would be too much locales_base = os.path.join(baseDir, "adblockplus") locales = packagerGecko.readLocaleMetadata(locales_base, [packagerGecko.defaultLocale]) extensionName = locales[packagerGecko.defaultLocale]['name'] # Now commit the change and tag it subprocess.check_call(['hg', 'commit', '-R', baseDir, '-m', 'Releasing %s %s' % (extensionName, version)]) subprocess.check_call(['hg', 'tag', '-R', baseDir, '-f', version]) # Create a release build downloads = [] if type == "gecko": keyFile = keyFiles[0] if keyFiles else None metadata = packager.readMetadata(baseDir, type) buildPath = os.path.join(downloadsRepo, packager.getDefaultFileName(metadata, version, 'xpi')) packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild=True, keyFile=keyFile) downloads.append(buildPath) elif type == "chrome": # We actually have to create three different builds: signed and unsigned # Chrome builds (the latter for Chrome Web Store), and a signed Safari build. metadata = packager.readMetadata(baseDir, type) buildPath = os.path.join(downloadsRepo, packager.getDefaultFileName(metadata, version, 'crx')) packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild=True, keyFile=keyFiles[0]) downloads.append(buildPath) buildPathUnsigned = os.path.join(baseDir, packager.getDefaultFileName(metadata, version, 'zip')) packager.createBuild(baseDir, type=type, outFile=buildPathUnsigned, releaseBuild=True, keyFile=None) import buildtools.packagerSafari as packagerSafari metadataSafari = packagerSafari.readMetadata(baseDir, "safari") buildPathSafari = os.path.join(downloadsRepo, packagerSafari.getDefaultFileName(metadataSafari, version, 'safariextz')) packagerSafari.createBuild(baseDir, type="safari", outFile=buildPathSafari, releaseBuild=True, keyFile=keyFiles[1]) downloads.append(buildPathSafari) # Create source archive archivePath = os.path.splitext(buildPath)[0] + '-source.tgz' create_sourcearchive(baseDir, archivePath) downloads.append(archivePath) # Now add the downloads and commit subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) subprocess.check_call(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing %s %s' % (extensionName, version)]) # Push all changes subprocess.check_call(['hg', 'push', '-R', baseDir]) subprocess.check_call(['hg', 'push', '-R', downloadsRepo])
def run(baseDir, type, version, keyFile, downloadsRepo): if type == "gecko": import buildtools.packagerGecko as packager elif type == "safari": import buildtools.packagerSafari as packager elif type == "edge": import buildtools.packagerEdge as packager elif type == "chrome": import buildtools.packagerChrome as packager # Replace version number in metadata file "manually", ConfigParser will mess # up the order of lines. metadata = readMetadata(baseDir, type) with open(metadata.option_source("general", "version"), "r+b") as file: rawMetadata = file.read() rawMetadata = re.sub(r"^(\s*version\s*=\s*).*", r"\g<1>%s" % version, rawMetadata, flags=re.I | re.M) file.seek(0) file.write(rawMetadata) file.truncate() # Read extension name from locale data import buildtools.packagerGecko as packagerGecko if type == "gecko": locales_base = baseDir else: # This is somewhat of a hack but reading out locale import config here would be too much locales_base = os.path.join(baseDir, "adblockplus") locales = packagerGecko.readLocaleMetadata(locales_base, [packagerGecko.defaultLocale]) extensionName = locales[packagerGecko.defaultLocale]["name"] # Now commit the change and tag it subprocess.check_call(["hg", "commit", "-R", baseDir, "-m", "Releasing %s %s" % (extensionName, version)]) tag_name = version if type in {"safari", "edge"}: tag_name = "{}-{}".format(tag_name, type) subprocess.check_call(["hg", "tag", "-R", baseDir, "-f", tag_name]) # Create a release build downloads = [] if type == "gecko": buildPath = os.path.join(downloadsRepo, getDefaultFileName(metadata, version, "xpi")) packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild=True) downloads.append(buildPath) elif type == "chrome": # Create both signed and unsigned Chrome builds (the latter for Chrome Web Store). buildPath = os.path.join(downloadsRepo, getDefaultFileName(metadata, version, "crx")) packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild=True, keyFile=keyFile) downloads.append(buildPath) buildPathUnsigned = os.path.join(baseDir, getDefaultFileName(metadata, version, "zip")) packager.createBuild(baseDir, type=type, outFile=buildPathUnsigned, releaseBuild=True, keyFile=None) elif type == "safari": buildPath = os.path.join(downloadsRepo, getDefaultFileName(metadata, version, "safariextz")) packager.createBuild(baseDir, type="safari", outFile=buildPath, releaseBuild=True, keyFile=keyFile) downloads.append(buildPath) elif type == "edge": # We only offer the Edge extension for use through the Windows Store buildPath = os.path.join(downloadsRepo, getDefaultFileName(metadata, version, "appx")) packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild=True) downloads.append(buildPath) # Create source archive archivePath = os.path.splitext(buildPath)[0] + "-source.tgz" create_sourcearchive(baseDir, archivePath) downloads.append(archivePath) # Now add the downloads and commit subprocess.check_call(["hg", "add", "-R", downloadsRepo] + downloads) subprocess.check_call(["hg", "commit", "-R", downloadsRepo, "-m", "Releasing %s %s" % (extensionName, version)]) # Push all changes subprocess.check_call(["hg", "push", "-R", baseDir]) subprocess.check_call(["hg", "push", "-R", downloadsRepo])
def run(baseDir, type, version, keyFile, downloadsRepo): if type == "gecko": import buildtools.packagerGecko as packager elif type == "chrome": import buildtools.packagerChrome as packager # Replace version number in metadata file "manually", ConfigParser will mess # up the order of lines. metadata = packager.readMetadata(baseDir, type) with open(metadata.option_source("general", "version"), 'r+b') as file: rawMetadata = file.read() rawMetadata = re.sub( r'^(\s*version\s*=\s*).*', r'\g<1>%s' % version, rawMetadata, flags=re.I | re.M ) file.seek(0) file.write(rawMetadata) file.truncate() # Read extension name from locale data import buildtools.packagerGecko as packagerGecko if type == "gecko": locales_base = baseDir else: # This is somewhat of a hack but reading out locale import config here would be too much locales_base = os.path.join(baseDir, "adblockplus") locales = packagerGecko.readLocaleMetadata(locales_base, [packagerGecko.defaultLocale]) extensionName = locales[packagerGecko.defaultLocale]['name'] # Now commit the change and tag it subprocess.check_call(['hg', 'commit', '-R', baseDir, '-m', 'Releasing %s %s' % (extensionName, version)]) subprocess.check_call(['hg', 'tag', '-R', baseDir, '-f', version]) # Create a release build downloads = [] if type == "gecko": metadata = packager.readMetadata(baseDir, type) buildPath = os.path.join(downloadsRepo, packager.getDefaultFileName(baseDir, metadata, version, 'xpi')) packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild=True, keyFile=keyFile) downloads.append(buildPath) elif type == "chrome": # We actually have to create three different builds for Chrome: signed a unsigned Chrome builds # (the latter for Chrome Web Store) and a signed Opera build. metadata = packager.readMetadata(baseDir, type) buildPath = os.path.join(downloadsRepo, packager.getDefaultFileName(baseDir, metadata, version, 'crx')) packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild=True, keyFile=keyFile) downloads.append(buildPath) buildPathUnsigned = os.path.join(baseDir, packager.getDefaultFileName(baseDir, metadata, version, 'zip')) packager.createBuild(baseDir, type=type, outFile=buildPathUnsigned, releaseBuild=True, keyFile=None) metadataOpera = packager.readMetadata(baseDir, "opera") buildPathOpera = os.path.join(downloadsRepo, packager.getDefaultFileName(baseDir, metadataOpera, version, 'crx')) packager.createBuild(baseDir, type="opera", outFile=buildPathOpera, releaseBuild=True, keyFile=keyFile) downloads.append(buildPathOpera) # Create source archive archivePath = os.path.splitext(buildPath)[0] + '-source.tgz' archiveHandle = open(archivePath, 'wb') archive = tarfile.open(fileobj=archiveHandle, name=os.path.basename(archivePath), mode='w:gz') data = subprocess.check_output(['hg', 'archive', '-R', baseDir, '-t', 'tar', '-S', '-']) repoArchive = tarfile.open(fileobj=StringIO(data), mode='r:') for fileInfo in repoArchive: if os.path.basename(fileInfo.name) in ('.hgtags', '.hgignore'): continue fileData = repoArchive.extractfile(fileInfo) fileInfo.name = re.sub(r'^[^/]+/', '', fileInfo.name) archive.addfile(fileInfo, fileData) repoArchive.close() archive.close() archiveHandle.close() downloads.append(archivePath) # Now add the downloads and commit subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) subprocess.check_call(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing %s %s' % (extensionName, version)]) # Push all changes subprocess.check_call(['hg', 'push', '-R', baseDir]) subprocess.check_call(['hg', 'push', '-R', downloadsRepo])