Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-04-05 18:10:28 +0000
committerGitHub <noreply@github.com>2021-04-05 18:10:28 +0000
commit1240cbdaf7772f1284f5c9565480a09e30c643b0 (patch)
treed7a4178aecf6db6f38a575c9fce76e1caac606fa /archinstall
parent824656a990ffa8529e654a719e05a6427b2929a8 (diff)
parent3011811878b79c561fc8b01687af2ba4448a8931 (diff)
Merge pull request #178 from pyfisch/packaging
Simplify packaging
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/__init__.py33
-rw-r--r--archinstall/__main__.py30
2 files changed, 33 insertions, 30 deletions
diff --git a/archinstall/__init__.py b/archinstall/__init__.py
index d4452d38..d98b6daa 100644
--- a/archinstall/__init__.py
+++ b/archinstall/__init__.py
@@ -14,6 +14,8 @@ from .lib.output import *
from .lib.storage import *
from .lib.hardware import *
+__version__ = "2.1.3"
+
## Basic version of arg.parse() supporting:
## --key=value
## --boolean
@@ -27,4 +29,33 @@ for arg in sys.argv[1:]:
key, val = arg[2:], True
arguments[key] = val
else:
- positionals.append(arg) \ No newline at end of file
+ positionals.append(arg)
+
+
+# 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.
+ storage['PROFILE_PATH'].append(os.path.abspath(f'{os.path.dirname(__file__)}/examples'))
+
+ if len(sys.argv) == 1:
+ sys.argv.append('guided')
+
+ try:
+ script = Script(sys.argv[1])
+ except 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.
+ storage['PROFILE_PATH'].pop()
+ script.execute()
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()