1 |
Since the libc bindings don't support cross-compilation, add |
2 |
an option to enable them conditially. The ebuild can use this |
3 |
to enable the libc bindings by adding the following code to |
4 |
the python_prepare_all function: |
5 |
|
6 |
if use native-extensions; then |
7 |
printf "[build_ext]\nportage-ext-modules=true" >> \ |
8 |
setup.cfg || die |
9 |
fi |
10 |
|
11 |
X-Gentoo-Bug: 594744 |
12 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/594744 |
13 |
--- |
14 |
.travis.yml | 1 + |
15 |
setup.py | 20 ++++++++++++++++++++ |
16 |
2 files changed, 21 insertions(+) |
17 |
|
18 |
diff --git a/.travis.yml b/.travis.yml |
19 |
index c098c4d..ded5893 100644 |
20 |
--- a/.travis.yml |
21 |
+++ b/.travis.yml |
22 |
@@ -10,6 +10,7 @@ python: |
23 |
install: "pip install lxml" |
24 |
|
25 |
script: |
26 |
+ - printf "[build_ext]\nportage-ext-modules=true" >> setup.cfg |
27 |
- ./setup.py test |
28 |
- ./setup.py install --root=/tmp/install-root |
29 |
# prevent repoman tests from trying to fetch metadata.xsd |
30 |
diff --git a/setup.py b/setup.py |
31 |
index e900aaa..e1d21a0 100755 |
32 |
--- a/setup.py |
33 |
+++ b/setup.py |
34 |
@@ -6,6 +6,7 @@ from __future__ import print_function |
35 |
|
36 |
from distutils.core import setup, Command, Extension |
37 |
from distutils.command.build import build |
38 |
+from distutils.command.build_ext import build_ext as _build_ext |
39 |
from distutils.command.build_scripts import build_scripts |
40 |
from distutils.command.clean import clean |
41 |
from distutils.command.install import install |
42 |
@@ -624,6 +625,24 @@ def get_manpages(): |
43 |
yield [os.path.join('$mandir', topdir, 'man%s' % g), mans] |
44 |
|
45 |
|
46 |
+class build_ext(_build_ext): |
47 |
+ user_options = _build_ext.user_options + [ |
48 |
+ ('portage-ext-modules', None, |
49 |
+ "enable portage's C/C++ extensions (cross-compling is not supported)"), |
50 |
+ ] |
51 |
+ |
52 |
+ boolean_options = _build_ext.boolean_options + [ |
53 |
+ 'portage-ext-modules' |
54 |
+ ] |
55 |
+ |
56 |
+ def initialize_options(self): |
57 |
+ _build_ext.initialize_options(self) |
58 |
+ self.portage_ext_modules = None |
59 |
+ |
60 |
+ def run(self): |
61 |
+ if self.portage_ext_modules: |
62 |
+ _build_ext.run(self) |
63 |
+ |
64 |
setup( |
65 |
name = 'portage', |
66 |
version = '2.3.1', |
67 |
@@ -651,6 +670,7 @@ setup( |
68 |
|
69 |
cmdclass = { |
70 |
'build': x_build, |
71 |
+ 'build_ext': build_ext, |
72 |
'build_man': build_man, |
73 |
'build_scripts': x_build_scripts, |
74 |
'build_scripts_bin': x_build_scripts_bin, |
75 |
-- |
76 |
2.7.4 |