LEFT | RIGHT |
1 # This Source Code Form is subject to the terms of the Mozilla Public | 1 # This Source Code Form is subject to the terms of the Mozilla Public |
2 # License, v. 2.0. If a copy of the MPL was not distributed with this | 2 # License, v. 2.0. If a copy of the MPL was not distributed with this |
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
4 | 4 |
5 from __future__ import print_function | 5 from __future__ import print_function |
6 | 6 |
7 import os | 7 import os |
8 import re | 8 import re |
9 import codecs | 9 import codecs |
10 import subprocess | 10 import subprocess |
11 import tarfile | 11 import tarfile |
12 import json | 12 import json |
13 | 13 |
14 from packager import readMetadata, getDefaultFileName | 14 from packager import readMetadata, getDefaultFileName |
15 from localeTools import readFile | |
16 | 15 |
17 | 16 |
18 def get_dependencies(prefix, repos): | 17 def get_dependencies(prefix, repos): |
19 from ensure_dependencies import read_deps, safe_join | 18 from ensure_dependencies import read_deps, safe_join |
20 repo = repos[prefix] | 19 repo = repos[prefix] |
21 deps = read_deps(repo) | 20 deps = read_deps(repo) |
22 if deps: | 21 if deps: |
23 for subpath in deps: | 22 for subpath in deps: |
24 if subpath.startswith('_'): | 23 if subpath.startswith('_'): |
25 continue | 24 continue |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 rawMetadata = re.sub( | 131 rawMetadata = re.sub( |
133 r'^(\s*version\s*=\s*).*', r'\g<1>%s' % version, | 132 r'^(\s*version\s*=\s*).*', r'\g<1>%s' % version, |
134 rawMetadata, flags=re.I | re.M | 133 rawMetadata, flags=re.I | re.M |
135 ) | 134 ) |
136 | 135 |
137 file.seek(0) | 136 file.seek(0) |
138 file.write(rawMetadata) | 137 file.write(rawMetadata) |
139 file.truncate() | 138 file.truncate() |
140 | 139 |
141 # Read extension name from locale data | 140 # Read extension name from locale data |
142 locales_base = os.path.join(baseDir, 'adblockplus') | 141 default_locale_path = os.path.join('_locales', packager.defaultLocale, |
143 | 142 'messages.json') |
144 with open(os.path.join(locales_base, 'chrome', 'locale', | 143 with open(default_locale_path, 'r') as fp: |
145 packager.defaultLocale.replace('_', '-'), | |
146 'meta.json'), | |
147 'r') as fp: | |
148 extensionName = json.load(fp)['name'] | 144 extensionName = json.load(fp)['name'] |
149 | 145 |
150 # Now commit the change and tag it | 146 # Now commit the change and tag it |
151 subprocess.check_call(['hg', 'commit', '-R', baseDir, '-m', 'Releasing %s %s
' % (extensionName, version)]) | 147 subprocess.check_call(['hg', 'commit', '-R', baseDir, '-m', 'Releasing %s %s
' % (extensionName, version)]) |
152 tag_name = version | 148 tag_name = version |
153 if type == 'edge': | 149 if type == 'edge': |
154 tag_name = '{}-{}'.format(tag_name, type) | 150 tag_name = '{}-{}'.format(tag_name, type) |
155 subprocess.check_call(['hg', 'tag', '-R', baseDir, '-f', tag_name]) | 151 subprocess.check_call(['hg', 'tag', '-R', baseDir, '-f', tag_name]) |
156 | 152 |
157 # Create a release build | 153 # Create a release build |
(...skipping 17 matching lines...) Expand all Loading... |
175 create_sourcearchive(baseDir, archivePath) | 171 create_sourcearchive(baseDir, archivePath) |
176 downloads.append(archivePath) | 172 downloads.append(archivePath) |
177 | 173 |
178 # Now add the downloads and commit | 174 # Now add the downloads and commit |
179 subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) | 175 subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) |
180 subprocess.check_call(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing
%s %s' % (extensionName, version)]) | 176 subprocess.check_call(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing
%s %s' % (extensionName, version)]) |
181 | 177 |
182 # Push all changes | 178 # Push all changes |
183 subprocess.check_call(['hg', 'push', '-R', baseDir]) | 179 subprocess.check_call(['hg', 'push', '-R', baseDir]) |
184 subprocess.check_call(['hg', 'push', '-R', downloadsRepo]) | 180 subprocess.check_call(['hg', 'push', '-R', downloadsRepo]) |
LEFT | RIGHT |