__init__.py 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # coding:utf-8
  2. #!/usr/bin/python
  3. #
  4. # Copyright (c) Contributors to the Open 3D Engine Project.
  5. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  6. #
  7. # SPDX-License-Identifier: Apache-2.0 OR MIT
  8. #
  9. #
  10. # -------------------------------------------------------------------------
  11. """! O3DE DCCsi Tools package
  12. :file: < DCCsi >/Tools/__init__.py
  13. :Status: Prototype
  14. :Version: 0.0.1
  15. This init allows us to treat the Tools folder as a package.
  16. """
  17. # -------------------------------------------------------------------------
  18. # standard imports
  19. import os
  20. from pathlib import Path
  21. import logging as _logging
  22. # -------------------------------------------------------------------------
  23. # -------------------------------------------------------------------------
  24. # global scope
  25. from DccScriptingInterface import _PACKAGENAME, STR_CROSSBAR
  26. _PACKAGENAME = f'{_PACKAGENAME}.Tools'
  27. __all__ = ['DCC',
  28. 'IDE',
  29. 'Python'] # to do: add others when they are set up
  30. #'Foo',
  31. _LOGGER = _logging.getLogger(_PACKAGENAME)
  32. _LOGGER.debug('Initializing: {0}.'.format({_PACKAGENAME}))
  33. # -------------------------------------------------------------------------
  34. # -------------------------------------------------------------------------
  35. # we need to set up basic access to the DCCsi
  36. _MODULE_PATH = Path(__file__)
  37. _LOGGER.debug(f'_MODULE_PATH: {_MODULE_PATH}')
  38. # turtles all the way down, the paths from there to here
  39. from DccScriptingInterface import PATH_O3DE_TECHART_GEMS
  40. from DccScriptingInterface import PATH_DCCSIG
  41. from DccScriptingInterface import add_site_dir
  42. # this makes sure nothing asserts higher up
  43. from DccScriptingInterface.globals import *
  44. from DccScriptingInterface.constants import ENVAR_PATH_DCCSI_TOOLS
  45. # the path to this < dccsi >/Tools pkg
  46. PATH_DCCSI_TOOLS = Path(_MODULE_PATH.parent)
  47. # this allows the Tool location to be overriden in the external env
  48. PATH_DCCSI_TOOLS = Path(os.getenv(ENVAR_PATH_DCCSI_TOOLS,
  49. PATH_DCCSI_TOOLS.as_posix()))
  50. add_site_dir(PATH_DCCSI_TOOLS.as_posix())
  51. _LOGGER.debug(f'{ENVAR_PATH_DCCSI_TOOLS}: {PATH_DCCSI_TOOLS}')
  52. _LOGGER.debug(STR_CROSSBAR)
  53. # -------------------------------------------------------------------------