Skip to content
Snippets Groups Projects
Unverified Commit 5d28c5cc authored by Oliver Smith's avatar Oliver Smith
Browse files

pmbootstrap.py: move all features to pmb:main()


Prepare to modernize the python packaging. pmbootstrap.py will not be
part of the packaging, so add a note there and move both features
(python version check, ^C check) to pmb/__init__.py:main().

Reviewed-by: default avatarLuca Weiss <luca@z3ntu.xyz>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230407233026.1712-3-ollieparanoid@postmarketos.org%3E
parent 49cd2880
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,13 @@ from .helpers import logging as pmb_logging
from .helpers import mount
from .helpers import other
version = sys.version_info
if version < (3, 7):
print("You need at least Python 3.7 to run pmbootstrap")
print("(You are running it with Python " + str(version.major) +
"." + str(version.minor) + ")")
sys.exit()
def main():
# Wrap everything to display nice error messages
......@@ -59,6 +66,10 @@ def main():
" shutdown' as necessary)")
logging.info("DONE!")
except KeyboardInterrupt:
print("\nCaught KeyboardInterrupt, exiting …")
sys.exit(130) # SIGINT(2) + 128
except Exception as e:
# Dump log to stdout when args (and therefore logging) init failed
if not args:
......
......@@ -4,17 +4,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# PYTHON_ARGCOMPLETE_OK
import sys
version = sys.version_info
if version < (3, 7):
print("You need at least Python 3.7 to run pmbootstrap")
print("(You are running it with Python " + str(version.major) +
"." + str(version.minor) + ")")
sys.exit()
import pmb
# A convenience wrapper for running pmbootstrap from the git repository. This
# script is not part of the python packaging, so don't add more logic here!
if __name__ == "__main__":
try:
sys.exit(pmb.main())
except KeyboardInterrupt:
print("\nCaught KeyboardInterrupt, exiting …")
sys.exit(130) # SIGINT(2) + 128
sys.exit(pmb.main())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment