[Python-checkins] CVS: distutils/distutils/command bdist.py,1.8,1.9 bdist_dumb.py,1.6,1.7 bdist_rpm.py,1.2,1.3 build.py,1.21,1.22 build_ext.py,1.39,1.40 install.py,1.33,1.34 install_lib.py,1.24,1.25 install_scripts.py,1.6,1.7 sdist.py,1.20,1.21

Greg Ward python-dev@python.org
Sat, 27 May 2000 10:27:25 -0700


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

Modified Files:
	bdist.py bdist_dumb.py bdist_rpm.py build.py build_ext.py 
	install.py install_lib.py install_scripts.py sdist.py 
Log Message:
Some far-reaching naming changes:
  * Command method 'find_peer()' -> 'get_finalized_command()'
  * Command method 'run_peer()' -> 'run_command()'
Also deleted the 'get_command_option()' method from Command, and
  fixed the one place where it was used (in "bdist_dumb").


Index: bdist.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/command/bdist.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** bdist.py	2000/05/13 03:08:28	1.8
--- bdist.py	2000/05/27 17:27:23	1.9
***************
*** 6,10 ****
  # created 2000/03/29, Greg Ward
  
! __revision__ = "$Id: bdist.py,v 1.8 2000/05/13 03:08:28 greg Exp $"
  
  import os, string
--- 6,10 ----
  # created 2000/03/29, Greg Ward
  
! __revision__ = "$Id: bdist.py,v 1.9 2000/05/27 17:27:23 gward Exp $"
  
  import os, string
***************
*** 54,58 ****
          # "build/bdist.<plat>/dumb", "build/bdist.<plat>/rpm", etc.)
          if self.bdist_base is None:
!             build_base = self.find_peer('build').build_base
              plat = get_platform()
              self.bdist_base = os.path.join (build_base, 'bdist.' + plat)
--- 54,58 ----
          # "build/bdist.<plat>/dumb", "build/bdist.<plat>/rpm", etc.)
          if self.bdist_base is None:
!             build_base = self.get_finalized_command('build').build_base
              plat = get_platform()
              self.bdist_base = os.path.join (build_base, 'bdist.' + plat)
***************
*** 80,86 ****
  
          if cmd_name not in self.no_format_option:
!             sub_cmd = self.find_peer (cmd_name)
              sub_cmd.format = self.format
!         self.run_peer (cmd_name)
  
      # run()
--- 80,86 ----
  
          if cmd_name not in self.no_format_option:
!             sub_cmd = self.get_finalized_command (cmd_name)
              sub_cmd.format = self.format
!         self.run_command (cmd_name)
  
      # run()

Index: bdist_dumb.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/command/bdist_dumb.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** bdist_dumb.py	2000/05/23 01:55:01	1.6
--- bdist_dumb.py	2000/05/27 17:27:23	1.7
***************
*** 7,11 ****
  # created 2000/03/29, Greg Ward
  
! __revision__ = "$Id: bdist_dumb.py,v 1.6 2000/05/23 01:55:01 gward Exp $"
  
  import os
--- 7,11 ----
  # created 2000/03/29, Greg Ward
  
! __revision__ = "$Id: bdist_dumb.py,v 1.7 2000/05/27 17:27:23 gward Exp $"
  
  import os
***************
*** 41,45 ****
      def finalize_options (self):
          if self.bdist_dir is None:
!             bdist_base = self.get_peer_option('bdist', 'bdist_base')
              self.bdist_dir = os.path.join(bdist_base, 'dumb')
  
--- 41,45 ----
      def finalize_options (self):
          if self.bdist_dir is None:
!             bdist_base = self.get_finalized_command('bdist').bdist_base
              self.bdist_dir = os.path.join(bdist_base, 'dumb')
  
***************
*** 57,64 ****
      def run (self):
  
!         self.run_peer ('build')
  
!         # XXX don't use 'self.find_peer()', because it always runs
!         # 'ensure_ready()' on the command object; we explictly want a
          # command object that has *not* been finalized, so we can set
          # options on it!  (The option we set, 'root', is so that we can do
--- 57,64 ----
      def run (self):
  
!         self.run_command ('build')
  
!         # XXX don't use 'self.get_finalized_command()', because it always runs
!         # 'ensure_finalized()' on the command object; we explictly want a
          # command object that has *not* been finalized, so we can set
          # options on it!  (The option we set, 'root', is so that we can do
