From 80e33d3a016ca5789b9b27072b7edfd8492c4a70 Mon Sep 17 00:00:00 2001
From: Christoph Groth <christoph.groth@cea.fr>
Date: Wed, 13 Feb 2013 14:28:15 +0100
Subject: [PATCH] setup.py: automatize discovery of pure Python packages and
 tests

---
 setup.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/setup.py b/setup.py
index 5ada1978..2c63448b 100755
--- a/setup.py
+++ b/setup.py
@@ -164,6 +164,12 @@ def version():
     return version
 
 
+def packages():
+    return [root.replace('/', '.')
+            for root, dnames, fnames in os.walk('kwant')
+            if '__init__.py' in fnames or root.endswith('/tests')]
+
+
 def debian_mumps():
     """Return the configuration for debian-provided MUMPS if it is available,
     or an empty dictionary otherwise."""
@@ -332,11 +338,7 @@ def main():
           "quantum transport calculations.",
           url="http://kwant-project.org/",
           license="BSD",
-          packages=["kwant", "kwant.graph", "kwant.linalg", "kwant.physics",
-                    "kwant.solvers", "kwant.contrib",
-                    "kwant.tests", "kwant.graph.tests", "kwant.linalg.tests",
-                    "kwant.physics.tests", "kwant.solvers.tests",
-                    "kwant.contrib.tests"],
+          packages=packages(),
           cmdclass={'build': kwant_build,
                     'sdist': kwant_sdist,
                     'build_ext': kwant_build_ext,
-- 
GitLab