mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-22 00:12:09 +03:00
Add MSI version number to set-version.py
This commit is contained in:
parent
34fec564bc
commit
2d47ccd22f
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
|
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
|
||||||
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
|
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
|
||||||
<?define ProductVersion="6.0.0" ?>
|
<?define ProductVersion="6.1.1" ?>
|
||||||
<?define ProductName="Yubico Authenticator" ?>
|
<?define ProductName="Yubico Authenticator" ?>
|
||||||
|
|
||||||
<Product Id="*" UpgradeCode="fcbafc57-aaaa-47b8-b861-20bda48cd4f6" Name="$(var.ProductName)" Version="$(var.ProductVersion)" Manufacturer="Yubico AB" Language="1033">
|
<Product Id="*" UpgradeCode="fcbafc57-aaaa-47b8-b861-20bda48cd4f6" Name="$(var.ProductName)" Version="$(var.ProductVersion)" Manufacturer="Yubico AB" Language="1033">
|
||||||
|
@ -23,7 +23,7 @@ This script updates version numbers in various files.
|
|||||||
|
|
||||||
version_pattern = r"(\d+)\.(\d+)\.(\d+)(-[^\s+]+)?"
|
version_pattern = r"(\d+)\.(\d+)\.(\d+)(-[^\s+]+)?"
|
||||||
lib_version_pattern = rf"const\s+String\s+version\s+=\s+'({version_pattern})';"
|
lib_version_pattern = rf"const\s+String\s+version\s+=\s+'({version_pattern})';"
|
||||||
lib_build_pattern = rf"const\s+int\s+build\s+=\s+(\d+);"
|
lib_build_pattern = r"const\s+int\s+build\s+=\s+(\d+);"
|
||||||
|
|
||||||
|
|
||||||
def sub1(pattern, repl, string):
|
def sub1(pattern, repl, string):
|
||||||
@ -32,6 +32,7 @@ def sub1(pattern, repl, string):
|
|||||||
raise ValueError(f"Did not find string matching {pattern} to replace")
|
raise ValueError(f"Did not find string matching {pattern} to replace")
|
||||||
return buf
|
return buf
|
||||||
|
|
||||||
|
|
||||||
def update_file(fname, func):
|
def update_file(fname, func):
|
||||||
with open(fname) as f:
|
with open(fname) as f:
|
||||||
orig = f.read()
|
orig = f.read()
|
||||||
@ -43,6 +44,7 @@ def update_file(fname, func):
|
|||||||
f.write(buf)
|
f.write(buf)
|
||||||
print("Updated", fname)
|
print("Updated", fname)
|
||||||
|
|
||||||
|
|
||||||
def read_lib_version():
|
def read_lib_version():
|
||||||
with open("lib/version.dart") as f:
|
with open("lib/version.dart") as f:
|
||||||
buf = f.read()
|
buf = f.read()
|
||||||
@ -77,6 +79,7 @@ def update_lib(buf):
|
|||||||
|
|
||||||
return buf
|
return buf
|
||||||
|
|
||||||
|
|
||||||
# Handle invocation
|
# Handle invocation
|
||||||
args = sys.argv[1:]
|
args = sys.argv[1:]
|
||||||
if not args:
|
if not args:
|
||||||
@ -95,27 +98,29 @@ else:
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# x.y.z without trailing part
|
# x.y.z without trailing part
|
||||||
short_version = re.search("(\d+\.\d+\.\d+)", version).group()
|
short_version = re.search(r"(\d+\.\d+\.\d+)", version).group()
|
||||||
|
|
||||||
|
|
||||||
# pubspec.yaml
|
# pubspec.yaml
|
||||||
def update_pubspec(buf):
|
def update_pubspec(buf):
|
||||||
return sub1(
|
return sub1(
|
||||||
r'version:\s+\d+\.\d+\.\d+.*\+\d+',
|
r"version:\s+\d+\.\d+\.\d+.*\+\d+",
|
||||||
f'version: {version}+{build}',
|
f"version: {version}+{build}",
|
||||||
buf,
|
buf,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Helper version_info
|
# Helper version_info
|
||||||
def update_helper_version(buf):
|
def update_helper_version(buf):
|
||||||
version_tuple = repr(tuple(int(d) for d in short_version.split(".")) + (0,))
|
version_tuple = repr(tuple(int(d) for d in short_version.split(".")) + (0,))
|
||||||
buf = sub1(
|
buf = sub1(
|
||||||
rf'filevers=\(\d+, \d+, \d+, \d+\)',
|
r"filevers=\(\d+, \d+, \d+, \d+\)",
|
||||||
f'filevers={version_tuple}',
|
f"filevers={version_tuple}",
|
||||||
buf,
|
buf,
|
||||||
)
|
)
|
||||||
buf = sub1(
|
buf = sub1(
|
||||||
rf'prodvers=\(\d+, \d+, \d+, \d+\)',
|
r"prodvers=\(\d+, \d+, \d+, \d+\)",
|
||||||
f'prodvers={version_tuple}',
|
f"prodvers={version_tuple}",
|
||||||
buf,
|
buf,
|
||||||
)
|
)
|
||||||
buf = sub1(
|
buf = sub1(
|
||||||
@ -130,6 +135,7 @@ def update_helper_version(buf):
|
|||||||
)
|
)
|
||||||
return buf
|
return buf
|
||||||
|
|
||||||
|
|
||||||
# release-win.ps1
|
# release-win.ps1
|
||||||
def update_release_win(buf):
|
def update_release_win(buf):
|
||||||
return sub1(
|
return sub1(
|
||||||
@ -138,6 +144,17 @@ def update_release_win(buf):
|
|||||||
buf,
|
buf,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# MSI .wxs file
|
||||||
|
def update_win_msi(buf):
|
||||||
|
return sub1(
|
||||||
|
rf'ProductVersion="{version_pattern}"',
|
||||||
|
f'ProductVersion="{short_version}"',
|
||||||
|
buf,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
update_file("pubspec.yaml", update_pubspec)
|
update_file("pubspec.yaml", update_pubspec)
|
||||||
update_file("helper/version_info.txt", update_helper_version)
|
update_file("helper/version_info.txt", update_helper_version)
|
||||||
update_file("resources/win/release-win.ps1", update_release_win)
|
update_file("resources/win/release-win.ps1", update_release_win)
|
||||||
|
update_file("resources/win/yubioath-desktop.wxs", update_win_msi)
|
||||||
|
Loading…
Reference in New Issue
Block a user