mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
add acre to sys path in igniter as pype.py has invalid relative path to repos
This commit is contained in:
parent
8e39835e4a
commit
8b7b62c044
2 changed files with 27 additions and 21 deletions
|
|
@ -81,6 +81,26 @@ def validate_path_string(path: str) -> (bool, str):
|
|||
return False, "Not implemented yet"
|
||||
|
||||
|
||||
def add_acre_to_sys_path():
|
||||
"""Add full path of acre module to sys.path on ignitation."""
|
||||
try:
|
||||
# Skip if is possible to import
|
||||
import acre
|
||||
|
||||
except ImportError:
|
||||
# Full path to acred repository related to current file
|
||||
acre_dir = os.path.join(
|
||||
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
|
||||
"repos",
|
||||
"acre"
|
||||
)
|
||||
# Add path to sys.path
|
||||
sys.path.append(acre_dir)
|
||||
|
||||
# Validate that acre can be imported
|
||||
import acre
|
||||
|
||||
|
||||
def load_environments(sections: list = None) -> dict:
|
||||
"""Load environments from Pype.
|
||||
|
||||
|
|
@ -94,16 +114,9 @@ def load_environments(sections: list = None) -> dict:
|
|||
dict of str: loaded and processed environments.
|
||||
|
||||
"""
|
||||
try:
|
||||
import acre
|
||||
except ImportError:
|
||||
acre_dir = os.path.join(
|
||||
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
|
||||
"repos",
|
||||
"acre"
|
||||
)
|
||||
sys.path.append(acre_dir)
|
||||
import acre
|
||||
add_acre_to_sys_path()
|
||||
import acre
|
||||
|
||||
from pype import settings
|
||||
|
||||
all_env = settings.get_environments()
|
||||
|
|
|
|||
15
pype.py
15
pype.py
|
|
@ -44,20 +44,13 @@ import re
|
|||
import sys
|
||||
import traceback
|
||||
|
||||
from igniter.tools import load_environments
|
||||
from igniter.tools import load_environments, add_acre_to_sys_path
|
||||
|
||||
try:
|
||||
import acre
|
||||
except ImportError:
|
||||
acre_dir = os.path.join(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"repos",
|
||||
"acre"
|
||||
)
|
||||
sys.path.append(acre_dir)
|
||||
import acre
|
||||
from igniter import BootstrapRepos
|
||||
|
||||
add_acre_to_sys_path()
|
||||
import acre
|
||||
|
||||
|
||||
def set_environments() -> None:
|
||||
"""Set loaded environments.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue