1 |
This has the advantage of not force-calling build in every setup.py |
2 |
invocation. |
3 |
--- |
4 |
gx86/eclass/distutils-r1.eclass | 67 ++++++++++++++++++++--------------------- |
5 |
1 file changed, 32 insertions(+), 35 deletions(-) |
6 |
|
7 |
diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass |
8 |
index 153a12e..2c8c5c8 100644 |
9 |
--- a/gx86/eclass/distutils-r1.eclass |
10 |
+++ b/gx86/eclass/distutils-r1.eclass |
11 |
@@ -215,45 +215,13 @@ fi |
12 |
# |
13 |
# setup.py will be passed the following, in order: |
14 |
# 1. ${mydistutilsargs[@]} |
15 |
-# 2. The 'build' command and standard build options including ${BUILD_DIR} |
16 |
-# 3. Any additional arguments passed to the esetup.py function. |
17 |
+# 2. additional arguments passed to the esetup.py function. |
18 |
# |
19 |
# This command dies on failure. |
20 |
esetup.py() { |
21 |
debug-print-function ${FUNCNAME} "${@}" |
22 |
|
23 |
- local add_args=() |
24 |
- if [[ ${BUILD_DIR} ]]; then |
25 |
- add_args+=( |
26 |
- build |
27 |
- --build-base "${BUILD_DIR}" |
28 |
- |
29 |
- # using a single directory for them helps us export |
30 |
- # ${PYTHONPATH} and ebuilds find the sources independently |
31 |
- # of whether the package installs extensions or not |
32 |
- # |
33 |
- # note: due to some packages (wxpython) relying on separate |
34 |
- # platlib & purelib dirs, we do not set --build-lib (which |
35 |
- # can not be overriden with --build-*lib) |
36 |
- --build-platlib "${BUILD_DIR}/lib" |
37 |
- --build-purelib "${BUILD_DIR}/lib" |
38 |
- |
39 |
- # make the ebuild writer lives easier |
40 |
- --build-scripts "${BUILD_DIR}/scripts" |
41 |
- ) |
42 |
- |
43 |
- # if setuptools is used, adjust egg_info path as well |
44 |
- if "${PYTHON:-python}" setup.py --help egg_info &>/dev/null; then |
45 |
- add_args+=( |
46 |
- egg_info --egg-base "${BUILD_DIR}" |
47 |
- ) |
48 |
- fi |
49 |
- elif [[ ! ${DISTUTILS_IN_SOURCE_BUILD} ]]; then |
50 |
- die 'Out-of-source build requested, yet BUILD_DIR unset.' |
51 |
- fi |
52 |
- |
53 |
- set -- "${PYTHON:-python}" setup.py \ |
54 |
- "${mydistutilsargs[@]}" "${add_args[@]}" "${@}" |
55 |
+ set -- "${PYTHON:-python}" setup.py "${mydistutilsargs[@]}" "${@}" |
56 |
|
57 |
echo "${@}" >&2 |
58 |
"${@}" || die |
59 |
@@ -374,6 +342,34 @@ distutils-r1_python_configure() { |
60 |
: |
61 |
} |
62 |
|
63 |
+# @FUNCTION: _distutils-r1_create_setup_cfg |
64 |
+# @INTERNAL |
65 |
+# @DESCRIPTION: |
66 |
+# Create implementation-specific configuration file for distutils, |
67 |
+# setting proper build-dir paths. |
68 |
+_distutils-r1_create_setup_cfg() { |
69 |
+ cat >> "${HOME}"/.pydistutils.cfg <<-_EOF_ || die |
70 |
+ [build] |
71 |
+ build-base = ${BUILD_DIR} |
72 |
+ |
73 |
+ # using a single directory for them helps us export |
74 |
+ # ${PYTHONPATH} and ebuilds find the sources independently |
75 |
+ # of whether the package installs extensions or not |
76 |
+ # |
77 |
+ # note: due to some packages (wxpython) relying on separate |
78 |
+ # platlib & purelib dirs, we do not set --build-lib (which |
79 |
+ # can not be overriden with --build-*lib) |
80 |
+ build-platlib = %(build-base)s/lib |
81 |
+ build-purelib = %(build-base)s/lib |
82 |
+ |
83 |
+ # make the ebuild writer lives easier |
84 |
+ build-scripts = %(build-base)s/scripts |
85 |
+ |
86 |
+ [egg_info] |
87 |
+ egg-base = ${BUILD_DIR} |
88 |
+ _EOF_ |
89 |
+} |
90 |
+ |
91 |
# @FUNCTION: _distutils-r1_copy_egg_info |
92 |
# @INTERNAL |
93 |
# @DESCRIPTION: |
94 |
@@ -395,9 +391,10 @@ _distutils-r1_copy_egg_info() { |
95 |
distutils-r1_python_compile() { |
96 |
debug-print-function ${FUNCNAME} "${@}" |
97 |
|
98 |
+ _distutils-r1_create_setup_cfg |
99 |
_distutils-r1_copy_egg_info |
100 |
|
101 |
- esetup.py "${@}" |
102 |
+ esetup.py build "${@}" |
103 |
} |
104 |
|
105 |
# @FUNCTION: distutils-r1_python_test |
106 |
-- |
107 |
1.8.3.2 |