Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH 1/3] dev-lang/python: Add symlinks for python-exec wrapping of execs
Date: Sun, 15 Nov 2015 09:44:41
Message-Id: 1447580661-18170-2-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCHES] Ebuild patches for python-exec wrapping of dev-lang/python by "Michał Górny"
1 Add symlinks to make it possible to wrap Python executable aliases
2 (python, python-config, pydoc...) via python-exec.
3 ---
4 dev-lang/python/python-2.7.10-r3.ebuild | 21 ++++++++++++++++++++-
5 dev-lang/python/python-3.3.5-r3.ebuild | 23 ++++++++++++++++++++++-
6 dev-lang/python/python-3.4.3-r3.ebuild | 23 ++++++++++++++++++++++-
7 dev-lang/python/python-3.5.0-r2.ebuild | 23 ++++++++++++++++++++++-
8 profiles/package.mask | 1 +
9 5 files changed, 87 insertions(+), 4 deletions(-)
10
11 diff --git a/dev-lang/python/python-2.7.10-r3.ebuild b/dev-lang/python/python-2.7.10-r3.ebuild
12 index 4fae1b5..2158a54 100644
13 --- a/dev-lang/python/python-2.7.10-r3.ebuild
14 +++ b/dev-lang/python/python-2.7.10-r3.ebuild
15 @@ -304,7 +304,7 @@ src_install() {
16 -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
17
18 # for python-exec
19 - local vars=( EPYTHON PYTHON_SITEDIR )
20 + local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR )
21
22 # if not using a cross-compiler, use the fresh binary
23 if ! tc-is-cross-compiler; then
24 @@ -317,6 +317,25 @@ src_install() {
25 python_export "python${SLOT}" "${vars[@]}"
26 echo "EPYTHON='${EPYTHON}'" > epython.py || die
27 python_domodule epython.py
28 +
29 + # python-exec wrapping support
30 + local pymajor=${SLOT%.*}
31 + mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die
32 + # python and pythonX
33 + ln -s "../../../bin/python${SLOT}" \
34 + "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die
35 + ln -s "python${pymajor}" \
36 + "${D}${PYTHON_SCRIPTDIR}/python" || die
37 + # python-config and pythonX-config
38 + ln -s "../../../bin/python${SLOT}-config" \
39 + "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
40 + ln -s "python${pymajor}-config" \
41 + "${D}${PYTHON_SCRIPTDIR}/python-config" || die
42 + # 2to3, pydoc, pyvenv
43 + ln -s "../../../bin/2to3-${SLOT}" \
44 + "${D}${PYTHON_SCRIPTDIR}/2to3" || die
45 + ln -s "../../../bin/pydoc${SLOT}" \
46 + "${D}${PYTHON_SCRIPTDIR}/pydoc" || die
47 }
48
49 pkg_preinst() {
50 diff --git a/dev-lang/python/python-3.3.5-r3.ebuild b/dev-lang/python/python-3.3.5-r3.ebuild
51 index 3049ce1..9b0e261 100644
52 --- a/dev-lang/python/python-3.3.5-r3.ebuild
53 +++ b/dev-lang/python/python-3.3.5-r3.ebuild
54 @@ -291,7 +291,7 @@ src_install() {
55 -i "${ED}etc/conf.d/pydoc-${PYVER}" "${ED}etc/init.d/pydoc-${PYVER}" || die "sed failed"
56
57 # for python-exec
58 - local vars=( EPYTHON PYTHON_SITEDIR )
59 + local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR )
60
61 # if not using a cross-compiler, use the fresh binary
62 if ! tc-is-cross-compiler; then
63 @@ -304,6 +304,27 @@ src_install() {
64 python_export "python${PYVER}" "${vars[@]}"
65 echo "EPYTHON='${EPYTHON}'" > epython.py || die
66 python_domodule epython.py
67 +
68 + # python-exec wrapping support
69 + local pymajor=${PYVER%.*}
70 + mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die
71 + # python and pythonX
72 + ln -s "../../../bin/${abiver}" \
73 + "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die
74 + ln -s "python${pymajor}" \
75 + "${D}${PYTHON_SCRIPTDIR}/python" || die
76 + # python-config and pythonX-config
77 + ln -s "../../../bin/${abiver}-config" \
78 + "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
79 + ln -s "python${pymajor}-config" \
80 + "${D}${PYTHON_SCRIPTDIR}/python-config" || die
81 + # 2to3, pydoc, pyvenv
82 + ln -s "../../../bin/2to3-${PYVER}" \
83 + "${D}${PYTHON_SCRIPTDIR}/2to3" || die
84 + ln -s "../../../bin/pydoc${PYVER}" \
85 + "${D}${PYTHON_SCRIPTDIR}/pydoc" || die
86 + ln -s "../../../bin/pyvenv-${PYVER}" \
87 + "${D}${PYTHON_SCRIPTDIR}/pyvenv" || die
88 }
89
90 pkg_preinst() {
91 diff --git a/dev-lang/python/python-3.4.3-r3.ebuild b/dev-lang/python/python-3.4.3-r3.ebuild
92 index aaaa72a..526233a 100644
93 --- a/dev-lang/python/python-3.4.3-r3.ebuild
94 +++ b/dev-lang/python/python-3.4.3-r3.ebuild
95 @@ -274,7 +274,7 @@ src_install() {
96 -i "${ED}etc/conf.d/pydoc-${PYVER}" "${ED}etc/init.d/pydoc-${PYVER}" || die "sed failed"
97
98 # for python-exec
99 - local vars=( EPYTHON PYTHON_SITEDIR )
100 + local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR )
101
102 # if not using a cross-compiler, use the fresh binary
103 if ! tc-is-cross-compiler; then
104 @@ -287,6 +287,27 @@ src_install() {
105 python_export "python${PYVER}" "${vars[@]}"
106 echo "EPYTHON='${EPYTHON}'" > epython.py || die
107 python_domodule epython.py
108 +
109 + # python-exec wrapping support
110 + local pymajor=${PYVER%.*}
111 + mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die
112 + # python and pythonX
113 + ln -s "../../../bin/${abiver}" \
114 + "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die
115 + ln -s "python${pymajor}" \
116 + "${D}${PYTHON_SCRIPTDIR}/python" || die
117 + # python-config and pythonX-config
118 + ln -s "../../../bin/${abiver}-config" \
119 + "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
120 + ln -s "python${pymajor}-config" \
121 + "${D}${PYTHON_SCRIPTDIR}/python-config" || die
122 + # 2to3, pydoc, pyvenv
123 + ln -s "../../../bin/2to3-${PYVER}" \
124 + "${D}${PYTHON_SCRIPTDIR}/2to3" || die
125 + ln -s "../../../bin/pydoc${PYVER}" \
126 + "${D}${PYTHON_SCRIPTDIR}/pydoc" || die
127 + ln -s "../../../bin/pyvenv-${PYVER}" \
128 + "${D}${PYTHON_SCRIPTDIR}/pyvenv" || die
129 }
130
131 pkg_preinst() {
132 diff --git a/dev-lang/python/python-3.5.0-r2.ebuild b/dev-lang/python/python-3.5.0-r2.ebuild
133 index caa9e35..b2b50a1 100644
134 --- a/dev-lang/python/python-3.5.0-r2.ebuild
135 +++ b/dev-lang/python/python-3.5.0-r2.ebuild
136 @@ -277,7 +277,7 @@ src_install() {
137 -i "${ED}etc/conf.d/pydoc-${PYVER}" "${ED}etc/init.d/pydoc-${PYVER}" || die "sed failed"
138
139 # for python-exec
140 - local vars=( EPYTHON PYTHON_SITEDIR )
141 + local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR )
142
143 # if not using a cross-compiler, use the fresh binary
144 if ! tc-is-cross-compiler; then
145 @@ -290,6 +290,27 @@ src_install() {
146 python_export "python${PYVER}" "${vars[@]}"
147 echo "EPYTHON='${EPYTHON}'" > epython.py || die
148 python_domodule epython.py
149 +
150 + # python-exec wrapping support
151 + local pymajor=${PYVER%.*}
152 + mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die
153 + # python and pythonX
154 + ln -s "../../../bin/${abiver}" \
155 + "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die
156 + ln -s "python${pymajor}" \
157 + "${D}${PYTHON_SCRIPTDIR}/python" || die
158 + # python-config and pythonX-config
159 + ln -s "../../../bin/${abiver}-config" \
160 + "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
161 + ln -s "python${pymajor}-config" \
162 + "${D}${PYTHON_SCRIPTDIR}/python-config" || die
163 + # 2to3, pydoc, pyvenv
164 + ln -s "../../../bin/2to3-${PYVER}" \
165 + "${D}${PYTHON_SCRIPTDIR}/2to3" || die
166 + ln -s "../../../bin/pydoc${PYVER}" \
167 + "${D}${PYTHON_SCRIPTDIR}/pydoc" || die
168 + ln -s "../../../bin/pyvenv-${PYVER}" \
169 + "${D}${PYTHON_SCRIPTDIR}/pyvenv" || die
170 }
171
172 pkg_preinst() {
173 diff --git a/profiles/package.mask b/profiles/package.mask
174 index a549fd8..c798071 100644
175 --- a/profiles/package.mask
176 +++ b/profiles/package.mask
177 @@ -45,6 +45,7 @@ sci-chemistry/pymol-apbs-plugin
178 # Michał Górny <mgorny@g.o> (11 Nov 2015)
179 # Cleaned up Python versions masked for testing:
180 # - python-config-X.Y compatibility removed,
181 +# - python-exec symlinks added (to replace eselect-python's wrapper),
182 # - ABIFLAGS reintroduced for 3.3+.
183 # Resulting API/ABI change can break reverse dependencies, especially
184 # if upstream hardcodes paths or library names.
185 --
186 2.6.3