mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
modified prefix in pype.lib
This commit is contained in:
parent
c26f3ff8c7
commit
3b72dc9f5e
13 changed files with 38 additions and 36 deletions
|
|
@ -9,7 +9,7 @@ import site
|
|||
# add Python version specific vendor folder
|
||||
site.addsitedir(
|
||||
os.path.join(
|
||||
os.getenv("PYPE_ROOT", ""),
|
||||
os.getenv("OPENPYPE_ROOT", ""),
|
||||
"vendor", "python", "python_{}".format(sys.version[0])))
|
||||
|
||||
from .terminal import Terminal
|
||||
|
|
|
|||
|
|
@ -607,7 +607,7 @@ class AbstractSubmitDeadline(pyblish.api.InstancePlugin):
|
|||
|
||||
"""
|
||||
if 'verify' not in kwargs:
|
||||
kwargs['verify'] = False if os.getenv("PYPE_DONT_VERIFY_SSL", True) else True # noqa
|
||||
kwargs['verify'] = False if os.getenv("OPENPYPE_DONT_VERIFY_SSL", True) else True # noqa
|
||||
# add 10sec timeout before bailing out
|
||||
kwargs['timeout'] = 10
|
||||
return requests.post(*args, **kwargs)
|
||||
|
|
@ -626,7 +626,7 @@ class AbstractSubmitDeadline(pyblish.api.InstancePlugin):
|
|||
|
||||
"""
|
||||
if 'verify' not in kwargs:
|
||||
kwargs['verify'] = False if os.getenv("PYPE_DONT_VERIFY_SSL", True) else True # noqa
|
||||
kwargs['verify'] = False if os.getenv("OPENPYPE_DONT_VERIFY_SSL", True) else True # noqa
|
||||
# add 10sec timeout before bailing out
|
||||
kwargs['timeout'] = 10
|
||||
return requests.get(*args, **kwargs)
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ class Anatomy:
|
|||
return self._roots_obj
|
||||
|
||||
def root_environments(self):
|
||||
"""Return PYPE_ROOT_* environments for current project in dict."""
|
||||
"""Return OPENPYPE_ROOT_* environments for current project in dict."""
|
||||
return self._roots_obj.root_environments()
|
||||
|
||||
def root_environmets_fill_data(self, template=None):
|
||||
|
|
@ -181,7 +181,7 @@ class Anatomy:
|
|||
return self.roots_obj.all_root_paths()
|
||||
|
||||
def set_root_environments(self):
|
||||
"""Set PYPE_ROOT_* environments for current project."""
|
||||
"""Set OPENPYPE_ROOT_* environments for current project."""
|
||||
self._roots_obj.set_root_environments()
|
||||
|
||||
def root_names(self):
|
||||
|
|
@ -320,7 +320,7 @@ class Anatomy:
|
|||
"<{}>"
|
||||
|
||||
## Output
|
||||
"<PYPE_PROJECT_ROOT_NAS>/project/asset/task/animation_v001.ma"
|
||||
"<OPENPYPE_PROJECT_ROOT_NAS>/project/asset/task/animation_v001.ma"
|
||||
|
||||
Args:
|
||||
filepath (str): Full file path where root should be replaced.
|
||||
|
|
@ -1359,7 +1359,7 @@ class Roots:
|
|||
anatomy Anatomy: Anatomy object created for a specific project.
|
||||
"""
|
||||
|
||||
env_prefix = "PYPE_PROJECT_ROOT"
|
||||
env_prefix = "OPENPYPE_PROJECT_ROOT"
|
||||
roots_filename = "roots.json"
|
||||
|
||||
def __init__(self, anatomy):
|
||||
|
|
@ -1465,7 +1465,8 @@ class Roots:
|
|||
def root_environments(self):
|
||||
"""Use root keys to create unique keys for environment variables.
|
||||
|
||||
Concatenates prefix "PYPE_ROOT" with root keys to create unique keys.
|
||||
Concatenates prefix "OPENPYPE_ROOT" with root keys to create unique
|
||||
keys.
|
||||
|
||||
Returns:
|
||||
dict: Result is `{(str): (str)}` dicitonary where key represents
|
||||
|
|
@ -1487,13 +1488,13 @@ class Roots:
|
|||
|
||||
Result on windows platform::
|
||||
{
|
||||
"PYPE_ROOT_WORK": "P:/projects/work",
|
||||
"PYPE_ROOT_PUBLISH": "P:/projects/publish"
|
||||
"OPENPYPE_ROOT_WORK": "P:/projects/work",
|
||||
"OPENPYPE_ROOT_PUBLISH": "P:/projects/publish"
|
||||
}
|
||||
|
||||
Short example when multiroot is not used::
|
||||
{
|
||||
"PYPE_ROOT": "P:/projects"
|
||||
"OPENPYPE_ROOT": "P:/projects"
|
||||
}
|
||||
"""
|
||||
return self._root_environments()
|
||||
|
|
|
|||
|
|
@ -1187,7 +1187,7 @@ def _prepare_last_workfile(data, workdir):
|
|||
file_template = anatomy.templates["work"]["file"]
|
||||
workdir_data.update({
|
||||
"version": 1,
|
||||
"user": os.environ.get("PYPE_USERNAME") or getpass.getuser(),
|
||||
"user": os.environ.get("OPENPYPE_USERNAME") or getpass.getuser(),
|
||||
"ext": extensions[0]
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -1153,7 +1153,7 @@ def get_creator_by_name(creator_name, case_sensitive=False):
|
|||
@with_avalon
|
||||
def change_timer_to_current_context():
|
||||
"""Called after context change to change timers"""
|
||||
webserver_url = os.environ.get("PYPE_WEBSERVER_URL")
|
||||
webserver_url = os.environ.get("OPENPYPE_WEBSERVER_URL")
|
||||
if not webserver_url:
|
||||
log.warning("Couldn't find webserver url")
|
||||
return
|
||||
|
|
|
|||
|
|
@ -150,13 +150,13 @@ def get_pype_execute_args(*args):
|
|||
It is possible to pass any arguments that will be added after pype
|
||||
executables.
|
||||
"""
|
||||
pype_executable = os.environ["PYPE_EXECUTABLE"]
|
||||
pype_executable = os.environ["OPENPYPE_EXECUTABLE"]
|
||||
pype_args = [pype_executable]
|
||||
|
||||
executable_filename = os.path.basename(pype_executable)
|
||||
if "python" in executable_filename.lower():
|
||||
pype_args.append(
|
||||
os.path.join(os.environ["PYPE_ROOT"], "start.py")
|
||||
os.path.join(os.environ["OPENPYPE_ROOT"], "start.py")
|
||||
)
|
||||
|
||||
if args:
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ log = Logger().get_logger(__name__)
|
|||
|
||||
def discover_host_vendor_module(module_name):
|
||||
host = os.environ["AVALON_APP"]
|
||||
pype_root = os.environ["PYPE_ROOT"]
|
||||
pype_root = os.environ["OPENPYPE_ROOT"]
|
||||
main_module = module_name.split(".")[0]
|
||||
module_path = os.path.join(
|
||||
pype_root, "hosts", host, "vendor", main_module)
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ class IniSettingRegistry(ASettingRegistry):
|
|||
# type: (str, str) -> IniSettingRegistry
|
||||
super(IniSettingRegistry, self).__init__(name)
|
||||
# get registry file
|
||||
version = os.getenv("PYPE_VERSION", "N/A")
|
||||
version = os.getenv("OPENPYPE_VERSION", "N/A")
|
||||
self._registry_file = os.path.join(path, "{}.ini".format(name))
|
||||
if not os.path.exists(self._registry_file):
|
||||
with open(self._registry_file, mode="w") as cfg:
|
||||
|
|
@ -369,7 +369,7 @@ class JSONSettingRegistry(ASettingRegistry):
|
|||
now = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
|
||||
header = {
|
||||
"__metadata__": {
|
||||
"pype-version": os.getenv("PYPE_VERSION", "N/A"),
|
||||
"pype-version": os.getenv("OPENPYPE_VERSION", "N/A"),
|
||||
"generated": now
|
||||
},
|
||||
"registry": {}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
"""
|
||||
Logging to console and to mongo. For mongo logging, you need to set either
|
||||
``PYPE_LOG_MONGO_URL`` to something like:
|
||||
``OPENPYPE_LOG_MONGO_URL`` to something like:
|
||||
|
||||
.. example::
|
||||
mongo://user:password@hostname:port/database/collection?authSource=avalon
|
||||
|
||||
or set ``PYPE_LOG_MONGO_HOST`` and other variables.
|
||||
or set ``OPENPYPE_LOG_MONGO_HOST`` and other variables.
|
||||
See :func:`_mongo_settings`
|
||||
|
||||
Best place for it is in ``repos/pype-config/environments/global.json``
|
||||
|
|
@ -207,7 +207,7 @@ class PypeLogger:
|
|||
# Collection name under database in Mongo
|
||||
log_collection_name = "logs"
|
||||
|
||||
# PYPE_DEBUG
|
||||
# OPENPYPE_DEBUG
|
||||
pype_debug = 0
|
||||
|
||||
# Data same for all record documents
|
||||
|
|
@ -335,7 +335,7 @@ class PypeLogger:
|
|||
# like Ftrack event server has 3 other subprocesses that should
|
||||
# use same mongo id
|
||||
if use_mongo_logging:
|
||||
mongo_id = os.environ.pop("PYPE_PROCESS_MONGO_ID", None)
|
||||
mongo_id = os.environ.pop("OPENPYPE_PROCESS_MONGO_ID", None)
|
||||
if not mongo_id:
|
||||
# Create new object id
|
||||
mongo_id = ObjectId()
|
||||
|
|
@ -347,11 +347,11 @@ class PypeLogger:
|
|||
# Store result to class definition
|
||||
cls.use_mongo_logging = use_mongo_logging
|
||||
|
||||
# Define if is in PYPE_DEBUG mode
|
||||
cls.pype_debug = int(os.getenv("PYPE_DEBUG") or "0")
|
||||
# Define if is in OPENPYPE_DEBUG mode
|
||||
cls.pype_debug = int(os.getenv("OPENPYPE_DEBUG") or "0")
|
||||
|
||||
# Mongo URL where logs will be stored
|
||||
cls.log_mongo_url = os.environ.get("PYPE_MONGO")
|
||||
cls.log_mongo_url = os.environ.get("OPENPYPE_MONGO")
|
||||
|
||||
if not cls.log_mongo_url:
|
||||
cls.use_mongo_logging = False
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ def compose_url(scheme=None,
|
|||
|
||||
|
||||
def get_default_components():
|
||||
mongo_url = os.environ.get("PYPE_MONGO")
|
||||
mongo_url = os.environ.get("OPENPYPE_MONGO")
|
||||
if mongo_url is None:
|
||||
raise MongoEnvNotSet(
|
||||
"URL for Mongo logging connection is not set."
|
||||
|
|
@ -139,7 +139,7 @@ class PypeMongoConnection:
|
|||
|
||||
@staticmethod
|
||||
def get_default_mongo_url():
|
||||
return os.environ["PYPE_MONGO"]
|
||||
return os.environ["OPENPYPE_MONGO"]
|
||||
|
||||
@classmethod
|
||||
def get_mongo_client(cls, mongo_url=None):
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ def oiio_supported():
|
|||
Returns:
|
||||
(bool)
|
||||
"""
|
||||
oiio_path = os.getenv("PYPE_OIIO_PATH", "")
|
||||
oiio_path = os.getenv("OPENPYPE_OIIO_PATH", "")
|
||||
if not oiio_path or not os.path.exists(oiio_path):
|
||||
log.debug("OIIOTool is not configured or not present at {}".
|
||||
format(oiio_path))
|
||||
|
|
@ -269,7 +269,7 @@ def decompress(target_dir, file_url,
|
|||
(int(input_frame_end) > int(input_frame_start))
|
||||
|
||||
oiio_cmd = []
|
||||
oiio_cmd.append(os.getenv("PYPE_OIIO_PATH"))
|
||||
oiio_cmd.append(os.getenv("OPENPYPE_OIIO_PATH"))
|
||||
|
||||
oiio_cmd.append("--compression none")
|
||||
|
||||
|
|
@ -328,7 +328,7 @@ def should_decompress(file_url):
|
|||
"""
|
||||
if oiio_supported():
|
||||
output = run_subprocess([
|
||||
os.getenv("PYPE_OIIO_PATH"),
|
||||
os.getenv("OPENPYPE_OIIO_PATH"),
|
||||
"--info", "-v", file_url])
|
||||
return "compression: \"dwaa\"" in output or \
|
||||
"compression: \"dwab\"" in output
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ def get_pype_info():
|
|||
"version": get_pype_version(),
|
||||
"version_type": version_type,
|
||||
"executable": executable_args[-1],
|
||||
"pype_root": os.environ["PYPE_ROOT"],
|
||||
"mongo_url": os.environ["PYPE_MONGO"]
|
||||
"pype_root": os.environ["OPENPYPE_ROOT"],
|
||||
"mongo_url": os.environ["OPENPYPE_MONGO"]
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class Terminal:
|
|||
If :mod:`Colorama` is not found, it will still work, but without colors.
|
||||
|
||||
Depends on :mod:`Colorama`
|
||||
Using **PYPE_LOG_NO_COLORS** environment variable.
|
||||
Using **OPENPYPE_LOG_NO_COLORS** environment variable.
|
||||
"""
|
||||
|
||||
# Is Terminal initialized
|
||||
|
|
@ -38,7 +38,8 @@ class Terminal:
|
|||
"""Initialize Terminal class as object.
|
||||
|
||||
First check if colorized output is disabled by environment variable
|
||||
`PYPE_LOG_NO_COLORS` value. By default is colorized output turned on.
|
||||
`OPENPYPE_LOG_NO_COLORS` value. By default is colorized output turned
|
||||
on.
|
||||
|
||||
Then tries to import python module that do the colors magic and create
|
||||
it's terminal object. Colorized output is not used if import of python
|
||||
|
|
@ -49,7 +50,7 @@ class Terminal:
|
|||
|
||||
from pype.lib import env_value_to_bool
|
||||
use_colors = env_value_to_bool(
|
||||
"PYPE_LOG_NO_COLORS", default=Terminal.use_colors
|
||||
"OPENPYPE_LOG_NO_COLORS", default=Terminal.use_colors
|
||||
)
|
||||
if not use_colors:
|
||||
Terminal.use_colors = use_colors
|
||||
|
|
@ -166,7 +167,7 @@ class Terminal:
|
|||
def log(message):
|
||||
"""Return color formatted message.
|
||||
|
||||
If environment variable `PYPE_LOG_NO_COLORS` is set to
|
||||
If environment variable `OPENPYPE_LOG_NO_COLORS` is set to
|
||||
whatever value, message will be formatted but not colorized.
|
||||
|
||||
Args:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue