Added a by-path import to support git clone - import of the library (#931)

This commit is contained in:
Anton Hvornum 2022-02-02 08:09:12 +01:00 committed by GitHub
parent e3adab13e8
commit 5cfec48ac4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 1 deletions

View File

@ -1,4 +1,15 @@
import archinstall
import importlib
import sys
import pathlib
# Load .git version before the builtin version
if pathlib.Path('./archinstall/__init__.py').absolute().exists():
spec = importlib.util.spec_from_file_location("archinstall", "./archinstall/__init__.py")
archinstall = importlib.util.module_from_spec(spec)
sys.modules["archinstall"] = archinstall
spec.loader.exec_module(sys.modules["archinstall"])
else:
import archinstall
if __name__ == '__main__':
archinstall.run_as_a_module()