__init__.py 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #
  2. # Copyright (c) Contributors to the Open 3D Engine Project.
  3. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. #
  5. # SPDX-License-Identifier: Apache-2.0 OR MIT
  6. #
  7. #
  8. # -------------------------------------------------------------------------
  9. """azpy.dev.ide.__init__"""
  10. # standard imports
  11. import logging as _logging
  12. from DccScriptingInterface.azpy.dev import _PACKAGENAME
  13. _PACKAGENAME = f'{_PACKAGENAME}.ide'
  14. _LOGGER = _logging.getLogger(_PACKAGENAME)
  15. _LOGGER.debug('Initializing: {0}.'.format({_PACKAGENAME}))
  16. from DccScriptingInterface.globals import *
  17. __all__ = []
  18. # -------------------------------------------------------------------------
  19. try:
  20. import wingapi
  21. __all__ = init_wing(__all__)
  22. except:
  23. pass
  24. def init_wing(_all):
  25. """If the wingapi is required for a package/module to import,
  26. then it should be initialized and added here so general imports
  27. don't fail"""
  28. # Make sure we can import the native apis
  29. import wingapi # this will fail if we can't
  30. _all.append('wing')
  31. # add others
  32. # Importing additional local packages/modules
  33. return _all
  34. def init_all(_all):
  35. """If the wingapi is required for a package/module to import,
  36. then it should be initialized and added here so general imports
  37. don't fail"""
  38. # Make sure we can import the native apis
  39. import wingapi # this will fail if we can't
  40. _all.append('wing')
  41. # add others
  42. # Importing additional local packages/modules
  43. return _all
  44. if DCCSI_DEV_MODE:
  45. # If in dev mode this will test imports of __all__
  46. from DccScriptingInterface.azpy.shared.utils.init import test_imports
  47. _LOGGER.debug('Testing Imports from {0}'.format(_PACKAGENAME))
  48. test_imports(__all__,
  49. _pkg=_PACKAGENAME,
  50. _logger=_LOGGER)