diff --git a/setup.py b/setup.py
index e1a5f2dcb6ec4c2cd539a6a5c0d3e7766562a89a..c35fc091acc914f0a3a506c7bb8f314a1cd6dc9f 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()),