Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for python 3.8 on windows by explicitely loading dlls #1420

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions build_scripts/build_usd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2014,16 +2014,6 @@ def ForceBuildDependency(self, dep):
PrintError("64bit python not found -- please install it and adjust your"
"PATH")
sys.exit(1)

# Error out on Windows with Python 3.8+. USD currently does not support
# these versions due to:
# https://docs.python.org/3.8/whatsnew/3.8.html#bpo-36085-whatsnew
isPython38 = (sys.version_info.major >= 3 and
sys.version_info.minor >= 8)
if Windows() and isPython38:
PrintError("Python 3.8+ is not supported on Windows")
sys.exit(1)

else:
PrintError("python not found -- please ensure python is included in your "
"PATH")
Expand Down
13 changes: 11 additions & 2 deletions cmake/macros/Public.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,17 @@ function(pxr_setup_python)
# Install a pxr __init__.py with an appropriate __all__
_get_install_dir(lib/python/pxr installPrefix)

file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/generated_modules_init.py"
"__all__ = [${pyModulesStr}]\n")
if(WIN32)
install(
FILES ${PROJECT_SOURCE_DIR}/extras/windows_check.py
DESTINATION ${installPrefix}
)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/generated_modules_init.py"
"import pxr.windows_check\n\n")
endif()

file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/generated_modules_init.py"
"__all__ = [${pyModulesStr}]\n")

install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/generated_modules_init.py"
Expand Down
19 changes: 19 additions & 0 deletions extras/windows_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import os
import platform
import sys

if platform.system() == 'Windows':
"""
Since python 3.8 we need to explicitly set
the dll search path on windows
"""
major = sys.version_info[0]
minor = sys.version_info[1]
if major > 3 or (major == 3 and minor >= 8):
base_dir = os.path.join(os.path.dirname(__file__), '..', '..', '..')
bin_dir = os.path.join(base_dir, 'bin')
lib_dir = os.path.join(base_dir, 'lib')

os.add_dll_directory(bin_dir)
os.add_dll_directory(lib_dir)