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

build_usd.py and find_executable("python") #1414

Closed
JasonWorks opened this issue Dec 11, 2020 · 5 comments
Closed

build_usd.py and find_executable("python") #1414

JasonWorks opened this issue Dec 11, 2020 · 5 comments

Comments

@JasonWorks
Copy link

In build_usd.py, find_executable("python") is used to make sure "python" is in the path. But as a company moving from python2 to python3, we are starting to be very specific about which python version is being executed and getting rid of any use of the link to python.

Now we can add the link when building usd, but I'm not sure it is needed given that build_usd.py is a python file that is being executed at the time. Additionally, elsewhere in build_usd.py, sys.executable is used for actual building of python code.

Filing this issue based on usd-interest post.

@meshula
Copy link
Member

meshula commented Dec 11, 2020

For reference with regards to a possible solution, at OpenTimelineIO we've been wanting to accommodate builds in environments such as conda. We're investigating a pattern of auto-detecting based on a snip like this to help with diverse build environments:

        find_package(Python REQUIRED COMPONENTS Interpreter Development)
         set(OTIO_RESOLVED_PYTHON_INSTALL_DIR "${Python_SITEARCH}")

and some CMake options governing whether the python environment should be automatically detected via this snippet, or externally supplied.

@rstelzleni
Copy link
Contributor

When building with build_usd.py we explicitly use the python that you invoked build_usd.py with as the one you're building against. The script always did that for building against Maya's python, and when we added python3 build support we stuck with that pattern. So, by the time we're running cmake code in that case, we already know what python we're using.

That's why this check doesn't add anything. We already know there's a python interpreter being used, and we know we're building for that one.

The code is here:
https://github.com/PixarAnimationStudios/USD/blob/release/build_scripts/build_usd.py#L2007

I think we could just remove the if on line 2007, remove the else, keep the 64 bit/py38 checks, and this would be equivalent to what its doing now. Jason, do you have a PR in the works? If not I can try that out and submit a PR if it works as expected.

@JasonWorks
Copy link
Author

I do not have a PR - in our docker image, we simply sed:
sed -i 's#find_executable("python")#sys.executable#' USD/build_scripts/build_usd.py

But removing the check altogether works for me.

@jtran56
Copy link

jtran56 commented Dec 21, 2020

Filed as internal issue #USD-6519

@sunyab
Copy link
Contributor

sunyab commented Jul 16, 2021

I believe this was fixed with commit dd436cb in the 21.05 release. Closing this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants