Skip to content

Commit

Permalink
Merge pull request ynput#135 from ynput/enhancement/use-pythonpath
Browse files Browse the repository at this point in the history
Chore: Add PYTHONPATH in sys.path
  • Loading branch information
iLLiCiTiT authored Aug 2, 2024
2 parents dd557f5 + c4c0ce7 commit 4686b68
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions start.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,15 @@ def _start_distribution():
os.environ["PYTHONPATH"] = os.pathsep.join(python_paths)


def fill_pythonpath():
"""Fill 'sys.path' with paths from PYTHONPATH environment variable."""
lookup_set = set(sys.path)
for path in (os.getenv("PYTHONPATH") or "").split(os.pathsep):
if path not in lookup_set:
sys.path.append(path)
lookup_set.add(path)


def boot():
"""Bootstrap AYON."""

Expand All @@ -722,6 +731,7 @@ def boot():
create_global_connection()
_start_distribution()
store_current_executable_info()
fill_pythonpath()


def _on_main_addon_missing():
Expand Down Expand Up @@ -974,6 +984,7 @@ def main():
_connect_to_ayon_server(True)

if SKIP_BOOTSTRAP:
fill_pythonpath()
return script_cli()

boot()
Expand Down

0 comments on commit 4686b68

Please sign in to comment.