Skip to content

Commit

Permalink
Merge pull request #27 from VisionSystemsInc/venv_1949
Browse files Browse the repository at this point in the history
  • Loading branch information
andyneff committed Sep 28, 2020
2 parents 40f2f0d + 85176cb commit 7c3f883
Showing 1 changed file with 60 additions and 1 deletion.
61 changes: 60 additions & 1 deletion 30_get-pipenv
Original file line number Diff line number Diff line change
@@ -1,9 +1,65 @@
#!/usr/bin/env sh
#!/usr/bin/env bash

# This script should not be sourced, but called, or else bad things could happen.

#*# docker/recipes/get-pipenv

# Temp fix for https://github.com/pypa/virtualenv/issues/1949
if [ -f "${VSI_COMMON_DIR-}/linux/real_path" ]; then
source "${VSI_COMMON_DIR}/linux/real_path"
else
if command -v realpath > /dev/null 2>&1; then
function real_path()
{
realpath ${@+"${@}"}
}
elif readlink -f / > /dev/null 2>&1; then
function real_path()
{
readlink -f ${@+"${@}"}
}
else
function real_path()
{
for x in "${@}"; do
real_path_manual "${x}"
done
}
fi

function real_path_manual()
{
pushd "$(dirname "${1}")" &> /dev/null
local target="$(basename "${1}")"

while [ -L "$target" ]
do
target="$(readlink "$target")"
cd "$(dirname "${target}")"
target="$(basename "${target}")"
done

local physical_dir="$(pwd -P)"

if [ "${target}" = "." ]; then
target=""
else
target="/${target}"
fi
popd &> /dev/null

if [ "${physical_dir}" = "/" ]; then
if [ "${target}" = "//" ] || [ "${target}" = "" ]; then
echo /
else
echo "$target"
fi
else
echo "${physical_dir}$target"
fi
}
fi

#**
# .. default-domain:: bash
#
Expand Down Expand Up @@ -77,6 +133,9 @@ install_pipenv()
" "${virtualenv_pyz}"
fi

# Temp fix for https://github.com/pypa/virtualenv/issues/1949
virtualenv_pyz="$(real_path "${virtualenv_pyz}")"

# create output virtualenv
"${PIPENV_PYTHON}" "${virtualenv_pyz}" "${output_dir}"

Expand Down

0 comments on commit 7c3f883

Please sign in to comment.