Skip to content

Commit b85e83c

Browse files
committed
add PYTHONPATH for extension's install.py
1 parent d35bf64 commit b85e83c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

launch.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ def extract_arg(args, name):
1717
return [x for x in args if x != name], name in args
1818

1919

20-
def run(command, desc=None, errdesc=None):
20+
def run(command, desc=None, errdesc=None, custom_env=None):
2121
if desc is not None:
2222
print(desc)
2323

24-
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
24+
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, env=os.environ if custom_env is None else custom_env)
2525

2626
if result.returncode != 0:
2727

@@ -115,7 +115,10 @@ def run_extensions_installers():
115115
continue
116116

117117
try:
118-
print(run(f'"{python}" "{path_installer}"', errdesc=f"Error running install.py for extension {dirname_extension}"))
118+
env = os.environ.copy()
119+
env['PYTHONPATH'] = os.path.abspath(".")
120+
121+
print(run(f'"{python}" "{path_installer}"', errdesc=f"Error running install.py for extension {dirname_extension}", custom_env=env))
119122
except Exception as e:
120123
print(e, file=sys.stderr)
121124

0 commit comments

Comments
 (0)