Skip to content
Snippets Groups Projects
Commit 6c683464 authored by Christoph Groth's avatar Christoph Groth
Browse files

make the setup.py command sdist more robust

parent c66173c3
No related branches found
No related tags found
No related merge requests found
......@@ -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()),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment