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

better detection of python lib / include dirs in build_usd.py #1692

Merged

Conversation

pmolodo
Copy link
Contributor

@pmolodo pmolodo commented Nov 25, 2021

Description of Change(s)

This addresses two issues:

  • Building using a venv-installed python

    • The venv-installed pythons would try to pull the libraries from
      the venv-directory, when they only reside at the "original"
      installed python location
  • Building with a python that was moved after building on Linux

    • We experienced issues where the INCLUDEPY and LIBDIR sysconfig
      vars were baked at build time. Thus these would no longer be
      reliable if running a python executable that was moved to a
      different location after building.

Note that on python-2.7, installed_base doesn't exist, so we fall back
to base. Also we fall back to INCLUDEPY and LIBDIR if the
installed_base / base method doesn't work, so this should be fairly
backward compatible.

@jilliene
Copy link

Filed as internal issue #USD-7040

@pmolodo
Copy link
Contributor Author

pmolodo commented Jan 7, 2022

Any word on this PR? I understand that it might be hard to test, but the various isdir checks should ensure it falls back to old behavior if needed.

@sunyab sunyab changed the base branch from release to dev January 8, 2022 00:00
Copy link
Contributor

@sunyab sunyab left a comment

Choose a reason for hiding this comment

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

I tested this out in a few places -- on Windows this seems to work great and fixes venv-related build issues reported elsewhere (#1542, for example). However on my Linux workstation it doesn't give me the right results. I left a comment below with further details.

build_scripts/build_usd.py Outdated Show resolved Hide resolved
This addresses two issues:

- Building using a venv-installed python
  - The venv-installed pythons would try to pull the libraries from
    the venv-directory, when they only reside at the "original"\
    installed python location

- Building with a python that was moved after building on Linux
  - We experienced issues where the `INCLUDEPY` and `LIBDIR` sysconfig
    vars were baked at build time.  Thus these would no longer be
    reliable if running a python executable that was moved to a
    different location after building.

Note that or python-2.7, `installed_base` doesn't exist, so we fall back
to `base`.  This should be fairly backward-compatible, as we check if
the dir (for include) or file (for lib) doesn't exist, and try alternate
methods if not.
@pmolodo pmolodo force-pushed the pr/build_usd_GetPythonInfo branch from 7f388b0 to 535f6da Compare March 4, 2022 01:36
@pmolodo pmolodo requested a review from sunyab March 9, 2022 01:28
@pixar-oss pixar-oss merged commit 4390254 into PixarAnimationStudios:dev Jun 2, 2022
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

Successfully merging this pull request may close these issues.

4 participants