[Distutils] Python interpreter path and bdist_rpm

Andrew Kuchling akuchlin@mems-exchange.org
Fri Sep 1 11:34:01 2000


The first Python interpreter on my path is in /www/python/bin.  I was
building some RPMs today where I wanted to use the interpreter that
comes with Red Hat, so I ran '/usr/bin/python1.5 setup.py bdist_rpm',
and found that the RPM build script just uses 'python', so it found
the first one on my path, which isn't the same as the one I wanted.

Question: should the RPM build script hard-core the full path of the
interpreter binary, or does it cause problems?  If specifying the full
path is OK, here's a patch.  (Harry, or someone else who knows RPM,
should approve of this patch before considering checking it in.)

--amk

Index: bdist_rpm.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_rpm.py,v
retrieving revision 1.17
diff -C2 -r1.17 bdist_rpm.py
*** bdist_rpm.py	2000/08/15 13:05:35	1.17
--- bdist_rpm.py	2000/09/01 15:28:35
***************
*** 8,12 ****
  __revision__ = "$Id: bdist_rpm.py,v 1.17 2000/08/15 13:05:35 gward Exp $"
  
! import os, string
  import glob
  from types import *
--- 8,12 ----
  __revision__ = "$Id: bdist_rpm.py,v 1.17 2000/08/15 13:05:35 gward Exp $"
  
! import os, string, sys
  import glob
  from types import *
***************
*** 400,406 ****
          # figure out default build script
          if self.use_rpm_opt_flags:
!             def_build = 'env CFLAGS="$RPM_OPT_FLAGS" python setup.py build'
          else:
!             def_build = 'python setup.py build'
          # insert contents of files
  
--- 400,407 ----
          # figure out default build script
          if self.use_rpm_opt_flags:
!             def_build = ('env CFLAGS="$RPM_OPT_FLAGS" %s setup.py build'
!                          % sys.executable )
          else:
!             def_build = '%s setup.py build' % sys.executable
          # insert contents of files