Skip to content

Commit

Permalink
Fix for issue #59
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Torxed authored Nov 1, 2020
1 parent 66e495e commit 57eef46
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions archinstall/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ def run_as_a_module():
if f'{profile}.py' not in library:
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`:
spec = importlib.util.spec_from_file_location(
library[f"{profile}.py"],
Expand Down

0 comments on commit 57eef46

Please sign in to comment.