Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/__main__.py
diff options
context:
space:
mode:
authorPyfisch <pyfisch@posteo.org>2021-04-05 16:21:12 +0200
committerPyfisch <pyfisch@posteo.org>2021-04-05 16:21:12 +0200
commitecf7a2a237a04882c93fd4d743b037f7af6bc253 (patch)
tree002ee419eb4e3bc1b3fd4c9233f3d8865d3b1331 /archinstall/__main__.py
parent7f691ce1c992c16551459162fbef593daad1e4c8 (diff)
Add console_scripts archinstall entry point
archinstall should be callable from the command-line. Previously this was achieved with a shell script, however Python packages contain a built in way to to this via the entry points mechanism.
Diffstat (limited to 'archinstall/__main__.py')
-rw-r--r--archinstall/__main__.py30
1 files changed, 1 insertions, 29 deletions
diff --git a/archinstall/__main__.py b/archinstall/__main__.py
index 63c2f715..86ed0108 100644
--- a/archinstall/__main__.py
+++ b/archinstall/__main__.py
@@ -2,33 +2,5 @@ import archinstall
import sys
import os
-# TODO: Learn the dark arts of argparse...
-# (I summon thee dark spawn of cPython)
-
-def run_as_a_module():
- """
- Since we're running this as a 'python -m archinstall' module OR
- a nuitka3 compiled version of the project.
- This function and the file __main__ acts as a entry point.
- """
-
- # Add another path for finding profiles, so that list_profiles() in Script() can find guided.py, unattended.py etc.
- archinstall.storage['PROFILE_PATH'].append(os.path.abspath(f'{os.path.dirname(__file__)}/examples'))
-
- if len(sys.argv) == 1:
- sys.argv.append('guided')
-
- try:
- script = archinstall.Script(sys.argv[1])
- except archinstall.ProfileNotFound as err:
- print(f"Couldn't find file: {err}")
- sys.exit(1)
-
- os.chdir(os.path.abspath(os.path.dirname(__file__)))
-
- # Remove the example directory from the PROFILE_PATH, to avoid guided.py etc shows up in user input questions.
- archinstall.storage['PROFILE_PATH'].pop()
- script.execute()
-
if __name__ == '__main__':
- run_as_a_module()
+ archinstall.run_as_a_module()