***************
*** 68,72 ****
  
          self.announce ("installing to %s" % self.bdist_dir)
!         install.ensure_ready()
          install.run()
  
--- 68,72 ----
  
          self.announce ("installing to %s" % self.bdist_dir)
!         install.ensure_finalized()
          install.run()
  

Index: bdist_rpm.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/command/bdist_rpm.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** bdist_rpm.py	2000/05/25 01:10:04	1.2
--- bdist_rpm.py	2000/05/27 17:27:23	1.3
***************
*** 2,19 ****
  
  Implements the Distutils 'bdist_rpm' command (create RPM source and binary
! distributions."""
  
  # created 2000/04/25, by Harry Henry Gebel
  
! __revision__ = "$Id: bdist_rpm.py,v 1.2 2000/05/25 01:10:04 gward Exp $"
  
! from os.path import exists, basename
! import os
  from distutils.core import Command
  from distutils.util import mkpath, write_file, copy_file
  from distutils.errors import *
- from string import join, lower
- from types import StringType, DictType, LongType, FloatType, IntType, \
-      ListType, TupleType
  
  class bdist_rpm (Command):
--- 2,16 ----
  
  Implements the Distutils 'bdist_rpm' command (create RPM source and binary
! distributions)."""
  
  # created 2000/04/25, by Harry Henry Gebel
  
! __revision__ = "$Id: bdist_rpm.py,v 1.3 2000/05/27 17:27:23 gward Exp $"
  
! import os, string
! from types import *
  from distutils.core import Command
  from distutils.util import mkpath, write_file, copy_file
  from distutils.errors import *
  
  class bdist_rpm (Command):
***************
*** 69,89 ****
          # make directories
          if self.spec_only:
!             self.execute(mkpath, ('redhat',), "Created './redhat' directory")
          else:
!             self.execute(mkpath, ('build/rpm/SOURCES',),
!                          "Created RPM source directory")
!             self.execute(mkpath, ('build/rpm/SPECS',),
!                          "Created RPM source directory")
!             self.execute(mkpath, ('build/rpm/BUILD',),
!                          "Created RPM source directory")
!             self.execute(mkpath, ('build/rpm/RPMS',),
!                          "Created RPM source directory")
!             self.execute(mkpath, ('build/rpm/SRPMS',),
!                          "Created RPM source directory")
  
          # spec file goes into .redhat directory if '--spec-only specified',
!         # into build/rpm/spec otherwisu
          if self.spec_only:
!             spec_path = './redhat/%s.spec' % self.distribution.get_name()
          else:
              spec_path = ('build/rpm/SPECS/%s.spec' %
--- 66,78 ----
          # make directories
          if self.spec_only:
!             self.mkpath('redhat')
          else:
!             for d in ('SOURCES', 'SPECS', 'BUILD', 'RPMS', 'SRPMS'):
!                 self.mkpath(os.path.join('build/rpm', d))
  
          # spec file goes into .redhat directory if '--spec-only specified',
!         # into build/rpm/spec otherwise
          if self.spec_only:
!             spec_path = 'redhat/%s.spec' % self.distribution.get_name()
          else:
              spec_path = ('build/rpm/SPECS/%s.spec' %
***************
*** 99,108 ****
          # make a source distribution and copy to SOURCES directory with
          # optional icon
!         sdist = self.find_peer ('sdist')
          if self.use_bzip2:
              sdist.formats = ['bztar']
          else:
              sdist.formats = ['gztar']
!         self.run_peer('sdist')
          if self.use_bzip2:
              source = self.distribution.get_fullname() + '.tar.bz2'
--- 88,97 ----
          # make a source distribution and copy to SOURCES directory with
          # optional icon
!         sdist = self.get_finalized_command ('sdist')
          if self.use_bzip2:
              sdist.formats = ['bztar']
          else:
              sdist.formats = ['gztar']
!         self.run_command('sdist')
          if self.use_bzip2:
              source = self.distribution.get_fullname() + '.tar.bz2'
***************
*** 112,116 ****
                       'Copying source distribution to SOURCES')
          if self.icon:
!             if exists(self.icon):
                  self.execute(copy_file, (self.icon, 'build/rpm/SOURCES'),
                       'Copying icon to SOURCES')
--- 101,105 ----
                       'Copying source distribution to SOURCES')
          if self.icon:
!             if os.path.exists(self.icon):
                  self.execute(copy_file, (self.icon, 'build/rpm/SOURCES'),
                       'Copying icon to SOURCES')
***************
*** 145,152 ****
          Python code read with execfile() '''
  
          package_type = 'rpm'
          
          # read in package data, if any
!         if exists('package_data'):
              try:
                  exec(open('package_data'))
--- 134,143 ----
          Python code read with execfile() '''
  
+         from string import join
+ 
          package_type = 'rpm'
          
          # read in package data, if any
!         if os.path.exists('package_data'):
              try:
                  exec(open('package_data'))
***************
*** 196,200 ****
          if type(self.doc) == ListType:
              for readme in ('README', 'README.txt'):
!                 if exists(readme) and readme not in self.doc:
                      self.doc.append(readme)
              self.doc = join(self.doc)
--- 187,191 ----
          if type(self.doc) == ListType:
              for readme in ('README', 'README.txt'):
!                 if os.path.exists(readme) and readme not in self.doc:
                      self.doc.append(readme)
              self.doc = join(self.doc)
***************
*** 247,253 ****
                        'Obsoletes',
                        ):
