[Pkg-mozext-commits] [adblock-plus] 337/464: Added build.py devenv command for Chrome extensions

David Prévot taffit at moszumanska.debian.org
Tue Jul 22 20:44:31 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository adblock-plus.

commit e6ee651cf8b5378d298c7fefcabdbea8725a883d
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Mon Dec 17 08:09:22 2012 +0100

    Added build.py devenv command for Chrome extensions
---
 build.py          | 11 +++++++++++
 packagerChrome.py | 17 +++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/build.py b/build.py
index ab0a468..6a72547 100644
--- a/build.py
+++ b/build.py
@@ -198,6 +198,7 @@ def runBuild(baseDir, scriptName, opts, args, type):
                          releaseBuild=releaseBuild, keyFile=keyFile,
                          experimentalAPI=experimentalAPI)
 
+
 def runAutoInstall(baseDir, scriptName, opts, args, type):
   if len(args) == 0:
     print 'Port of the Extension Auto-Installer needs to be specified'
@@ -218,6 +219,11 @@ def runAutoInstall(baseDir, scriptName, opts, args, type):
   packager.autoInstall(baseDir, host, port, multicompartment=multicompartment)
 
 
+def createDevEnv(baseDir, scriptName, opts, args, type):
+  import buildtools.packagerChrome as packager
+  packager.createDevEnv(baseDir)
+
+
 def setupTranslations(baseDir, scriptName, opts, args, type):
   if len(args) < 1:
     print 'Project key is required to update translation master files.'
@@ -432,6 +438,11 @@ with addCommand(runAutoInstall, 'autoinstall') as command:
   command.addOption('Create a build for leak testing', short='m', long='multi-compartment')
   command.supportedTypes = ('gecko')
 
+with addCommand(createDevEnv, 'devenv') as command:
+  command.shortDescription = 'Set up a development environment'
+  command.description = 'Will set up or update the devenv folder as an unpacked extension folder for development.'
+  command.supportedTypes = ('chrome')
+
 with addCommand(setupTranslations, 'setuptrans') as command:
   command.shortDescription = 'Sets up translation languages'
   command.description = 'Sets up translation languages for the project on crowdin.net.'
diff --git a/packagerChrome.py b/packagerChrome.py
index 29e9f08..0f90ed3 100644
--- a/packagerChrome.py
+++ b/packagerChrome.py
@@ -99,7 +99,7 @@ def addToZip(zip, filters, dir, baseName):
     filelc = file.lower()
     if (file.startswith('.') or
         file == 'buildtools' or file == 'qunit' or file == 'metadata' or
-        file == 'store.description' or
+        file == 'store.description' or file=='devenv' or
         filelc.endswith('.py') or filelc.endswith('.pyc') or
         filelc.endswith('.crx') or filelc.endswith('.zip') or
         filelc.endswith('.sh') or filelc.endswith('.bat') or
@@ -143,15 +143,17 @@ def getPublicKey(keyFile):
   return M2Crypto.EVP.load_key(keyFile).as_der()
 
 def writePackage(outputFile, pubkey, signature, zipdata):
-  file = open(outputFile, 'wb')
+  if isinstance(outputFile, basestring):
+    file = open(outputFile, 'wb')
+  else:
+    file = outputFile
   if pubkey != None and signature != None:
     file.write(struct.pack('<4sIII', 'Cr24', 2, len(pubkey), len(signature)))
     file.write(pubkey)
     file.write(signature)
   file.write(zipdata)
-  file.close()
 
-def createBuild(baseDir, outFile=None, buildNum=None, releaseBuild=False, keyFile=None, experimentalAPI=False):
+def createBuild(baseDir, outFile=None, buildNum=None, releaseBuild=False, keyFile=None, experimentalAPI=False, devenv=False):
   metadata = readMetadata(baseDir)
   version = readVersion(baseDir)
   if outFile == None:
@@ -177,3 +179,10 @@ def createBuild(baseDir, outFile=None, buildNum=None, releaseBuild=False, keyFil
     signature = signBinary(zipdata, keyFile)
     pubkey = getPublicKey(keyFile)
   writePackage(outFile, pubkey, signature, zipdata)
+
+def createDevEnv(baseDir):
+  fileBuffer = StringIO()
+  createBuild(baseDir, outFile=fileBuffer, devenv=True)
+  zip = ZipFile(StringIO(fileBuffer.getvalue()), 'r')
+  zip.extractall(os.path.join(baseDir, 'devenv'))
+  zip.close()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git



More information about the Pkg-mozext-commits mailing list