[Pyrex] Dangerous weirdness happening

Michael P. Dubner pywebmail at list.ru
Wed Oct 1 02:32:13 CEST 2003


You can alternatively use somthing like following to unbind your user 
from Pyrex (and distribute .c files intead of binaries):
---------------------------------------------------------- setup.py
try:
  from Pyrex.Distutils import build_ext
except:
  import os
  import distutils.command.build_ext
  from distutils.dep_util import newer
  class build_ext(distutils.command.build_ext.build_ext):
    def swig_sources(self, sources):
      if not self.extensions:
        return
      new_sources = []
      extension = self.swig_cpp and '.cpp' or '.c'
      for source in sources:
        if os.path.splitext(source)[1] != '.pyx':
          new_sources.append(source)
          continue
        # should I raise an exception if it doesn't exist?
        target = os.path.splitext(source)[0] + extension
        new_sources.append(target)
        if newer(source, target):
          self.warn("Warning: %s newer than %s, but pyrex needed to 
recompile it not found" % (source, target))
        elif self.force:
          self.warn("Warning: pyrex needed to recompile %s from %s but 
it's not found" % (source, target))
      return new_sources
--------------------------------------------------------------

--
Best regards
Michael Dubner
PS: Sorry for my English








More information about the Pyrex mailing list