Integrating up through commit 90f050496
This commit is contained in:
@@ -1,22 +1,20 @@
|
||||
# coding:utf-8
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
# -- This line is 75 characters -------------------------------------------
|
||||
"""
|
||||
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
its licensors.
|
||||
|
||||
For complete copyright and license terms please see the LICENSE at the root of this
|
||||
distribution (the "License"). All use of this software is governed by the License,
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
"""
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
"""Extend the .env using dynaconf (dynamic configuration and settings)
|
||||
This config.py module assumes a minimal enviornment is defined in the .env
|
||||
To do: ensure that we can stack/layer the dynamic env to work with ly projects
|
||||
To do: ensure that we can stack/layer the dynamic env to work with O3DE projects
|
||||
"""
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
# built in's
|
||||
import os
|
||||
import sys
|
||||
@@ -29,7 +27,7 @@ import re
|
||||
# on py27 so we need to import and use after some boostrapping
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# -------------------------------------------------------------------+------
|
||||
#os.environ['PYTHONINSPECT'] = 'True'
|
||||
_MODULE_PATH = os.path.abspath(__file__)
|
||||
|
||||
@@ -48,20 +46,21 @@ from azpy.constants import ENVAR_DCCSI_GDEBUG
|
||||
from azpy.constants import ENVAR_DCCSI_DEV_MODE
|
||||
|
||||
# set up global space, logging etc.
|
||||
_G_DEBUG = env_bool(ENVAR_DCCSI_GDEBUG, False)
|
||||
# set these true if you want them set globally for debugging
|
||||
_DCCSI_GDEBUG = env_bool(ENVAR_DCCSI_GDEBUG, False)
|
||||
_DCCSI_DEV_MODE = env_bool(ENVAR_DCCSI_DEV_MODE, False)
|
||||
|
||||
_PACKAGENAME = 'DCCsi.config'
|
||||
|
||||
_log_level = int(20)
|
||||
if _G_DEBUG:
|
||||
_log_level = int(10)
|
||||
_LOG_LEVEL = int(20)
|
||||
if _DCCSI_GDEBUG:
|
||||
_LOG_LEVEL = int(10)
|
||||
_LOGGER = azpy.initialize_logger(_PACKAGENAME,
|
||||
log_to_file=False,
|
||||
default_log_level=_log_level)
|
||||
default_log_level=_LOG_LEVEL)
|
||||
_LOGGER.info('Starting up: {}.'.format({_PACKAGENAME}))
|
||||
_LOGGER.info('site.addsitedir({})'.format(_DCCSIG_PATH))
|
||||
_LOGGER.debug('_G_DEBUG: {}'.format(_G_DEBUG))
|
||||
_LOGGER.debug('_DCCSI_GDEBUG: {}'.format(_DCCSI_GDEBUG))
|
||||
_LOGGER.debug('_DCCSI_DEV_MODE: {}'.format(_DCCSI_DEV_MODE))
|
||||
|
||||
# early attach WingIDE debugger (can refactor to include other IDEs later)
|
||||
@@ -69,14 +68,14 @@ if _DCCSI_DEV_MODE:
|
||||
from azpy.test.entry_test import connect_wing
|
||||
foo = connect_wing()
|
||||
# to do: ^ this should be replaced with full featured azpy.dev.util
|
||||
# that supports additional debuggers (pycharm, vscode)
|
||||
# that supports additional debuggers (pycharm, vscode, etc.)
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# (2) this will give us import access to modules we provide
|
||||
_DCCSI_PYTHON_LIB_PATH = azpy.config_utils.bootstrap_dccsi_py_libs(_DCCSIG_PATH)
|
||||
|
||||
|
||||
# Now we should be able to just carry on with pth lib and dynaconf
|
||||
from dynaconf import Dynaconf
|
||||
from pathlib import Path
|
||||
@@ -149,7 +148,7 @@ def init_ly_pyside(LY_DEV=None):
|
||||
_LOGGER.debug('DCCsi, config.py: FAILURE: import PySide2')
|
||||
status = False
|
||||
raise(e)
|
||||
|
||||
|
||||
try:
|
||||
import shiboken2
|
||||
_LOGGER.debug('DCCsi, config.py: SUCCESS: import shiboken2')
|
||||
@@ -159,7 +158,7 @@ def init_ly_pyside(LY_DEV=None):
|
||||
_LOGGER.debug('DCCsi, config.py: FAILURE: import shiboken2')
|
||||
status = False
|
||||
raise(e)
|
||||
|
||||
|
||||
# set up the pyside2-tools (pyside2uic)
|
||||
# to do: move path construction string to constants and build off of SDK
|
||||
# have not done that yet as I really want to get legal approval and
|
||||
@@ -170,7 +169,7 @@ def init_ly_pyside(LY_DEV=None):
|
||||
'AtomLyIntegration',
|
||||
'TechnicalArt',
|
||||
'DccScriptingInterface',
|
||||
'SDK',
|
||||
'.dev',
|
||||
'QtForPython',
|
||||
'pyside2-tools-dev')
|
||||
os.environ["DYNACONF_DCCSI_PYSIDE2_TOOLS"] = str(DCCSI_PYSIDE2_TOOLS.resolve())
|
||||
@@ -210,9 +209,16 @@ settings = Dynaconf(
|
||||
settings_files=['settings.json', '.secrets.json'],
|
||||
)
|
||||
|
||||
from azpy.constants import PATH_LY_BUILD_PATH
|
||||
from azpy.constants import PATH_LY_BIN_PATH
|
||||
|
||||
# global settings
|
||||
os.environ["DYNACONF_DCCSI_GDEBUG"] = str(_DCCSI_GDEBUG)
|
||||
os.environ["DYNACONF_DCCSI_DEV_MODE"] = str(_DCCSI_DEV_MODE)
|
||||
|
||||
# search up to get \dev
|
||||
_LY_DEV = azpy.config_utils.get_stub_check_path(in_path=_DCCSIG_PATH,
|
||||
check_stub='engineroot.txt')
|
||||
check_stub='engineroot.txt')
|
||||
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
|
||||
@@ -227,9 +233,9 @@ os.environ["DYNACONF_DCCSI_PYTHON_LIB_PATH"] = str(_DCCSI_PYTHON_LIB_PATH)
|
||||
os.environ["DYNACONF_OS_FOLDER"] = azpy.config_utils.get_os()
|
||||
|
||||
# we need to set up the Ly dev build \bin\path (for Qt dll access)
|
||||
_LY_BUILD_PATH = Path.joinpath(_LY_DEV, r'windows_vs2019').resolve()
|
||||
_LY_BUILD_PATH = Path(PATH_LY_BUILD_PATH).resolve()
|
||||
os.environ["DYNACONF_LY_BUILD_PATH"] = str(_LY_BUILD_PATH)
|
||||
_LY_BIN_PATH = Path.joinpath(_LY_BUILD_PATH, 'bin\\profile').resolve()
|
||||
_LY_BIN_PATH = Path(PATH_LY_BIN_PATH).resolve()
|
||||
os.environ["DYNACONF_LY_BIN_PATH"] = str(_LY_BIN_PATH)
|
||||
|
||||
# project cache log dir path
|
||||
@@ -259,7 +265,7 @@ def get_config_settings(setup_ly_pyside=False):
|
||||
|
||||
if setup_ly_pyside:
|
||||
init_ly_pyside(settings.LY_DEV)
|
||||
|
||||
|
||||
settings.setenv()
|
||||
return settings
|
||||
# --- END -----------------------------------------------------------------
|
||||
@@ -270,23 +276,29 @@ def get_config_settings(setup_ly_pyside=False):
|
||||
# -------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
"""Run this file as main"""
|
||||
|
||||
|
||||
_LOG_LEVEL = int(10) # same as _logging.DEBUG
|
||||
|
||||
_LOGGER = azpy.initialize_logger(_PACKAGENAME,
|
||||
log_to_file=True,
|
||||
default_log_level=int(10))
|
||||
default_log_level=_LOG_LEVEL)
|
||||
|
||||
from dynaconf import settings
|
||||
|
||||
|
||||
# not using fstrings in this module because it might run in py2.7 (maya)
|
||||
_LOGGER.info('DCCSI_GDEBUG: {}'.format(settings.DCCSI_GDEBUG))
|
||||
_LOGGER.info('DCCSI_DEV_MODE: {}'.format(settings.DCCSI_DEV_MODE))
|
||||
_LOGGER.info('DCCSI_LOGLEVEL: {}'.format(settings.DCCSI_LOGLEVEL))
|
||||
|
||||
_LOGGER.info('OS_FOLDER: {}'.format(settings.OS_FOLDER))
|
||||
_LOGGER.info('LY_PROJECT: {}'.format(settings.LY_PROJECT))
|
||||
_LOGGER.info('LY_PROJECT_PATH: {}'.format(settings.LY_PROJECT_PATH))
|
||||
_LOGGER.info('LY_DEV: {}'.format(settings.LY_DEV))
|
||||
_LOGGER.info('LY_BUILD_PATH: {}'.format(settings.LY_BUILD_PATH))
|
||||
_LOGGER.info('LY_BIN_PATH: {}'.format(settings.LY_BIN_PATH))
|
||||
|
||||
|
||||
_LOGGER.info('DCCSI_LOG_PATH: {}'.format(settings.DCCSI_LOG_PATH))
|
||||
|
||||
|
||||
_LOGGER.info('DCCSI_CONFIG_PATH: {}'.format(settings.DCCSI_CONFIG_PATH))
|
||||
_LOGGER.info('DCCSIG_PATH: {}'.format(settings.DCCSIG_PATH))
|
||||
_LOGGER.info('DCCSI_PYTHON_LIB_PATH: {}'.format(settings.DCCSI_PYTHON_LIB_PATH))
|
||||
@@ -309,12 +321,12 @@ if __name__ == '__main__':
|
||||
_LOGGER.info('QT_PLUGIN_PATH: {}'.format(settings.QT_PLUGIN_PATH))
|
||||
_LOGGER.info('QT_QPA_PLATFORM_PLUGIN_PATH: {}'.format(settings.QT_QPA_PLATFORM_PLUGIN_PATH))
|
||||
_LOGGER.info('DCCSI_PYSIDE2_TOOLS: {}'.format(settings.DCCSI_PYSIDE2_TOOLS))
|
||||
|
||||
|
||||
test_pyside2() # test PySide2 access with a pop-up button
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user