mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-13 02:14:17 +01:00
centralize the managing version string for all platform
This commit is contained in:
parent
d42adc912d
commit
d674e992e5
4 changed files with 31 additions and 24 deletions
1
dist/version
vendored
Normal file
1
dist/version
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
1.15.11.1
|
|
@ -9,24 +9,27 @@ if len(sys.argv) == 1 or not sys.argv[1]:
|
||||||
raise SystemExit('Build dir missing.')
|
raise SystemExit('Build dir missing.')
|
||||||
|
|
||||||
proj_dir = os.path.join(os.path.split(os.path.abspath(__file__))[0], '..')
|
proj_dir = os.path.join(os.path.split(os.path.abspath(__file__))[0], '..')
|
||||||
|
build_dir = os.path.abspath(sys.argv[1])
|
||||||
|
|
||||||
manifest_in = {}
|
version = ''
|
||||||
manifest_in_file = os.path.join(proj_dir, 'platform', 'chromium', 'manifest.json')
|
with open(os.path.join(proj_dir, 'dist', 'version')) as f:
|
||||||
with open(manifest_in_file) as f1:
|
version = f.read().strip()
|
||||||
manifest_in = json.load(f1)
|
|
||||||
|
manifest_out = {}
|
||||||
|
manifest_out_file = os.path.join(build_dir, 'manifest.json')
|
||||||
|
with open(manifest_out_file) as f:
|
||||||
|
manifest_out = json.load(f)
|
||||||
|
|
||||||
|
manifest_out['version'] = version
|
||||||
|
|
||||||
# Development build? If so, modify name accordingly.
|
# Development build? If so, modify name accordingly.
|
||||||
match = re.search('^\d+\.\d+\.\d+\.\d+$', manifest_in['version'])
|
match = re.search('^\d+\.\d+\.\d+\.\d+$', version)
|
||||||
if match:
|
if match:
|
||||||
build_dir = os.path.abspath(sys.argv[1])
|
|
||||||
dev_build = ' dev build'
|
dev_build = ' dev build'
|
||||||
manifest_out = {}
|
|
||||||
manifest_out_file = os.path.join(build_dir, 'manifest.json')
|
|
||||||
with open(manifest_out_file) as f2:
|
|
||||||
manifest_out = json.load(f2)
|
|
||||||
manifest_out['name'] += dev_build
|
manifest_out['name'] += dev_build
|
||||||
manifest_out['short_name'] += dev_build
|
manifest_out['short_name'] += dev_build
|
||||||
manifest_out['browser_action']['default_title'] += dev_build
|
manifest_out['browser_action']['default_title'] += dev_build
|
||||||
with open(manifest_out_file, 'w') as f2:
|
|
||||||
json.dump(manifest_out, f2, indent=2, separators=(',', ': '), sort_keys=True)
|
with open(manifest_out_file, 'w') as f:
|
||||||
f2.write('\n')
|
json.dump(manifest_out, f, indent=2, separators=(',', ': '), sort_keys=True)
|
||||||
|
f.write('\n')
|
||||||
|
|
|
@ -61,15 +61,19 @@ rmtree(source_locale_dir)
|
||||||
|
|
||||||
# update install.rdf
|
# update install.rdf
|
||||||
proj_dir = pj(os.path.split(os.path.abspath(__file__))[0], '..')
|
proj_dir = pj(os.path.split(os.path.abspath(__file__))[0], '..')
|
||||||
chromium_manifest = pj(proj_dir, 'platform', 'chromium', 'manifest.json')
|
|
||||||
|
|
||||||
|
version = ''
|
||||||
|
with open(os.path.join(proj_dir, 'dist', 'version')) as f:
|
||||||
|
version = f.read().strip()
|
||||||
|
|
||||||
|
chromium_manifest = pj(proj_dir, 'platform', 'chromium', 'manifest.json')
|
||||||
with open(chromium_manifest, encoding='utf-8') as m:
|
with open(chromium_manifest, encoding='utf-8') as m:
|
||||||
manifest = json.load(m)
|
manifest = json.load(m)
|
||||||
|
|
||||||
# https://developer.mozilla.org/en-US/Add-ons/AMO/Policy/Maintenance#How_do_I_submit_a_Beta_add-on.3F
|
# https://developer.mozilla.org/en-US/Add-ons/AMO/Policy/Maintenance#How_do_I_submit_a_Beta_add-on.3F
|
||||||
# "To create a beta channel [...] '(a|alpha|b|beta|pre|rc)\d*$' "
|
# "To create a beta channel [...] '(a|alpha|b|beta|pre|rc)\d*$' "
|
||||||
|
|
||||||
match = re.search('^(\d+\.\d+\.\d+)(\.\d+)$', manifest['version'])
|
match = re.search('^(\d+\.\d+\.\d+)(\.\d+)$', version)
|
||||||
if match:
|
if match:
|
||||||
buildtype = int(match.group(2)[1:])
|
buildtype = int(match.group(2)[1:])
|
||||||
if buildtype < 100:
|
if buildtype < 100:
|
||||||
|
@ -77,6 +81,8 @@ if match:
|
||||||
else:
|
else:
|
||||||
builttype = 'rc' + str(buildtype - 100)
|
builttype = 'rc' + str(buildtype - 100)
|
||||||
manifest['version'] = match.group(1) + builttype
|
manifest['version'] = match.group(1) + builttype
|
||||||
|
else:
|
||||||
|
manifest['version'] = version
|
||||||
|
|
||||||
manifest['homepage'] = 'https://github.com/gorhill/uBlock'
|
manifest['homepage'] = 'https://github.com/gorhill/uBlock'
|
||||||
manifest['description'] = descriptions['en']
|
manifest['description'] = descriptions['en']
|
||||||
|
|
|
@ -11,19 +11,16 @@ if len(sys.argv) == 1 or not sys.argv[1]:
|
||||||
proj_dir = os.path.join(os.path.split(os.path.abspath(__file__))[0], '..')
|
proj_dir = os.path.join(os.path.split(os.path.abspath(__file__))[0], '..')
|
||||||
build_dir = os.path.abspath(sys.argv[1])
|
build_dir = os.path.abspath(sys.argv[1])
|
||||||
|
|
||||||
# Import version number from chromium platform
|
version = ''
|
||||||
chromium_manifest = {}
|
with open(os.path.join(proj_dir, 'dist', 'version')) as f:
|
||||||
|
version = f.read().strip()
|
||||||
|
|
||||||
webext_manifest = {}
|
webext_manifest = {}
|
||||||
|
|
||||||
chromium_manifest_file = os.path.join(proj_dir, 'platform', 'chromium', 'manifest.json')
|
|
||||||
with open(chromium_manifest_file) as f1:
|
|
||||||
chromium_manifest = json.load(f1)
|
|
||||||
|
|
||||||
webext_manifest_file = os.path.join(build_dir, 'manifest.json')
|
webext_manifest_file = os.path.join(build_dir, 'manifest.json')
|
||||||
with open(webext_manifest_file) as f2:
|
with open(webext_manifest_file) as f2:
|
||||||
webext_manifest = json.load(f2)
|
webext_manifest = json.load(f2)
|
||||||
|
|
||||||
match = re.search('^(\d+\.\d+\.\d+)(\.\d+)$', chromium_manifest['version'])
|
match = re.search('^(\d+\.\d+\.\d+)(\.\d+)$', version)
|
||||||
if match:
|
if match:
|
||||||
buildtype = int(match.group(2)[1:])
|
buildtype = int(match.group(2)[1:])
|
||||||
if buildtype < 100:
|
if buildtype < 100:
|
||||||
|
@ -32,7 +29,7 @@ if match:
|
||||||
builttype = 'rc' + str(buildtype - 100)
|
builttype = 'rc' + str(buildtype - 100)
|
||||||
webext_manifest['version'] = match.group(1) + builttype
|
webext_manifest['version'] = match.group(1) + builttype
|
||||||
else:
|
else:
|
||||||
webext_manifest['version'] = chromium_manifest['version']
|
webext_manifest['version'] = version
|
||||||
|
|
||||||
with open(webext_manifest_file, 'w') as f2:
|
with open(webext_manifest_file, 'w') as f2:
|
||||||
json.dump(webext_manifest, f2, indent=2, separators=(',', ': '), sort_keys=True)
|
json.dump(webext_manifest, f2, indent=2, separators=(',', ': '), sort_keys=True)
|
||||||
|
|
Loading…
Reference in a new issue