From 6c68346411b4ca73662924d4913cbc0bd15a4d1a Mon Sep 17 00:00:00 2001 From: Christoph Groth <christoph.groth@cea.fr> Date: Sun, 18 Nov 2012 10:41:18 +0100 Subject: [PATCH] make the setup.py command sdist more robust --- setup.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/setup.py b/setup.py index e1a5f2dc..c35fc091 100755 --- a/setup.py +++ b/setup.py @@ -18,6 +18,7 @@ from distutils.core import setup, Command from distutils.extension import Extension from distutils.errors import DistutilsError, CCompilerError from distutils.command.build import build as distutils_build +from distutils.command.sdist import sdist as distutils_sdist import numpy try: @@ -89,6 +90,15 @@ class kwant_build(distutils_build): pass +# Make the command "sdist" depend on "build". This verifies that the +# distribution in the current state actually builds. It also makes sure that +# the Cython-made C files and the tutorial will be included in the source +# distribution and that they will be up-to-date. +class kwant_sdist(distutils_sdist): + sub_commands = [('build', None)] + distutils_sdist.sub_commands + pass + + # This is an exact copy of the function from kwant/version.py. We can't import # it here (because kwant is not yet built when this scipt is run), so we just # include a copy. @@ -315,6 +325,7 @@ def main(): packages=["kwant", "kwant.graph", "kwant.linalg", "kwant.physics", "kwant.solvers"], cmdclass={'build': kwant_build, + 'sdist': kwant_sdist, 'build_ext': kwant_build_ext, 'build_tut': build_tut}, ext_modules=ext_modules(extensions()), -- GitLab