transitioned from use of bootstrap.cfg to .o3de\Reigistry\bootstrap.setreg
This commit is contained in:
@@ -84,7 +84,7 @@ _LY_DEV = os.getenv(constants.ENVAR_LY_DEV,
|
||||
|
||||
# get/set the project name
|
||||
_LY_PROJECT_TAG = os.getenv(constants.ENVAR_LY_PROJECT,
|
||||
config_utils.get_current_project(_LY_DEV))
|
||||
config_utils.get_current_project().name)
|
||||
|
||||
# project cache log dir path
|
||||
_DCCSI_LOG_PATH = Path(os.getenv(constants.ENVAR_DCCSI_LOG_PATH,
|
||||
|
||||
@@ -137,8 +137,9 @@ def get_dccsi_config(dccsi_dirpath=return_stub_dir()):
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def get_current_project(dev_folder=get_stub_check_path()):
|
||||
"""Uses regex in lumberyard Dev\\bootstrap.cfg to retreive project tag str"""
|
||||
def get_current_project_cfg(dev_folder=get_stub_check_path()):
|
||||
"""Uses regex in lumberyard Dev\\bootstrap.cfg to retreive project tag str
|
||||
Note: boostrap.cfg will be deprecated. Don't use this method anymore."""
|
||||
boostrap_filepath = Path(dev_folder, "bootstrap.cfg")
|
||||
if boostrap_filepath.exists():
|
||||
bootstrap = open(str(boostrap_filepath), "r")
|
||||
@@ -153,6 +154,33 @@ def get_current_project(dev_folder=get_stub_check_path()):
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def get_current_project():
|
||||
"""Gets o3de project via .o3de data in user directory"""
|
||||
|
||||
from azpy.constants import PATH_USER_O3DE_BOOTSTRAP
|
||||
from collections import OrderedDict
|
||||
from box import Box
|
||||
|
||||
bootstrap_box = None
|
||||
|
||||
try:
|
||||
bootstrap_box = Box.from_json(filename=PATH_USER_O3DE_BOOTSTRAP,
|
||||
encoding="utf-8",
|
||||
errors="strict",
|
||||
object_pairs_hook=OrderedDict)
|
||||
except FileExistsError as e:
|
||||
_LOGGER.error('File does not exist: {}'.format(PATH_USER_O3DE_BOOTSTRAP))
|
||||
|
||||
if bootstrap_box:
|
||||
# this seems fairly hard coded - what if the data changes?
|
||||
project_path=Path(bootstrap_box.Amazon.AzCore.Bootstrap.project_path)
|
||||
return project_path.resolve()
|
||||
else:
|
||||
return None
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def bootstrap_dccsi_py_libs(dccsi_dirpath=return_stub_dir()):
|
||||
"""Builds and adds local site dir libs based on py version"""
|
||||
@@ -194,7 +222,11 @@ if __name__ == '__main__':
|
||||
|
||||
_LOGGER.info('LY_DEV: {}'.format(get_stub_check_path('engine.json')))
|
||||
|
||||
_LOGGER.info('LY_PROJECT: {}'.format(get_current_project(get_stub_check_path('bootstrap.cfg'))))
|
||||
# this will be deprecated and shouldn't work soon (returns None)
|
||||
_LOGGER.info('LY_PROJECT: {}'.format(get_current_project_cfg(get_stub_check_path('bootstrap.cfg'))))
|
||||
|
||||
# new o3de version
|
||||
_LOGGER.info('LY_PROJECT: {}'.format(get_current_project()))
|
||||
|
||||
_LOGGER.info('DCCSI_PYTHON_LIB_PATH: {}'.format(bootstrap_dccsi_py_libs(return_stub_dir('dccsi_stub'))))
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ So we can make an update here once that is used elsewhere.
|
||||
import os
|
||||
import sys
|
||||
import site
|
||||
from os.path import expanduser
|
||||
import logging as _logging
|
||||
|
||||
# for this module to perform standalone
|
||||
@@ -91,6 +92,9 @@ TAG_DIR_DCCSI_SDK = str('SDK')
|
||||
TAG_DIR_LY_BUILD = str('build')
|
||||
TAG_QT_PLUGIN_PATH = str('QT_PLUGIN_PATH')
|
||||
|
||||
TAG_O3DE_FOLDER = str('.o3de')
|
||||
TAG_O3DE_BOOTSTRAP = str('bootstrap.setreg')
|
||||
|
||||
# filesystem markers, stub file names.
|
||||
STUB_LY_DEV = str('engine.json')
|
||||
STUB_LY_ROOT_PROJECT = str('ly_project_stub')
|
||||
@@ -221,10 +225,17 @@ TAG_DEFAULT_PY = str('Launch_pyBASE.bat')
|
||||
# config file stuff
|
||||
FILENAME_DEFAULT_CONFIG = str('DCCSI_config.json')
|
||||
|
||||
# new o3de related paths
|
||||
PATH_USER_O3DE = str('{home}\\{o3de}').format(home=expanduser("~"),
|
||||
o3de=TAG_O3DE_FOLDER)
|
||||
PATH_USER_O3DE_REGISTRY = str('{0}\\Registry').format(PATH_USER_O3DE)
|
||||
PATH_USER_O3DE_BOOTSTRAP = str('{reg}\\{file}').format(reg=PATH_USER_O3DE_REGISTRY,
|
||||
file=TAG_O3DE_BOOTSTRAP)
|
||||
|
||||
#python and site-dir
|
||||
TAG_DCCSI_PY_VERSION_MAJOR = str(3)
|
||||
TAG_DCCSI_PY_VERSION_MINOR = str(7)
|
||||
TAG_DCCSI_PY_VERSION_RELEASE = str(5)
|
||||
TAG_DCCSI_PY_VERSION_RELEASE = str(10)
|
||||
TAG_PYTHON_EXE = str('python.exe')
|
||||
TAG_TOOLS_DIR = str('Tools\\Python')
|
||||
TAG_PLATFORM = str('windows')
|
||||
@@ -314,6 +325,7 @@ if __name__ == '__main__':
|
||||
_stash_dict['QTFORPYTHON_PATH'] = Path(PATH_QTFORPYTHON_PATH)
|
||||
_stash_dict['QT_PLUGIN_PATH'] = Path(PATH_QT_PLUGIN_PATH)
|
||||
_stash_dict['SAT_INSTALL_PATH'] = Path(PATH_SAT_INSTALL_PATH)
|
||||
_stash_dict['PATH_USER_O3DE_BOOTSTRAP'] = Path(PATH_USER_O3DE_BOOTSTRAP)
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# py 2 and 3 compatible iter
|
||||
|
||||
@@ -223,8 +223,8 @@ os.environ["DYNACONF_DCCSI_DEV_MODE"] = str(_DCCSI_DEV_MODE)
|
||||
_LY_DEV = azpy.config_utils.get_stub_check_path(in_path=_DCCSIG_PATH,
|
||||
check_stub='engine.json')
|
||||
os.environ["DYNACONF_LY_DEV"] = str(_LY_DEV.resolve())
|
||||
_LY_PROJECT = azpy.config_utils.get_current_project(_LY_DEV)
|
||||
os.environ["DYNACONF_LY_PROJECT"] = _LY_PROJECT
|
||||
_LY_PROJECT = azpy.config_utils.get_current_project()
|
||||
os.environ["DYNACONF_LY_PROJECT"] = str(_LY_PROJECT.resolve())
|
||||
_LY_PROJECT_PATH = Path(_LY_DEV, _LY_PROJECT)
|
||||
os.environ["DYNACONF_LY_PROJECT_PATH"] = str(_LY_PROJECT_PATH)
|
||||
os.environ["DYNACONF_DCCSIG_PATH"] = str(_DCCSIG_PATH)
|
||||
|
||||
Reference in New Issue
Block a user