distutils-r1.eclass: mkdir ${BUILD_DIR}/lib
authorMike Gilbert <floppym@gentoo.org>
Sat, 12 Sep 2015 23:59:55 +0000 (19:59 -0400)
committerMike Gilbert <floppym@gentoo.org>
Sun, 13 Sep 2015 00:01:25 +0000 (20:01 -0400)
Bug: https://bugs.gentoo.org/559644

eclass/distutils-r1.eclass

index 3182e98d0376355dd39f3842427a1f10fb2116ab..185dd4fb80e4cce577d0ca6673fdf2b171c55d13 100644 (file)
@@ -607,6 +607,14 @@ distutils-r1_run_phase() {
        fi
        local -x PYTHONPATH="${BUILD_DIR}/lib:${PYTHONPATH}"
 
+       # Bug 559644
+       # using PYTHONPATH when the ${BUILD_DIR}/lib is not created yet might lead to
+       # problems in setup.py scripts that try to import modules/packages from that path
+       # during the build process (Python at startup evaluates PYTHONPATH, if the dir is
+       # not valid then associates a NullImporter object to ${BUILD_DIR}/lib storing it
+       # in the sys.path_importer_cache)
+       mkdir -p "${BUILD_DIR}/lib" || die
+
        # We need separate home for each implementation, for .pydistutils.cfg.
        if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
                local -x HOME=${HOME}/${EPYTHON}