[Python-checkins] CVS: distutils/distutils/command install_lib.py,1.29,1.30

Greg Ward python-dev@python.org
Fri, 22 Sep 2000 18:20:24 -0700


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

Modified Files:
	install_lib.py 
Log Message:
Split 'run()' up into 'build()', 'install()', and 'bytecompile()' (for
easier extensibility).


Index: install_lib.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/command/install_lib.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** install_lib.py	2000/09/23 01:10:10	1.29
--- install_lib.py	2000/09/23 01:20:19	1.30
***************
*** 47,50 ****
--- 47,67 ----
  
          # Make sure we have built everything we need first
+         self.build()
+         
+         # Install everything: simply dump the entire contents of the build
+         # directory to the installation directory (that's the beauty of
+         # having a build directory!)
+         outfiles = self.install()
+ 
+         # (Optionally) compile .py to .pyc
+         self.bytecompile(outfiles)
+ 
+     # run ()
+ 
+ 
+     # -- Top-level worker functions ------------------------------------
+     # (called from 'run()')
+ 
+     def build (self):
          if not self.skip_build:
              if self.distribution.has_pure_modules():
***************
*** 52,59 ****
              if self.distribution.has_ext_modules():
                  self.run_command('build_ext')
! 
!         # Install everything: simply dump the entire contents of the build
!         # directory to the installation directory (that's the beauty of
!         # having a build directory!)
          if os.path.isdir(self.build_dir):
              outfiles = self.copy_tree(self.build_dir, self.install_dir)
--- 69,74 ----
              if self.distribution.has_ext_modules():
                  self.run_command('build_ext')
!         
!     def install (self):
          if os.path.isdir(self.build_dir):
              outfiles = self.copy_tree(self.build_dir, self.install_dir)
***************
*** 62,75 ****
                        self.build_dir)
              return
  
!         # (Optionally) compile .py to .pyc
          # XXX hey! we can't control whether we optimize or not; that's up
          # to the invocation of the current Python interpreter (at least
          # according to the py_compile docs).  That sucks.
- 
          if self.compile:
              from py_compile import compile
  
!             for f in outfiles:
                  # only compile the file if it is actually a .py file
                  if f[-3:] == '.py':
--- 77,90 ----
                        self.build_dir)
              return
+         return outfiles
  
!     def bytecompile (self, files):
          # XXX hey! we can't control whether we optimize or not; that's up
          # to the invocation of the current Python interpreter (at least
          # according to the py_compile docs).  That sucks.
          if self.compile:
              from py_compile import compile
  
!             for f in files:
                  # only compile the file if it is actually a .py file
                  if f[-3:] == '.py':
***************
*** 80,86 ****
                      self.make_file(f, out_fn, compile, (f,),
                                     compile_msg, skip_msg)
-     # run ()
  
  
      def _mutate_outputs (self, has_any, build_cmd, cmd_option, output_dir):
  
--- 95,102 ----
                      self.make_file(f, out_fn, compile, (f,),
                                     compile_msg, skip_msg)
  
  
+     # -- Utility methods -----------------------------------------------
+ 
      def _mutate_outputs (self, has_any, build_cmd, cmd_option, output_dir):
  
***************
*** 109,112 ****
--- 125,132 ----
          return bytecode_files
          
+ 
+     # -- External interface --------------------------------------------
+     # (called by outsiders)
+ 
      def get_outputs (self):
          """Return the list of files that would be installed if this command