[Python-Dev] setup.py deleting files (Was: SSL support in _socket)

Michael Hudson mwh@python.net
01 Mar 2002 13:37:51 +0000


Martin von Loewis <loewis@informatik.hu-berlin.de> writes:

> Michael Hudson <mwh@python.net> writes:
> 
> > > Can we just rename them?  I.e. bsddbmodule-failed.so
> > 
> > So long as it's bsddbmodule_failed.so, +1.
> > 
> > It shouldn't be difficult.
> 
> +1.

It's about this hard, in fact:

Index: setup.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/setup.py,v
retrieving revision 1.82
diff -c -r1.82 setup.py
*** setup.py	16 Feb 2002 18:23:29 -0000	1.82
--- setup.py	1 Mar 2002 13:35:04 -0000
***************
*** 176,188 ****
          except ImportError, why:
  
              if 1:
!                 self.announce('*** WARNING: removing "%s" since importing it'
                                ' failed: %s' % (ext.name, why))
                  assert not self.inplace
!                 fullname = self.get_ext_fullname(ext.name)
!                 ext_filename = os.path.join(self.build_lib,
!                                             self.get_ext_filename(fullname))
!                 os.remove(ext_filename)
  
                  # XXX -- This relies on a Vile HACK in
                  # distutils.command.build_ext.build_extension().  The
--- 176,187 ----
          except ImportError, why:
  
              if 1:
!                 self.announce('*** WARNING: renaming "%s" since importing it'
                                ' failed: %s' % (ext.name, why))
                  assert not self.inplace
!                 basename, tail = os.path.splitext(ext_filename)
!                 newname = basename + "_failed" + tail
!                 os.rename(ext_filename, newname)
  
                  # XXX -- This relies on a Vile HACK in
                  # distutils.command.build_ext.build_extension().  The

One little point (or I'd have checked it in already): should we make
efforts to not install the _failed.so turds?

Cheers,
M.

-- 
  C is not clean -- the language has _many_ gotchas and traps, and
  although its semantics are _simple_ in some sense, it is not any
  cleaner than the assembly-language design it is based on.
                                        -- Erik Naggum, comp.lang.lisp