Fix PYTHONPATH adjustments to only insert a colon when necessary. This
authorZac Medico <zmedico@gentoo.org>
Sat, 13 Sep 2008 23:21:43 +0000 (23:21 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 13 Sep 2008 23:21:43 +0000 (23:21 -0000)
is necessary since having a stray colon causes python to interpret the
empty path entry as "." which triggers the following message if cwd
happens to contain a directory names "os":

 warning: Not importing directory 'os': missing __init__.py

Thanks to Joe Peterson <lavajoe@g.o> for reporting.

svn path=/main/trunk/; revision=11511

bin/ebuild.sh

index e45747d02a1583054319e1f709ff584ee512c74d..401303024d52dfe0a64952c51c47025e4e8d7c98 100755 (executable)
@@ -166,7 +166,7 @@ has_version() {
        fi
        # return shell-true/shell-false if exists.
        # Takes single depend-type atoms.
-       PYTHONPATH="${PORTAGE_PYM_PATH}:${PYTHONPATH}" \
+       PYTHONPATH="${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH}" \
        "${PORTAGE_BIN_PATH}"/portageq has_version "${ROOT}" "$1"
        local retval=$?
        case "${retval}" in
@@ -186,7 +186,7 @@ portageq() {
        if [ "${EBUILD_PHASE}" == "depend" ]; then
                die "portageq calls are not allowed in the global scope"
        fi
-       PYTHONPATH="${PORTAGE_PYM_PATH}:${PYTHONPATH}" \
+       PYTHONPATH="${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH}" \
        "${PORTAGE_BIN_PATH}/portageq" "$@"
 }
 
@@ -202,7 +202,7 @@ best_version() {
        fi
        # returns the best/most-current match.
        # Takes single depend-type atoms.
-       PYTHONPATH="${PORTAGE_PYM_PATH}:${PYTHONPATH}" \
+       PYTHONPATH="${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH}" \
        "${PORTAGE_BIN_PATH}/portageq" 'best_version' "${ROOT}" "$1"
        local retval=$?
        case "${retval}" in