Fix for issue #59
Relative paths work great for running as a script. But break when running as a module since there is no `src/` folder to mention. This should clear that up as the `src/` now lives under wherever the python package was installed.
This commit is contained in:
parent
66e495e994
commit
57eef46f95
|
|
@ -33,6 +33,10 @@ def run_as_a_module():
|
||||||
if f'{profile}.py' not in library:
|
if f'{profile}.py' not in library:
|
||||||
raise ProfileNotFound(f'Could not locate {profile}.py among the example files.')
|
raise ProfileNotFound(f'Could not locate {profile}.py among the example files.')
|
||||||
|
|
||||||
|
# Swap the working dir, otherwise certain relative lookups won't work within archinstall.
|
||||||
|
# Mainly to avoid https://github.com/Torxed/archinstall/issues/59
|
||||||
|
os.chdir(os.path.abspath(os.path.dirname(__file__)))
|
||||||
|
|
||||||
# Import and execute the chosen `<profile>.py`:
|
# Import and execute the chosen `<profile>.py`:
|
||||||
spec = importlib.util.spec_from_file_location(
|
spec = importlib.util.spec_from_file_location(
|
||||||
library[f"{profile}.py"],
|
library[f"{profile}.py"],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue