From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-portage-dev+bounces-5760-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 3BB19138262
	for <garchives@archives.gentoo.org>; Sun, 22 May 2016 17:05:08 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id B17CF234004;
	Sun, 22 May 2016 17:05:05 +0000 (UTC)
Received: from virtual.dyc.edu (mail.virtual.dyc.edu [67.222.116.22])
	by pigeon.gentoo.org (Postfix) with ESMTP id 3E94D234003
	for <gentoo-portage-dev@lists.gentoo.org>; Sun, 22 May 2016 17:05:05 +0000 (UTC)
Received: from opensource.dyc.edu (unknown [67.222.116.23])
	by virtual.dyc.edu (Postfix) with ESMTP id 944577E0018;
	Sun, 22 May 2016 13:05:04 -0400 (EDT)
Received: by opensource.dyc.edu (Postfix, from userid 1001)
	id D121E2B0010F; Sun, 22 May 2016 13:04:48 -0400 (EDT)
From: "Anthony G. Basile" <basile@opensource.dyc.edu>
To: gentoo-portage-dev@lists.gentoo.org
Cc: "Anthony G. Basile" <blueness@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH 1/2] setup.py: add stub for building custom modules in C/C++
Date: Sun, 22 May 2016 13:04:39 -0400
Message-Id: <1463936680-16072-1-git-send-email-basile@opensource.dyc.edu>
X-Mailer: git-send-email 1.7.6.1
Precedence: bulk
List-Post: <mailto:gentoo-portage-dev@lists.gentoo.org>
List-Help: <mailto:gentoo-portage-dev+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-portage-dev+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-portage-dev+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-portage-dev.gentoo.org>
X-BeenThere: gentoo-portage-dev@lists.gentoo.org
Reply-to: gentoo-portage-dev@lists.gentoo.org
X-Archives-Salt: 8df58560-03f8-419a-b89d-c1b1eaf67847
X-Archives-Hash: b96b86c7ac4707cdc293410159718224

From: "Anthony G. Basile" <blueness@gentoo.org>

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@gentoo.org>
---
 setup.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index 75c4bcb..25429bc 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,
-- 
2.7.3