From e5f720d2d969e16d1f66ab88818d292413832ba6 Mon Sep 17 00:00:00 2001 From: Paul Molodowitch Date: Fri, 23 Jun 2023 14:01:42 -0700 Subject: [PATCH] [docs] fixes for python docstring builds on windows --- cmake/macros/Public.cmake | 1 + docs/python/convertDoxygen.py | 15 +++++++++++++++ docs/python/doxygenlib/cdUtils.py | 1 + 3 files changed, 17 insertions(+) diff --git a/cmake/macros/Public.cmake b/cmake/macros/Public.cmake index 70297cda31..e4895fc1d3 100644 --- a/cmake/macros/Public.cmake +++ b/cmake/macros/Public.cmake @@ -1292,6 +1292,7 @@ function(pxr_build_python_documentation) --package pxr --module ${pxrPythonModulesStr} \ --inputIndex ${BUILT_XML_DOCS}/index.xml \ --pythonPath ${CMAKE_INSTALL_PREFIX}/lib/python \ + --libPath \"${CMAKE_INSTALL_PREFIX}/lib;${CMAKE_INSTALL_PREFIX}/bin;${CMAKE_INSTALL_PREFIX}/plugin/usd;${CMAKE_INSTALL_PREFIX}/share/usd/examples/plugin\" \ --output ${INSTALL_PYTHON_PXR_ROOT}) if (NOT \${convert_doxygen_return_code} EQUAL \"0\") message( FATAL_ERROR \"Error generating python docstrings - ${CONVERT_DOXYGEN_TO_PYTHON_DOCS_SCRIPT} return code: \${convert_doxygen_return_code} \") diff --git a/docs/python/convertDoxygen.py b/docs/python/convertDoxygen.py index 2cfbf60e6c..934e1988fc 100644 --- a/docs/python/convertDoxygen.py +++ b/docs/python/convertDoxygen.py @@ -49,6 +49,7 @@ output_file = GetArgValue(['--output', '-o']) output_format = GetArgValue(['--format', '-f'], "Docstring") python_path = GetArgValue(['--pythonPath']) +lib_path = GetArgValue(['--libPath']) SetDebugMode(GetArg(['--debug', '-d'])) @@ -62,6 +63,20 @@ if (python_path != None): sys.path.append(python_path) +if lib_path != None: + lib_paths = lib_path.replace("/", os.sep).split(";") + if os.name == "nt": + for path in lib_paths: + if os.path.isdir(path): + os.add_dll_directory(path) + else: + ld_lib_paths = os.environ.get("LD_LIBRARY_PATH", "").split(os.pathsep) + for path in lib_paths: + if path not in ld_lib_paths: + ld_lib_paths.append(path) + os.environ["LD_LIBRARY_PATH"] = os.pathsep.join(ld_lib_paths) + + # # Try to import the plugin module that creates the desired output # diff --git a/docs/python/doxygenlib/cdUtils.py b/docs/python/doxygenlib/cdUtils.py index 254f72a3b5..fbe2f3c203 100644 --- a/docs/python/doxygenlib/cdUtils.py +++ b/docs/python/doxygenlib/cdUtils.py @@ -134,6 +134,7 @@ def Usage(): --debug or -d = turn on debugging mode --help or -h = display this program usage statement --pythonPath = optional path to add to python lib paths + --libPath = optional ;-separated paths to allow library loading from Docstring format: Write Python doc strings from Doyxgen C++ comments. Writes