Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2020-11-01 23:01:41 +0000
committerGitHub <noreply@github.com>2020-11-01 23:01:41 +0000
commit57eef46f953574799e01b389e9f665f058bbd42d (patch)
treeb0144e0a1d419326f421e7eed83937df25b4c873
parent66e495e994a459188a567d1410ba29dc3b2282ac (diff)
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.
-rw-r--r--archinstall/__main__.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/archinstall/__main__.py b/archinstall/__main__.py
index fe4a3732..48d8a5ce 100644
--- a/archinstall/__main__.py
+++ b/archinstall/__main__.py
@@ -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"],