diff --git a/contrib/print_electrum_version.py b/contrib/print_electrum_version.py index 4e9aba79f..1e10bfd02 100755 --- a/contrib/print_electrum_version.py +++ b/contrib/print_electrum_version.py @@ -1,15 +1,25 @@ #!/usr/bin/python3 # For usage in shell, to get the version of electrum, without needing electrum installed. +# usage: ./print_electrum_version.py [] +# # For example: # $ VERSION=$("$CONTRIB"/print_electrum_version.py) +# $ VERSION=$("$CONTRIB"/print_electrum_version.py APK_VERSION) # instead of # $ VERSION=$(python3 -c "import electrum; print(electrum.version.ELECTRUM_VERSION)") +# $ VERSION=$(python3 -c "import electrum; print(electrum.version.APK_VERSION)") import importlib.util import os +import sys if __name__ == '__main__': + if len(sys.argv) >= 2: + attr_name = sys.argv[1] + else: + attr_name = "ELECTRUM_VERSION" + project_root = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) version_file_path = os.path.join(project_root, "electrum", "version.py") @@ -18,5 +28,6 @@ if __name__ == '__main__': version_module = version = importlib.util.module_from_spec(version_spec) version_spec.loader.exec_module(version_module) - print(version.ELECTRUM_VERSION) + attr_val = getattr(version, attr_name) + print(attr_val, file=sys.stdout) diff --git a/contrib/release.sh b/contrib/release.sh index 1869dedc5..45f0d837e 100755 --- a/contrib/release.sh +++ b/contrib/release.sh @@ -80,7 +80,9 @@ fi VERSION=$("$CONTRIB"/print_electrum_version.py) +APK_VERSION=$("$CONTRIB"/print_electrum_version.py APK_VERSION) info "VERSION: $VERSION" +info "APK_VERSION: $APK_VERSION" REV=$(git describe --tags) info "REV: $REV" COMMIT=$(git rev-parse HEAD) @@ -147,8 +149,8 @@ fi # android for arch in armeabi-v7a arm64-v8a x86_64 do - apk="Electrum-$VERSION.0-$arch-release.apk" - apk_unsigned="Electrum-$VERSION.0-$arch-release-unsigned.apk" + apk="Electrum-$APK_VERSION-$arch-release.apk" + apk_unsigned="Electrum-$APK_VERSION-$arch-release-unsigned.apk" if test -f "dist/$apk"; then info "file exists: $apk" else