[Python-checkins] CVS: distutils/distutils/command bdist_rpm.py,1.11,1.12

Greg Ward python-dev@python.org
Sun, 4 Jun 2000 08:30:37 -0700


Update of /cvsroot/python/distutils/distutils/command
In directory slayer.i.sourceforge.net:/tmp/cvs-serv20334

Modified Files:
	bdist_rpm.py 
Log Message:
Fixed syntax error.
Half-fixed RPM 2 compatibility:added 'rpm_base' option, which must be set
  (to eg. /usr/src/redhat on a stock Red Hat system) if rpm2_mode is on.
  Still not quite working, though.


Index: bdist_rpm.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/command/bdist_rpm.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** bdist_rpm.py	2000/06/04 15:00:34	1.11
--- bdist_rpm.py	2000/06/04 15:30:35	1.12
***************
*** 6,10 ****
  # created 2000/04/25, by Harry Henry Gebel
  
! __revision__ = "$Id: bdist_rpm.py,v 1.11 2000/06/04 15:00:34 gward Exp $"
  
  import os, string
--- 6,10 ----
  # created 2000/04/25, by Harry Henry Gebel
  
! __revision__ = "$Id: bdist_rpm.py,v 1.12 2000/06/04 15:30:35 gward Exp $"
  
  import os, string
***************
*** 19,24 ****
  
      user_options = [
!         ('bdist-base', None,
           "base directory for creating built distributions"),
          ('spec-only', None,
           "only regenerate spec file"),
--- 19,27 ----
  
      user_options = [
!         ('bdist-base=', None,
           "base directory for creating built distributions"),
+         ('rpm-base=', None,
+          "base directory for creating RPMs (defaults to \"rpm\" under "
+          "--bdist-base; must be specified for RPM 2)"),
          ('spec-only', None,
           "only regenerate spec file"),
***************
*** 105,108 ****
--- 108,112 ----
      def initialize_options (self):
          self.bdist_base = None
+         self.rpm_base = None
          self.spec_only = None
          self.binary_only = None
***************
*** 144,147 ****
--- 148,157 ----
      def finalize_options (self):
          self.set_undefined_options('bdist', ('bdist_base', 'bdist_base'))
+         if self.rpm_base is None:
+             if not self.rpm3_mode:
+                 raise DistutilsOptionError, \
+                       "you must specify --rpm-base in RPM 2 mode"
+             self.rpm_base = os.path.join(self.bdist_base, "rpm")
+ 
          if os.name != 'posix':
              raise DistutilsPlatformError, \
***************
*** 219,230 ****
              self.mkpath(spec_dir)       # XXX should be configurable
          else:
-             if self.rpm3_mode:
-                 rpm_base = os.path.join(self.bdist_base, "rpm")
-             else:
-                 # complete path must be specified in RPM 2 mode
-                 rpm_base = self.bdist_base
              rpm_dir = {}
              for d in ('SOURCES', 'SPECS', 'BUILD', 'RPMS', 'SRPMS'):
!                 rpm_dir[d] = os.path.join(rpm_base, d)
                  self.mkpath(rpm_dir[d])
              spec_dir = rpm_dir['SPECS']
--- 229,235 ----
              self.mkpath(spec_dir)       # XXX should be configurable
          else:
              rpm_dir = {}
              for d in ('SOURCES', 'SPECS', 'BUILD', 'RPMS', 'SRPMS'):
!                 rpm_dir[d] = os.path.join(self.rpm_base, d)
                  self.mkpath(rpm_dir[d])
              spec_dir = rpm_dir['SPECS']
***************
*** 274,278 ****
          if self.rpm3_mode:
              rpm_args.extend(['--define',
!                              '_topdir %s/%s' % (os.getcwd(), rpm_base),])
          if self.clean:
              rpm_args.append('--clean')
--- 279,283 ----
          if self.rpm3_mode:
              rpm_args.extend(['--define',
!                              '_topdir %s/%s' % (os.getcwd(), self.rpm_base),])
          if self.clean:
              rpm_args.append('--clean')
***************
*** 392,396 ****
              ('post', 'post_install', None),
              ('preun', 'pre_uninstall', None),
!             ('postun', 'post_uninstall', None))
          ]
  
--- 397,401 ----
              ('post', 'post_install', None),
              ('preun', 'pre_uninstall', None),
!             ('postun', 'post_uninstall', None),
          ]