[Pkg-mozext-commits] [adblock-plus] 395/464: Automatically generate info pseudo-module for Chromium-based applications
David Prévot
taffit at moszumanska.debian.org
Tue Jul 22 20:44:37 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 9fde1e5fa859aa9b3a06d10dae2521714bac0778
Author: Wladimir Palant <trev at adblockplus.org>
Date: Mon Jul 22 15:25:27 2013 +0200
Automatically generate info pseudo-module for Chromium-based applications
---
chromeDevenvPoller__.js.tmpl | 17 +++++++++++++++++
chromeInfo.js.tmpl | 44 ++++++++++++++++++++++++++++++++++++++++++++
packagerChrome.py | 9 +++++++++
3 files changed, 70 insertions(+)
diff --git a/chromeDevenvPoller__.js.tmpl b/chromeDevenvPoller__.js.tmpl
index 2712ae9..902a7af 100644
--- a/chromeDevenvPoller__.js.tmpl
+++ b/chromeDevenvPoller__.js.tmpl
@@ -1,3 +1,20 @@
+/*
+ * This file is part of the Adblock Plus build tools,
+ * Copyright (C) 2006-2013 Eyeo GmbH
+ *
+ * Adblock Plus is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Adblock Plus is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
+ */
+
(function()
{
var basename = {{metadata.get("general", "basename")|json}};
diff --git a/chromeInfo.js.tmpl b/chromeInfo.js.tmpl
new file mode 100644
index 0000000..6a37c62
--- /dev/null
+++ b/chromeInfo.js.tmpl
@@ -0,0 +1,44 @@
+/*
+ * This file is part of the Adblock Plus build tools,
+ * Copyright (C) 2006-2013 Eyeo GmbH
+ *
+ * Adblock Plus is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Adblock Plus is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+require.scopes.info = {
+ get addonID()
+ {
+ return chrome.i18n.getMessage("@@extension_id");
+ },
+ addonName: {{metadata.get('general', 'basename')|json}},
+ addonVersion: {{metadata.get('general', 'version')|json}},
+ addonRoot: "",
+
+ application: {{type|json}},
+ get applicationVersion()
+ {
+ {%- if type == 'opera' %}
+ var match = /\bOPR\/(\S+)/.exec(navigator.userAgent);
+ return (match ? match[1] : "0");
+ {%- else %}
+ return this.platformVersion;
+ {%- endif %}
+ },
+
+ platform: "chromium",
+ get platformVersion()
+ {
+ var match = /\bChrome\/(\S+)/.exec(navigator.userAgent);
+ return (match ? match[1] : "0");
+ }
+};
diff --git a/packagerChrome.py b/packagerChrome.py
index b901b95..6ace1db 100644
--- a/packagerChrome.py
+++ b/packagerChrome.py
@@ -128,6 +128,10 @@ def createPoller(params):
template = getTemplate('chromeDevenvPoller__.js.tmpl')
return template.render(params).encode('utf-8');
+def createInfoModule(params):
+ template = getTemplate('chromeInfo.js.tmpl')
+ return template.render(params).encode('utf-8');
+
def convertJS(params, files):
from jshydra.abp_rewrite import doRewrite
@@ -337,6 +341,11 @@ def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil
if devenv:
files['devenvPoller__.js'] = createPoller(params)
+ if (metadata.has_option('general', 'backgroundScripts') and
+ 'lib/info.js' in re.split(r'\s+', metadata.get('general', 'backgroundScripts')) and
+ 'lib/info.js' not in files):
+ files['lib/info.js'] = createInfoModule(params)
+
zipdata = files.zipToString()
signature = None
pubkey = None
--
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