-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Detect whether we are running in a Conda environment and adjust get_include() #1877
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
Conversation
…nclude accordingly
pybind11/__init__.py
Outdated
@@ -9,10 +9,18 @@ def get_include(user=False): | |||
# Are we running in a virtual environment? | |||
virtualenv = hasattr(sys, 'real_prefix') or \ | |||
sys.prefix != getattr(sys, "base_prefix", sys.prefix) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the PEP8 check fails since this empty line contains whitespaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Hi @sdebionne, @ax3l, this looks reasonable -- do you want me to merge it, or should I wait until it is proven to work in an actual CI build (as suggested by @ax3l here: conda-forge/pybind11-feedstock#32 (comment)) Thanks, |
I added the current PR's changeset to the conda-forge feedstock now. |
@@ -10,9 +10,17 @@ def get_include(user=False): | |||
virtualenv = hasattr(sys, 'real_prefix') or \ | |||
sys.prefix != getattr(sys, "base_prefix", sys.prefix) | |||
|
|||
# Are we running in a conda environment? | |||
conda = os.path.exists(os.path.join(sys.prefix, 'conda-meta')) | |||
|
|||
if virtualenv: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sdebionne maybe that's a stupid question but let me ask it anyway:
can one be inside conda and therein as well within a virtualenv? Not that I would do that... conda has its one environments. But if so, how to handle this gracefully (or does this already work)? Or shall we just not support such a constellation?
(The opposite case is not possible, I guess.)
As the tests turned out, the @wjakob ready for merge :) |
Okay, merged then. |
btw: I assume that you'll want this PR to be included in the next patch release 2.3.1, right? |
Yes, please :) |
Try to address this issue with the conda-forge feedstock.
For the records, Conda packages install headers in
prefix/include
on Linux andprefix\Library\include
on Windows.