| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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 with open(packager.readMetadata(baseDir, type).option_source("general", "versi on"), 'r+b') as file: | 29 metadata = packager.readMetadata(baseDir, type) |
|
Wladimir Palant
2014/01/15 15:41:21
Style nit: Please keep the line length below 80 ch
| |
| 30 with open(metadata.option_source("general", "version"), 'r+b') as file: | |
| 30 rawMetadata = file.read() | 31 rawMetadata = file.read() |
| 31 rawMetadata = re.sub(r'^(\s*version\s*=\s*).*', r'\g<1>%s' % version, rawMet adata, flags=re.I | re.M) | 32 rawMetadata = re.sub( |
|
Wladimir Palant
2014/01/15 15:41:21
Style nit: Please split function parameters to two
| |
| 33 r'^(\s*version\s*=\s*).*', r'\g<1>%s' % version, | |
| 34 rawMetadata, flags=re.I | re.M | |
| 35 ) | |
| 32 | 36 |
| 33 file.seek(0) | 37 file.seek(0) |
| 34 file.write(rawMetadata) | 38 file.write(rawMetadata) |
| 35 file.truncate() | 39 file.truncate() |
| 36 | 40 |
| 37 # Read extension name from locale data | 41 # Read extension name from locale data |
| 38 import buildtools.packagerGecko as packagerGecko | 42 import buildtools.packagerGecko as packagerGecko |
| 39 if type == "gecko": | 43 if type == "gecko": |
| 40 locales_base = baseDir | 44 locales_base = baseDir |
| 41 else: | 45 else: |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 archiveHandle.close() | 94 archiveHandle.close() |
| 91 downloads.append(archivePath) | 95 downloads.append(archivePath) |
| 92 | 96 |
| 93 # Now add the downloads and commit | 97 # Now add the downloads and commit |
| 94 subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) | 98 subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) |
| 95 subprocess.check_call(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing % s %s' % (extensionName, version)]) | 99 subprocess.check_call(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing % s %s' % (extensionName, version)]) |
| 96 | 100 |
| 97 # Push all changes | 101 # Push all changes |
| 98 subprocess.check_call(['hg', 'push', '-R', baseDir]) | 102 subprocess.check_call(['hg', 'push', '-R', baseDir]) |
| 99 subprocess.check_call(['hg', 'push', '-R', downloadsRepo]) | 103 subprocess.check_call(['hg', 'push', '-R', downloadsRepo]) |
| LEFT | RIGHT |