Gentoo Archives: gentoo-python

From: Mike Gilbert <floppym@g.o>
To: gentoo-python@l.g.o
Cc: python@g.o
Subject: [gentoo-python] [PATCH] distutils-r1: Move egg-base to ${BUILD_DIR}/egg-info and prepend to PYTHONPATH
Date: Sun, 19 Oct 2014 00:58:05
Message-Id: 1413680278-8109-1-git-send-email-floppym@gentoo.org
1 This resolves a testing failure in dev-python/cryptography-1.6.1.
2
3 cryptography.hazmat.backends._available_backends() scans the available
4 setuptools entry_points, and so depends on having a valid
5 egg-info/entry_points.txt file available.
6
7 Without this PYTHONPATH update, it uses the egg-info from ${S}, which is not
8 valid on Linux systems as shipped from upstream.
9
10 I move egg-base to a subdirectory of ${BUILD_DIR} to avoid adding ${BUILD_DIR}
11 to PYTHONPATH. This seems less likely to randomly break other packages.
12
13 --- a/eclass/distutils-r1.eclass
14 +++ b/eclass/distutils-r1.eclass
15 @@ -362,7 +362,7 @@
16 build-scripts = %(build-base)s/scripts
17
18 [egg_info]
19 - egg-base = ${BUILD_DIR}
20 + egg-base = ${BUILD_DIR}/eggs
21
22 # this is needed by distutils_install_for_testing since
23 # setuptools like to create .egg files for install --home.
24 @@ -397,9 +397,9 @@
25 # egg-base in esetup.py). This way, we respect whatever's in upstream
26 # egg-info.
27 _distutils-r1_copy_egg_info() {
28 - mkdir -p "${BUILD_DIR}" || die
29 + mkdir -p "${BUILD_DIR}/eggs" || die
30 # stupid freebsd can't do 'cp -t ${BUILD_DIR} {} +'
31 - find -name '*.egg-info' -type d -exec cp -pr {} "${BUILD_DIR}"/ ';' || die
32 + find -name '*.egg-info' -type d -exec cp -pr {} "${BUILD_DIR}/eggs"/ ';' || die
33 }
34
35 # @FUNCTION: distutils-r1_python_compile
36 @@ -605,7 +605,7 @@
37 fi
38 local BUILD_DIR=${BUILD_DIR}/build
39 fi
40 - local -x PYTHONPATH="${BUILD_DIR}/lib:${PYTHONPATH}"
41 + local -x PYTHONPATH="${BUILD_DIR}/eggs:${BUILD_DIR}/lib:${PYTHONPATH}"
42
43 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
44 local -x TMPDIR=${T}/${EPYTHON}

Replies