Skip to content

Commit c85c1c9

Browse files
authored
Link python*-config into VE (#460)
Required to build binaries that link against Python. Carl Meyer, the champion for PEP 0405, has confirmed that there isn't a particular reason why `venv` doesn't do that.
1 parent cd6a51a commit c85c1c9

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

bin/pyenv-virtualenv

+9
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,15 @@ else
600600
fi
601601
fi
602602

603+
(
604+
shopt -s nullglob
605+
for extra_binary in "$PREFIX"/bin/python*-config; do
606+
extra_binary_linkname="$VIRTUALENV_PATH/bin/$(basename $extra_binary)"
607+
[[ -e "$extra_binary_linkname" ]] || \
608+
ln -s "$extra_binary" "$extra_binary_linkname"
609+
done
610+
)
611+
603612
## Create symlink in the `versions` directory for backward compatibility
604613
if [ -d "${VIRTUALENV_PATH}" ] && [ -n "${COMPAT_VIRTUALENV_PATH}" ]; then
605614
ln -fs "${VIRTUALENV_PATH}" "${COMPAT_VIRTUALENV_PATH}"

test/virtualenv.bats

+7-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ unstub_pyenv() {
2929
stub pyenv-exec "python2.7 -m venv --help : false"
3030
stub pyenv-exec "python2 -m venv --help : false"
3131
stub pyenv-exec "python -m venv --help : false"
32-
stub pyenv-exec "virtualenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
32+
stub pyenv-exec "virtualenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\"; mkdir -p \"\$2/bin\""
3333
stub pyenv-exec "python -s -m ensurepip : false"
3434
stub pyenv-exec "python -s */get-pip.py : true"
3535
stub curl true
36+
create_executable "${PYENV_VERSION}" "python-config"
37+
create_executable "${PYENV_VERSION}" "python2-config"
38+
create_executable "${PYENV_VERSION}" "python2.7-config"
3639

3740
run pyenv-virtualenv "2.7.11" "venv"
3841

@@ -41,8 +44,10 @@ PYENV_VERSION=2.7.11 virtualenv ${PYENV_ROOT}/versions/2.7.11/envs/venv
4144
Installing pip from https://bootstrap.pypa.io/pip/2.7/get-pip.py...
4245
rehashed
4346
OUT
44-
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
4547
assert_success
48+
for x in pydoc python-config python2-config python2.7-config; do
49+
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/$x" ]
50+
done
4651

4752
unstub_pyenv
4853
unstub pyenv-virtualenv-prefix

0 commit comments

Comments
 (0)