Left: | ||
Right: |
OLD | NEW |
---|---|
1 # coding: utf-8 | 1 # coding: utf-8 |
2 | 2 |
3 # This file is part of the Adblock Plus build tools, | 3 # This file is part of the Adblock Plus build tools, |
4 # Copyright (C) 2006-2013 Eyeo GmbH | 4 # Copyright (C) 2006-2013 Eyeo GmbH |
5 # | 5 # |
6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
9 # | 9 # |
10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 # GNU General Public License for more details. | 13 # GNU General Public License for more details. |
14 # | 14 # |
15 # You should have received a copy of the GNU General Public License | 15 # You should have received a copy of the GNU General Public License |
16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 |
18 import os, re, codecs, subprocess, tarfile, json | 18 import os, re, codecs, subprocess, tarfile, json |
19 from StringIO import StringIO | 19 from StringIO import StringIO |
20 | 20 |
21 def run(baseDir, type, version, keyFile, downloadsRepo): | 21 def run(baseDir, type, version, keyFile, downloadsRepo): |
22 if type == "gecko": | 22 if type == "gecko": |
23 import buildtools.packagerGecko as packager | 23 import buildtools.packagerGecko as packager |
24 elif type == "chrome": | 24 elif type == "chrome": |
25 import buildtools.packagerChrome as packager | 25 import buildtools.packagerChrome as packager |
26 | 26 |
27 # Replace version number in metadata file "manually", ConfigParser will mess | 27 # Replace version number in metadata file "manually", ConfigParser will mess |
28 # up the order of lines. | 28 # up the order of lines. |
29 handle = open(packager.getMetadataPath(baseDir, type), 'rb') | 29 with open(packager.readMetadata(baseDir, type).option_source("general", "versi on"), 'r+b') as file: |
Wladimir Palant
2014/01/15 15:41:21
Style nit: Please keep the line length below 80 ch
| |
30 rawMetadata = handle.read() | 30 rawMetadata = file.read() |
31 handle.close() | 31 rawMetadata = re.sub(r'^(\s*version\s*=\s*).*', r'\g<1>%s' % version, rawMet adata, flags=re.I | re.M) |
Wladimir Palant
2014/01/15 15:41:21
Style nit: Please split function parameters to two
| |
32 versionRegExp = re.compile(r'^(\s*version\s*=\s*).*', re.I | re.M) | 32 |
33 rawMetadata = re.sub(versionRegExp, r'\g<1>%s' % version, rawMetadata) | 33 file.seek(0) |
34 handle = open(packager.getMetadataPath(baseDir, type), 'wb') | 34 file.write(rawMetadata) |
35 handle.write(rawMetadata) | 35 file.truncate() |
36 handle.close() | |
37 | 36 |
38 # Read extension name from locale data | 37 # Read extension name from locale data |
39 import buildtools.packagerGecko as packagerGecko | 38 import buildtools.packagerGecko as packagerGecko |
40 if type == "gecko": | 39 if type == "gecko": |
41 locales_base = baseDir | 40 locales_base = baseDir |
42 else: | 41 else: |
43 # This is somewhat of a hack but reading out locale import config here would be too much | 42 # This is somewhat of a hack but reading out locale import config here would be too much |
44 locales_base = os.path.join(baseDir, "adblockplus") | 43 locales_base = os.path.join(baseDir, "adblockplus") |
45 | 44 |
46 locales = packagerGecko.readLocaleMetadata(locales_base, [packagerGecko.defaul tLocale]) | 45 locales = packagerGecko.readLocaleMetadata(locales_base, [packagerGecko.defaul tLocale]) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 archiveHandle.close() | 90 archiveHandle.close() |
92 downloads.append(archivePath) | 91 downloads.append(archivePath) |
93 | 92 |
94 # Now add the downloads and commit | 93 # Now add the downloads and commit |
95 subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) | 94 subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) |
96 subprocess.check_call(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing % s %s' % (extensionName, version)]) | 95 subprocess.check_call(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing % s %s' % (extensionName, version)]) |
97 | 96 |
98 # Push all changes | 97 # Push all changes |
99 subprocess.check_call(['hg', 'push', '-R', baseDir]) | 98 subprocess.check_call(['hg', 'push', '-R', baseDir]) |
100 subprocess.check_call(['hg', 'push', '-R', downloadsRepo]) | 99 subprocess.check_call(['hg', 'push', '-R', downloadsRepo]) |
OLD | NEW |