-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
Description
What's the problem this feature will solve?
pkg-config doesn't recognize packages that are installed in a virtual environment
Describe the solution you'd like
A solution was proposed 5 years ago in #1159 which was closed for being stale. The changes proposed here (for Bash, I'm unfamiliar with any other shells so I can't attest to how those would be configured):
diff --git a/virtualenv_embedded/activate.sh b/virtualenv_embedded/activate.sh
index 477b7ec..1a93da9 100644
--- a/virtualenv_embedded/activate.sh
+++ b/virtualenv_embedded/activate.sh
@@ -16,6 +16,11 @@ deactivate () {
export PYTHONHOME
unset _OLD_VIRTUAL_PYTHONHOME
fi
+ if ! [ -z "${_OLD_PKG_CONFIG_PATH+_}" ]; then
+ PKG_CONFIG_PATH="$_OLD_PKG_CONFIG_PATH"
+ export PKG_CONFIG_PATH
+ unset _OLD_PKG_CONFIG_PATH
+ fi
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
@@ -47,6 +52,10 @@ _OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/__BIN_NAME__:$PATH"
export PATH
+_OLD_PKG_CONFIG_PATH="${PKG_CONFIG_PATH}"
+PKG_CONFIG_PATH="${VIRTUAL_ENV}/lib/pkgconfig:${PKG_CONFIG_PATH}"
+export PKG_CONFIG_PATH
+
# unset PYTHONHOME if set
if ! [ -z "${PYTHONHOME+_}" ] ; then
_OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
This would work for libraries that use pkg-config for build/install (so far the only example I have is python-efl, possibly also Qt per this thread)
Alternative Solutions
I've tried adding the proposed modifications to {VIRTUALENV}/bin/activate
myself, it seems to function as intended.
Additional context