Reject creating a virtualenv named system (yyuu/pyenv#475)

This commit is contained in:
Yamashita, Yuu
2015-11-08 23:44:58 +00:00
parent 6ac8afbcff
commit c1b9238cbe
2 changed files with 14 additions and 0 deletions

View File

@@ -273,6 +273,11 @@ if [ -z "${VERSION_NAME}" ] || [ -z "${VIRTUALENV_NAME}" ]; then
usage 1 usage 1
fi fi
if [[ "$VIRTUALENV_NAME" == "system" ]]; then
echo "pyenv-virtualenv: \`system' is not allowed as virtualenv name." 1>&2
exit 1
fi
if [ "$VIRTUALENV_NAME" != "${VIRTUALENV_NAME%[[:space:]]*}" ]; then if [ "$VIRTUALENV_NAME" != "${VIRTUALENV_NAME%[[:space:]]*}" ]; then
echo "pyenv-virtualenv: no whitespace allowed in virtualenv name." 1>&2 echo "pyenv-virtualenv: no whitespace allowed in virtualenv name." 1>&2
exit 1 exit 1

View File

@@ -135,3 +135,12 @@ OUT
pyenv-virtualenv: no whitespace allowed in virtualenv name. pyenv-virtualenv: no whitespace allowed in virtualenv name.
OUT OUT
} }
@test "system not allowed as virtualenv name" {
run pyenv-virtualenv "3.2.1" "system"
assert_failure
assert_output <<OUT
pyenv-virtualenv: \`system' is not allowed as virtualenv name.
OUT
}