!             if getattr(self, lower(field)):
!                 spec_file.append('%s: %s' % (field, getattr(self,
!                                                             lower(field))))
                        
          if self.distribution.get_url() != 'UNKNOWN':
--- 238,244 ----
                        'Obsoletes',
                        ):
!             if getattr(self, string.lower(field)):
!                 spec_file.append('%s: %s' %
!                                  (field, getattr(self, string.lower(field))))
                        
          if self.distribution.get_url() != 'UNKNOWN':
***************
*** 261,265 ****
  
          if self.icon:
!             spec_file.append('Icon: ' + basename(self.icon))
  
          spec_file.extend([
--- 252,256 ----
  
          if self.icon:
!             spec_file.append('Icon: ' + os.path.basename(self.icon))
  
          spec_file.extend([
***************
*** 389,392 ****
          else:
              return default_value
- 
- # class bdist_rpm
--- 380,381 ----

Index: build.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/command/build.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** build.py	2000/05/25 01:21:54	1.21
--- build.py	2000/05/27 17:27:23	1.22
***************
*** 5,9 ****
  # created 1999/03/08, Greg Ward
  
! __revision__ = "$Id: build.py,v 1.21 2000/05/25 01:21:54 gward Exp $"
  
  import sys, os
--- 5,9 ----
  # created 1999/03/08, Greg Ward
  
! __revision__ = "$Id: build.py,v 1.22 2000/05/27 17:27:23 gward Exp $"
  
  import sys, os
***************
*** 93,97 ****
          # (ie. copy 'em into the build tree)
          if self.distribution.has_pure_modules():
!             self.run_peer ('build_py')
  
          # Build any standalone C libraries next -- they're most likely to
--- 93,97 ----
          # (ie. copy 'em into the build tree)
          if self.distribution.has_pure_modules():
!             self.run_command ('build_py')
  
          # Build any standalone C libraries next -- they're most likely to
***************
*** 99,111 ****
          # first!
          if self.distribution.has_c_libraries():
!             self.run_peer ('build_clib')
  
          # And now 'build_ext' -- compile extension modules and put them
          # into the build tree
          if self.distribution.has_ext_modules():
!             self.run_peer ('build_ext')
  
          if self.distribution.has_scripts():
!             self.run_peer ('build_scripts')
  
  # class build
--- 99,111 ----
          # first!
          if self.distribution.has_c_libraries():
!             self.run_command ('build_clib')
  
          # And now 'build_ext' -- compile extension modules and put them
          # into the build tree
          if self.distribution.has_ext_modules():
!             self.run_command ('build_ext')
  
          if self.distribution.has_scripts():
!             self.run_command ('build_scripts')
  
  # class build

Index: build_ext.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/command/build_ext.py,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -r1.39 -r1.40
*** build_ext.py	2000/05/26 01:31:53	1.39
--- build_ext.py	2000/05/27 17:27:23	1.40
***************
*** 7,11 ****
  # created 1999/08/09, Greg Ward
  
! __revision__ = "$Id: build_ext.py,v 1.39 2000/05/26 01:31:53 gward Exp $"
  
  import sys, os, string, re
--- 7,11 ----
  # created 1999/08/09, Greg Ward
  
! __revision__ = "$Id: build_ext.py,v 1.40 2000/05/27 17:27:23 gward Exp $"
  
  import sys, os, string, re
***************
*** 168,172 ****
          # linking extensions.
          if self.distribution.has_c_libraries():
!             build_clib = self.find_peer ('build_clib')
              self.libraries.extend (build_clib.get_library_names() or [])
              self.library_dirs.append (build_clib.build_clib)
--- 168,172 ----
          # linking extensions.
          if self.distribution.has_c_libraries():
!             build_clib = self.get_finalized_command ('build_clib')
              self.libraries.extend (build_clib.get_library_names() or [])
              self.library_dirs.append (build_clib.build_clib)
***************
*** 295,299 ****
                  base = modpath[-1]
  
!                 build_py = self.find_peer ('build_py')
                  package_dir = build_py.get_package_dir (package)
                  ext_filename = os.path.join (package_dir,
--- 295,299 ----
                  base = modpath[-1]
  
!                 build_py = self.get_finalized_command ('build_py')
                  package_dir = build_py.get_package_dir (package)
                  ext_filename = os.path.join (package_dir,

Index: install.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/command/install.py,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -r1.33 -r1.34
*** install.py	2000/05/27 01:33:12	1.33
--- install.py	2000/05/27 17:27:23	1.34
***************
*** 5,9 ****
  # created 1999/03/13, Greg Ward
  
! __revision__ = "$Id: install.py,v 1.33 2000/05/27 01:33:12 gward Exp $"
  
  import sys, os, string
--- 5,9 ----
  # created 1999/03/13, Greg Ward
  
! __revision__ = "$Id: install.py,v 1.34 2000/05/27 17:27:23 gward Exp $"
  
  import sys, os, string
***************
*** 455,463 ****
          # Obviously have to build before we can install
          if not self.skip_build:
!             self.run_peer ('build')
  
          # Run all sub-commands (at least those that need to be run)
          for cmd_name in self.get_sub_commands():
!             self.run_peer (cmd_name)
  
          if self.path_file:
--- 455,463 ----
          # Obviously have to build before we can install
          if not self.skip_build:
!             self.run_command ('build')
  
          # Run all sub-commands (at least those that need to be run)
          for cmd_name in self.get_sub_commands():
!             self.run_command (cmd_name)
  
          if self.path_file:
***************
*** 508,512 ****
          outputs = []
          for cmd_name in self.get_sub_commands():
!             cmd = self.find_peer (cmd_name)
              outputs.extend (cmd.get_outputs())
  
--- 508,512 ----
          outputs = []
          for cmd_name in self.get_sub_commands():
!             cmd = self.get_finalized_command (cmd_name)
              outputs.extend (cmd.get_outputs())
  
***************
*** 518,522 ****
          inputs = []
          for cmd_name in self.get_sub_commands():
!             cmd = self.find_peer (cmd_name)
              inputs.extend (cmd.get_inputs())
  
--- 518,522 ----
          inputs = []
          for cmd_name in self.get_sub_commands():
!             cmd = self.get_finalized_command (cmd_name)
              inputs.extend (cmd.get_inputs())
  

Index: install_lib.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/command/install_lib.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** install_lib.py	2000/05/23 01:55:16	1.24
--- install_lib.py	2000/05/27 17:27:23	1.25
***************
*** 1,5 ****
  # created 1999/03/13, Greg Ward
  
! __revision__ = "$Id: install_lib.py,v 1.24 2000/05/23 01:55:16 gward Exp $"
  
  import sys, os, string
--- 1,5 ----
  # created 1999/03/13, Greg Ward
  
! __revision__ = "$Id: install_lib.py,v 1.25 2000/05/27 17:27:23 gward Exp $"
  
  import sys, os, string
***************
*** 47,53 ****
          if not self.skip_build:
              if self.distribution.has_pure_modules():
!                 self.run_peer ('build_py')
              if self.distribution.has_ext_modules():
!                 self.run_peer ('build_ext')
  
          # Install everything: simply dump the entire contents of the build
--- 47,53 ----
          if not self.skip_build:
              if self.distribution.has_pure_modules():
!                 self.run_command ('build_py')
              if self.distribution.has_ext_modules():
!                 self.run_command ('build_ext')
  
          # Install everything: simply dump the entire contents of the build
***************
*** 86,90 ****
              return []
  
!         build_cmd = self.find_peer (build_cmd)
          build_files = build_cmd.get_outputs()
          build_dir = getattr (build_cmd, cmd_option)
--- 86,90 ----
              return []
  
!         build_cmd = self.get_finalized_command (build_cmd)
          build_files = build_cmd.get_outputs()
          build_dir = getattr (build_cmd, cmd_option)
***************
*** 139,147 ****
          
          if self.distribution.has_pure_modules():
!             build_py = self.find_peer ('build_py')
              inputs.extend (build_py.get_outputs())
  
          if self.distribution.has_ext_modules():
!             build_ext = self.find_peer ('build_ext')
              inputs.extend (build_ext.get_outputs())
  
--- 139,147 ----
          
          if self.distribution.has_pure_modules():
!             build_py = self.get_finalized_command ('build_py')
              inputs.extend (build_py.get_outputs())
  
          if self.distribution.has_ext_modules():
!             build_ext = self.get_finalized_command ('build_ext')
              inputs.extend (build_ext.get_outputs())
  

Index: install_scripts.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/command/install_scripts.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** install_scripts.py	2000/05/27 01:33:49	1.6
--- install_scripts.py	2000/05/27 17:27:23	1.7
***************
*** 6,10 ****
  # contributed by Bastian Kleineidam
  
! __revision__ = "$Id: install_scripts.py,v 1.6 2000/05/27 01:33:49 gward Exp $"
  
  import os
--- 6,10 ----
  # contributed by Bastian Kleineidam
  
! __revision__ = "$Id: install_scripts.py,v 1.7 2000/05/27 17:27:23 gward Exp $"
  
  import os
***************
*** 36,40 ****
      def run (self):
          if not self.skip_build:
!             self.run_peer('build_scripts')
          self.outfiles = self.copy_tree (self.build_dir, self.install_dir)
          if os.name == 'posix':
--- 36,40 ----
      def run (self):
          if not self.skip_build:
!             self.run_command('build_scripts')
          self.outfiles = self.copy_tree (self.build_dir, self.install_dir)
          if os.name == 'posix':

Index: sdist.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/command/sdist.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** sdist.py	2000/05/27 03:03:23	1.20
--- sdist.py	2000/05/27 17:27:23	1.21
***************
*** 5,9 ****
  # created 1999/09/22, Greg Ward
  
! __revision__ = "$Id: sdist.py,v 1.20 2000/05/27 03:03:23 gward Exp $"
  
  import sys, os, string, re
--- 5,9 ----
  # created 1999/09/22, Greg Ward
  
! __revision__ = "$Id: sdist.py,v 1.21 2000/05/27 17:27:23 gward Exp $"
  
  import sys, os, string, re
***************
*** 224,236 ****
  
          if self.distribution.has_pure_modules():
!             build_py = self.find_peer ('build_py')
              self.files.extend (build_py.get_source_files ())
  
          if self.distribution.has_ext_modules():
!             build_ext = self.find_peer ('build_ext')
              self.files.extend (build_ext.get_source_files ())
  
          if self.distribution.has_c_libraries():
!             build_clib = self.find_peer ('build_clib')
              self.files.extend (build_clib.get_source_files ())
  
--- 224,236 ----
  
          if self.distribution.has_pure_modules():
!             build_py = self.get_finalized_command ('build_py')
              self.files.extend (build_py.get_source_files ())
  
          if self.distribution.has_ext_modules():
!             build_ext = self.get_finalized_command ('build_ext')
              self.files.extend (build_ext.get_source_files ())
  
          if self.distribution.has_c_libraries():
!             build_clib = self.get_finalized_command ('build_clib')
              self.files.extend (build_clib.get_source_files ())
  
***************
*** 442,446 ****
  
          # Prune away the build and source distribution directories
!         build = self.find_peer ('build')
          exclude_pattern (self.files, None, prefix=build.build_base)
  
--- 442,446 ----
  
          # Prune away the build and source distribution directories
!         build = self.get_finalized_command ('build')
          exclude_pattern (self.files, None, prefix=build.build_base)