Left: | ||
Right: |
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 | |
Sebastian Noack
2017/10/03 02:22:39
Why did you add this import?
tlucas
2017/10/04 11:48:38
This was not intentional, removed it.
| |
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 rawMetadata = re.sub( | 133 rawMetadata = re.sub( |
135 r'^(\s*version\s*=\s*).*', r'\g<1>%s' % version, | 134 r'^(\s*version\s*=\s*).*', r'\g<1>%s' % version, |
136 rawMetadata, flags=re.I | re.M | 135 rawMetadata, flags=re.I | re.M |
137 ) | 136 ) |
138 | 137 |
139 file.seek(0) | 138 file.seek(0) |
140 file.write(rawMetadata) | 139 file.write(rawMetadata) |
141 file.truncate() | 140 file.truncate() |
142 | 141 |
143 # Read extension name from locale data | 142 # Read extension name from locale data |
144 locales_base = os.path.join(baseDir, 'adblockplus') | 143 default_locale_path = os.path.join('_locales', packager.defaultLocale, |
145 | 144 'messages.json') |
146 with open(os.path.join(locales_base, 'chrome', 'locale', | 145 with open(default_locale_path, 'r') as fp: |
147 packager.defaultLocale.replace('_', '-'), | |
148 'meta.json'), | |
149 'r') as fp: | |
150 extensionName = json.load(fp)['name'] | 146 extensionName = json.load(fp)['name'] |
151 | 147 |
152 # Now commit the change and tag it | 148 # Now commit the change and tag it |
153 subprocess.check_call(['hg', 'commit', '-R', baseDir, '-m', 'Releasing %s %s ' % (extensionName, version)]) | 149 subprocess.check_call(['hg', 'commit', '-R', baseDir, '-m', 'Releasing %s %s ' % (extensionName, version)]) |
154 tag_name = version | 150 tag_name = version |
155 if type in {'safari', 'edge'}: | 151 if type in {'safari', 'edge'}: |
156 tag_name = '{}-{}'.format(tag_name, type) | 152 tag_name = '{}-{}'.format(tag_name, type) |
157 subprocess.check_call(['hg', 'tag', '-R', baseDir, '-f', tag_name]) | 153 subprocess.check_call(['hg', 'tag', '-R', baseDir, '-f', tag_name]) |
158 | 154 |
159 # Create a release build | 155 # Create a release build |
(...skipping 21 matching lines...) Expand all Loading... | |
181 create_sourcearchive(baseDir, archivePath) | 177 create_sourcearchive(baseDir, archivePath) |
182 downloads.append(archivePath) | 178 downloads.append(archivePath) |
183 | 179 |
184 # Now add the downloads and commit | 180 # Now add the downloads and commit |
185 subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) | 181 subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) |
186 subprocess.check_call(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing %s %s' % (extensionName, version)]) | 182 subprocess.check_call(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing %s %s' % (extensionName, version)]) |
187 | 183 |
188 # Push all changes | 184 # Push all changes |
189 subprocess.check_call(['hg', 'push', '-R', baseDir]) | 185 subprocess.check_call(['hg', 'push', '-R', baseDir]) |
190 subprocess.check_call(['hg', 'push', '-R', downloadsRepo]) | 186 subprocess.check_call(['hg', 'push', '-R', downloadsRepo]) |
LEFT | RIGHT |