commit:     4f199a1b382c23a77172756892b41bc066d66f89
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Thu May 19 10:52:43 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Sep 14 21:53:47 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4f199a1b

setup.py: add stub for building custom modules in C/C++

Currently portage doesn't include any custom modules written in C/C++.
This commit introduces stub code for building such modules in setup.py.

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 setup.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index 2220d23..8d20355 100755
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@
 
 from __future__ import print_function
 
-from distutils.core import setup, Command
+from distutils.core import setup, Command, Extension
 from distutils.command.build import build
 from distutils.command.build_scripts import build_scripts
 from distutils.command.clean import clean
@@ -30,6 +30,9 @@ import sys
 # TODO:
 # - smarter rebuilds of docs w/ 'install_docbook' and 'install_epydoc'.
 
+# Dictionary of scripts.  The structure is
+#   key   = location in filesystem to install the scripts
+#   value = list of scripts, path relative to top source directory
 x_scripts = {
        'bin': [
                'bin/ebuild', 'bin/egencache', 'bin/emerge', 
'bin/emerge-webrsync',
@@ -41,6 +44,10 @@ x_scripts = {
        ],
 }
 
+# Dictionary custom modules written in C/C++ here.  The structure is
+#   key   = module name
+#   value = list of C/C++ source code, path relative to top source directory
+x_c_helpers = {}
 
 class x_build(build):
        """ Build command with extra build_man call. """
@@ -636,6 +643,8 @@ setup(
                ['$sysconfdir/portage/repo.postsync.d', 
['cnf/repo.postsync.d/example']],
        ],
 
+       ext_modules = [Extension(name=n, sources=m) for n, m in 
x_c_helpers.items()],
+
        cmdclass = {
                'build': x_build,
                'build_man': build_man,

Reply via email to