RoboHome / code /robohome /src /tools /asset_curation /curation_paths.py
RoboParty Release
Unify robohome source, assets and scenes delivery
3f15e9f
Raw History Blame Contribute Delete
1.78 kB
"""Locations used by the asset curation tools.
Every location comes from an environment variable and there are no machine-specific defaults: an unset variable stops the script and
names the variable to set (see site.example.env). `S` is the root of this repository and needs no setting.
"""
import os
import sys
from pathlib import Path
S = str(Path(__file__).resolve().parents[2]) # tools/asset_curation/curation_paths.py -> repository root
VARIABLES = {
'R': ('RHG_WORK_ROOT', 'working root that holds the retrieval, audit and release directories'),
'W': ('RHG_CURATION_WORK', 'working directory of the curation run (releases, decisions, e2e runs)'),
'A': ('RHG_ASSET_AUDIT', 'output directory of the asset audit'),
'AUDIT_SCRIPTS': ('RHG_ASSET_AUDIT_SCRIPTS', 'helper scripts of the asset audit'),
'L': ('RHG_RETRIEVAL_DIR', 'directory with the retrieval sqlite files'),
'B': ('RHG_HSSD_ROOT', 'root of the HSSD asset library (contains semantics/ and scenes/)'),
'PARENT_RELEASE': ('RHG_PARENT_RELEASE', 'attribute_releases.json that publish_art.py replaces'),
}
def __getattr__(name):
"""Resolve a location when it is first used, so a script only needs the variables it really reads."""
if name in VARIABLES:
variable, meaning = VARIABLES[name]
value = os.environ.get(variable)
if not value:
raise SystemExit('%s is not set: %s. Set it (see tools/asset_curation/site.example.env).' % (variable, meaning))
return value
raise AttributeError(name)
def add_usd_site():
"""Put the directory with the `pxr` (usd-core) package on sys.path when RHG_USD_SITE names one."""
site = os.environ.get('RHG_USD_SITE')
if site and site not in sys.path:
sys.path.insert(0, site)