1. Filip Wasilewski
  2. pywt

Commits

Filip Wasilewski  committed 9dbdcd9

Added checks to sdist command.

Make sure that the generated .c files are in sync with .pyx files.

  • Participants
  • Parent commits 9eafb49
  • Branches default

Comments (0)

Files changed (1)

File util/commands.py

View file
 import sys
 from distutils.command.build_ext import build_ext as build_ext_distutils
 from distutils.command.sdist import sdist as sdist_distutils
+from distutils.errors import DistutilsClassError
 
 from util import templating
 
 
 
 class SdistCommand(sdist_distutils):
+
+    def initialize_options(self):
+        sdist_distutils.initialize_options(self)
+        self._pyx = []
+        for root, dirs, files in os.walk("src"):
+            for f in files:
+                if f.endswith(".pyx"):
+                    self._pyx.append(os.path.join(root, f))
+
     def run(self):
         self.force_manifest = 1
+        for pyx_file in self._pyx:
+            c_file = replace_extension(pyx_file, ".c")
+
+            if not os.path.exists(c_file):
+                raise DistutilsClassError(
+                    "C-source file '{0}' not found.".format(c_file))
+
+            if is_newer(pyx_file, c_file):
+                raise DistutilsClassError(
+                    "C-source file '{0}' seems out of date compared to '{1}'.".format(
+                        c_file, pyx_file))
+
         sdist_distutils.run(self)