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

A couple of minor fixes for python3 support. #564

Merged
merged 1 commit into from
Jun 5, 2020
Merged
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
6 changes: 6 additions & 0 deletions cmake/test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ finally:
list(APPEND mayaUsd_varname_PXR_PLUGINPATH_NAME
"${CMAKE_INSTALL_PREFIX}/plugin/al/plugin")

if(IS_WINDOWS AND DEFINED ENV{PYTHONHOME})
# If the environment contains a PYTHONHOME, also set the path to
# that folder so that we can find the python DLLs.
list(APPEND mayaUsd_varname_PATH $ENV{PYTHONHOME})
endif()
Comment on lines +194 to +198
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HamedSabri-adsk As we discussed, when the PYTHONHOME env var is set (which we'll do from our internal builds) we also add that to the path. This is so the tests can find the python37.dll


# inherit PATH and PYTHONPATH from ENV to get USD entries
# these should come last (esp PYTHONPATH, in case another module is overriding
# with pkgutil)
Expand Down
2 changes: 1 addition & 1 deletion cmake/utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function(mayaUsd_find_python_module module)
set(${module}_FIND_REQUIRED TRUE)
endif()
execute_process(COMMAND "${Python_EXECUTABLE}" "-c"
"import re, ${module}; print re.compile('/__init__.py.*').sub('',${module}.__file__)"
"from __future__ import print_function; import re, ${module}; print(re.compile('/__init__.py.*').sub('',${module}.__file__))"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The python code is used to determine if a given module (such as jinja2) exists. It needed to be made python3 compatible.

RESULT_VARIABLE _${module}_status
OUTPUT_VARIABLE _${module}_location
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
Expand Down