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 | 15 |
16 | 16 |
17 def get_dependencies(prefix, repos): | 17 def get_dependencies(prefix, repos): |
18 from ensure_dependencies import read_deps, safe_join | 18 from ensure_dependencies import read_deps, safe_join |
19 repo = repos[prefix] | 19 repo = repos[prefix] |
20 deps = read_deps(repo) | 20 deps = read_deps(repo) |
21 if deps: | 21 if deps: |
22 for subpath in deps: | 22 for subpath in deps: |
23 if subpath.startswith('_'): | 23 if subpath.startswith('_'): |
24 continue | 24 continue |
25 depprefix = prefix + subpath + '/' | 25 depprefix = prefix + subpath + '/' |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 rawMetadata = re.sub( | 131 rawMetadata = re.sub( |
132 r'^(\s*version\s*=\s*).*', r'\g<1>%s' % version, | 132 r'^(\s*version\s*=\s*).*', r'\g<1>%s' % version, |
133 rawMetadata, flags=re.I | re.M | 133 rawMetadata, flags=re.I | re.M |
134 ) | 134 ) |
135 | 135 |
136 file.seek(0) | 136 file.seek(0) |
137 file.write(rawMetadata) | 137 file.write(rawMetadata) |
138 file.truncate() | 138 file.truncate() |
139 | 139 |
140 # Read extension name from locale data | 140 # Read extension name from locale data |
141 locales_base = os.path.join(baseDir, 'adblockplus') | 141 default_locale_path = os.path.join('_locales', packager.defaultLocale, |
142 | 142 'messages.json') |
143 with open(os.path.join(locales_base, 'chrome', 'locale', | 143 with open(default_locale_path, 'r') as fp: |
144 packager.defaultLocale.replace('_', '-'), | |
145 'meta.json'), | |
146 'r') as fp: | |
147 extensionName = json.load(fp)['name'] | 144 extensionName = json.load(fp)['name'] |
148 | 145 |
149 # Now commit the change and tag it | 146 # Now commit the change and tag it |
150 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)]) |
151 tag_name = version | 148 tag_name = version |
152 if type == 'edge': | 149 if type == 'edge': |
153 tag_name = '{}-{}'.format(tag_name, type) | 150 tag_name = '{}-{}'.format(tag_name, type) |
154 subprocess.check_call(['hg', 'tag', '-R', baseDir, '-f', tag_name]) | 151 subprocess.check_call(['hg', 'tag', '-R', baseDir, '-f', tag_name]) |
155 | 152 |
156 # Create a release build | 153 # Create a release build |
(...skipping 17 matching lines...) Expand all Loading... |
174 create_sourcearchive(baseDir, archivePath) | 171 create_sourcearchive(baseDir, archivePath) |
175 downloads.append(archivePath) | 172 downloads.append(archivePath) |
176 | 173 |
177 # Now add the downloads and commit | 174 # Now add the downloads and commit |
178 subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) | 175 subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) |
179 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)]) |
180 | 177 |
181 # Push all changes | 178 # Push all changes |
182 subprocess.check_call(['hg', 'push', '-R', baseDir]) | 179 subprocess.check_call(['hg', 'push', '-R', baseDir]) |
183 subprocess.check_call(['hg', 'push', '-R', downloadsRepo]) | 180 subprocess.check_call(['hg', 'push', '-R', downloadsRepo]) |
LEFT | RIGHT |