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 import os | 5 import os |
6 import re | 6 import re |
7 import codecs | 7 import codecs |
8 import subprocess | 8 import subprocess |
9 import tarfile | 9 import tarfile |
10 import json | 10 import json |
11 | 11 |
12 from packager import readMetadata, getDefaultFileName | |
12 | 13 |
13 def get_dependencies(prefix, repos): | 14 def get_dependencies(prefix, repos): |
14 from ensure_dependencies import read_deps, safe_join | 15 from ensure_dependencies import read_deps, safe_join |
15 repo = repos[prefix] | 16 repo = repos[prefix] |
16 deps = read_deps(repo) | 17 deps = read_deps(repo) |
17 if deps: | 18 if deps: |
18 for subpath in deps: | 19 for subpath in deps: |
19 if subpath.startswith('_'): | 20 if subpath.startswith('_'): |
20 continue | 21 continue |
21 depprefix = prefix + subpath + '/' | 22 depprefix = prefix + subpath + '/' |
(...skipping 15 matching lines...) Expand all Loading... | |
37 continue | 38 continue |
38 filedata = repoarchive.extractfile(fileinfo) | 39 filedata = repoarchive.extractfile(fileinfo) |
39 fileinfo.name = re.sub(r'^[^/]+/', prefix, fileinfo.name ) | 40 fileinfo.name = re.sub(r'^[^/]+/', prefix, fileinfo.name ) |
40 archive.addfile(fileinfo, filedata) | 41 archive.addfile(fileinfo, filedata) |
41 finally: | 42 finally: |
42 process.stdout.close() | 43 process.stdout.close() |
43 process.wait() | 44 process.wait() |
44 | 45 |
45 | 46 |
46 def run(baseDir, type, version, keyFile, downloadsRepo): | 47 def run(baseDir, type, version, keyFile, downloadsRepo): |
47 from packager import readMetadata, getDefaultFileName | |
Sebastian Noack
2016/10/27 15:41:59
I think imports should go at the top of the module
kzar
2016/10/27 15:54:25
Done.
| |
48 if type == 'gecko': | 48 if type == 'gecko': |
49 import buildtools.packagerGecko as packager | 49 import buildtools.packagerGecko as packager |
50 elif type == 'safari': | 50 elif type == 'safari': |
51 import buildtools.packagerSafari as packager | 51 import buildtools.packagerSafari as packager |
52 elif type == 'edge': | 52 elif type == 'edge': |
53 import buildtools.packagerEdge as packager | 53 import buildtools.packagerEdge as packager |
54 elif type == 'chrome': | 54 elif type == 'chrome': |
55 import buildtools.packagerChrome as packager | 55 import buildtools.packagerChrome as packager |
56 | 56 |
57 # Replace version number in metadata file "manually", ConfigParser will mess | 57 # Replace version number in metadata file "manually", ConfigParser will mess |
(...skipping 18 matching lines...) Expand all Loading... | |
76 # This is somewhat of a hack but reading out locale import config here w ould be too much | 76 # This is somewhat of a hack but reading out locale import config here w ould be too much |
77 locales_base = os.path.join(baseDir, 'adblockplus') | 77 locales_base = os.path.join(baseDir, 'adblockplus') |
78 | 78 |
79 locales = packagerGecko.readLocaleMetadata(locales_base, [packagerGecko.defa ultLocale]) | 79 locales = packagerGecko.readLocaleMetadata(locales_base, [packagerGecko.defa ultLocale]) |
80 extensionName = locales[packagerGecko.defaultLocale]['name'] | 80 extensionName = locales[packagerGecko.defaultLocale]['name'] |
81 | 81 |
82 # Now commit the change and tag it | 82 # Now commit the change and tag it |
83 subprocess.check_call(['hg', 'commit', '-R', baseDir, '-m', 'Releasing %s %s ' % (extensionName, version)]) | 83 subprocess.check_call(['hg', 'commit', '-R', baseDir, '-m', 'Releasing %s %s ' % (extensionName, version)]) |
84 tag_name = version | 84 tag_name = version |
85 if type in {'safari', 'edge'}: | 85 if type in {'safari', 'edge'}: |
86 tag_name += '-' + type | 86 tag_name = '{}-{}'.format(tag_name, type) |
87 subprocess.check_call(['hg', 'tag', '-R', baseDir, '-f', tag_name]) | 87 subprocess.check_call(['hg', 'tag', '-R', baseDir, '-f', tag_name]) |
88 | 88 |
89 # Create a release build | 89 # Create a release build |
90 downloads = [] | 90 downloads = [] |
91 if type == 'gecko': | 91 if type == 'gecko': |
92 buildPath = os.path.join(downloadsRepo, getDefaultFileName(metadata, ver sion, 'xpi')) | 92 buildPath = os.path.join(downloadsRepo, getDefaultFileName(metadata, ver sion, 'xpi')) |
93 packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild =True) | 93 packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild =True) |
94 downloads.append(buildPath) | 94 downloads.append(buildPath) |
95 elif type == 'chrome': | 95 elif type == 'chrome': |
96 # Create both signed and unsigned Chrome builds (the latter for Chrome W eb Store). | 96 # Create both signed and unsigned Chrome builds (the latter for Chrome W eb Store). |
(...skipping 18 matching lines...) Expand all Loading... | |
115 create_sourcearchive(baseDir, archivePath) | 115 create_sourcearchive(baseDir, archivePath) |
116 downloads.append(archivePath) | 116 downloads.append(archivePath) |
117 | 117 |
118 # Now add the downloads and commit | 118 # Now add the downloads and commit |
119 subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) | 119 subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) |
120 subprocess.check_call(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing %s %s' % (extensionName, version)]) | 120 subprocess.check_call(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing %s %s' % (extensionName, version)]) |
121 | 121 |
122 # Push all changes | 122 # Push all changes |
123 subprocess.check_call(['hg', 'push', '-R', baseDir]) | 123 subprocess.check_call(['hg', 'push', '-R', baseDir]) |
124 subprocess.check_call(['hg', 'push', '-R', downloadsRepo]) | 124 subprocess.check_call(['hg', 'push', '-R', downloadsRepo]) |
LEFT | RIGHT |