Move version to pmb.__version__

Move the pmbootstrap version to __version__ in the pmb module, so it can
still be found automatically after setup.py is replaced.

Reviewed-by: Luca Weiss <luca@z3ntu.xyz>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230407233026.1712-4-ollieparanoid@postmarketos.org%3E
This commit is contained in:
Oliver Smith 2023-04-08 01:30:25 +02:00
parent 5d28c5ccf3
commit 6352ab9c2d
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
6 changed files with 8 additions and 5 deletions

View File

@ -14,6 +14,10 @@ from .helpers import logging as pmb_logging
from .helpers import mount
from .helpers import other
# pmbootstrap version
__version__ = "1.51.0"
# Python version check
version = sys.version_info
if version < (3, 7):
print("You need at least Python 3.7 to run pmbootstrap")

View File

@ -17,7 +17,6 @@ from pmb.config.sudo import which_sudo
#
# Exported variables (internal configuration)
#
version = "1.51.0"
pmb_src = os.path.normpath(os.path.realpath(__file__) + "/../../..")
apk_keys_path = pmb_src + "/pmb/data/keys"
arch_native = pmb.parse.arch.alpine_native()

View File

@ -59,7 +59,7 @@ def check_version_pmaports(real):
def check_version_pmbootstrap(min):
# Compare versions
real = pmb.config.version
real = pmb.__version__
if pmb.parse.version.compare(real, min) >= 0:
return

View File

@ -34,7 +34,7 @@ def init_req_headers() -> None:
return
# Generic request headers
req_headers = {
'User-Agent': f'pmbootstrap/{pmb.config.version} aportupgrade'}
'User-Agent': f'pmbootstrap/{pmb.__version__} aportupgrade'}
# Request headers specific to GitHub
req_headers_github = dict(req_headers)

View File

@ -893,7 +893,7 @@ def install_on_device_installer(args, step, steps):
"ONDEV_CHANNEL_DESCRIPTION": channel_cfg["description"],
"ONDEV_CHANNEL_MIRRORDIR_ALPINE": channel_cfg["mirrordir_alpine"],
"ONDEV_CIPHER": args.cipher,
"ONDEV_PMBOOTSTRAP_VERSION": pmb.config.version,
"ONDEV_PMBOOTSTRAP_VERSION": pmb.__version__,
"ONDEV_UI": args.ui}
pmb.chroot.root(args, ["ondev-prepare"], suffix_installer, env=env)

View File

@ -603,7 +603,7 @@ def arguments():
# Other
parser.add_argument("-V", "--version", action="version",
version=pmb.config.version)
version=pmb.__version__)
parser.add_argument("-c", "--config", dest="config",
default=pmb.config.defaults["config"],
help="path to pmbootstrap.cfg file (default in"