[Pkg-mozext-commits] [adblock-plus] 198/464: Added "build.py autoinstall" command to push the install package to the Auto-Install extension

David Prévot taffit at moszumanska.debian.org
Tue Jul 22 20:44:17 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 fc052897f769451d36e574d9ee8d051dd710c8d1
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Fri Jan 13 12:54:09 2012 +0100

    Added "build.py autoinstall" command to push the install package to the Auto-Install extension
---
 build.py    | 21 +++++++++++++++++++++
 packager.py |  7 ++++++-
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/build.py b/build.py
index 8a26ff9..c57fa41 100644
--- a/build.py
+++ b/build.py
@@ -184,6 +184,21 @@ def setupTestEnvironment(baseDir, scriptName, opts, args, type):
   packager.setupTestEnvironment(baseDir, profileDirs)
 
 
+def runAutoInstall(baseDir, scriptName, opts, args, type):
+  if len(args) == 0:
+    print 'Port of the Extension Auto-Installer needs to be specified'
+    usage(scriptName, type, 'autoinstall')
+    return
+
+  if ':' in args[0]:
+    host, port = args[0].split(':', 1)
+  else:
+    host, port = ('localhost', args[0])
+
+  import buildtools.packager as packager
+  packager.autoInstall(baseDir, host, port)
+
+
 def showDescriptions(baseDir, scriptName, opts, args, type):
   locales = None
   for option, value in opts:
@@ -298,6 +313,12 @@ with addCommand(setupTestEnvironment, 'testenv') as command:
   command.params = '[options] [profile_dir] ...'
   command.supportedTypes = ('gecko')
 
+with addCommand(runAutoInstall, 'autoinstall') as command:
+  command.shortDescription = 'Install extension automatically'
+  command.description = 'Will automatically install the extension in a browser running Extension Auto-Installer. If host parameter is omitted assumes that the browser runs on localhost.'
+  command.params = '[<host>:]<port>'
+  command.supportedTypes = ('gecko')
+
 with addCommand(showDescriptions, 'showdesc') as command:
   command.shortDescription = 'Print description strings for all locales'
   command.description = 'Display description strings for all locales as specified in the corresponding meta.properties files.'
diff --git a/packager.py b/packager.py
index 8a9a23d..ce14e0c 100644
--- a/packager.py
+++ b/packager.py
@@ -4,7 +4,7 @@
 # version 2.0 (the "License"). You can obtain a copy of the License at
 # http://mozilla.org/MPL/2.0/.
 
-import os, sys, re, subprocess, jinja2, buildtools, codecs, hashlib, base64, shutil
+import os, sys, re, subprocess, jinja2, buildtools, codecs, hashlib, base64, shutil, urllib
 from ConfigParser import SafeConfigParser
 from StringIO import StringIO
 from zipfile import ZipFile, ZIP_STORED, ZIP_DEFLATED
@@ -318,6 +318,11 @@ def createBuild(baseDir, outFile=None, locales=None, buildNum=None, releaseBuild
     signFiles(files, keyFile)
   writeXPI(files, outFile)
 
+def autoInstall(baseDir, host, port):
+  fileBuffer = StringIO()
+  createBuild(baseDir, outFile=fileBuffer)
+  urllib.urlopen('http://%s:%s/' % (host, port), data=fileBuffer.getvalue())
+
 def setupTestEnvironment(baseDir, profileDirs):
   metadata = readMetadata(baseDir)
   params = {

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