[Python-checkins] CVS: distutils/distutils archive_util.py,1.8,1.9

Greg Ward python-dev@python.org
Mon, 25 Sep 2000 19:13:52 -0700


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

Modified Files:
	archive_util.py 
Log Message:
Reformat docstrings.
Standardize whitespace in function calls.

Index: archive_util.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/archive_util.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** archive_util.py	2000/08/22 01:48:54	1.8
--- archive_util.py	2000/09/26 02:13:49	1.9
***************
*** 16,26 ****
                    verbose=0, dry_run=0):
      """Create a (possibly compressed) tar file from all the files under
!        'base_dir'.  'compress' must be "gzip" (the default), "compress",
!        "bzip2", or None.  Both "tar" and the compression utility named by
!        'compress' must be on the default program search path, so this is
!        probably Unix-specific.  The output tar file will be named 'base_dir'
!        + ".tar", possibly plus the appropriate compression extension (".gz",
!        ".bz2" or ".Z").  Return the output filename."""
! 
      # XXX GNU tar 1.13 has a nifty option to add a prefix directory.
      # It's pretty new, though, so we certainly can't require it --
--- 16,26 ----
                    verbose=0, dry_run=0):
      """Create a (possibly compressed) tar file from all the files under
!     'base_dir'.  'compress' must be "gzip" (the default), "compress",
!     "bzip2", or None.  Both "tar" and the compression utility named by
!     'compress' must be on the default program search path, so this is
!     probably Unix-specific.  The output tar file will be named 'base_dir' +
!     ".tar", possibly plus the appropriate compression extension (".gz",
!     ".bz2" or ".Z").  Return the output filename.
!     """
      # XXX GNU tar 1.13 has a nifty option to add a prefix directory.
      # It's pretty new, though, so we certainly can't require it --
***************
*** 45,53 ****
      mkpath(os.path.dirname(archive_name), verbose=verbose, dry_run=dry_run)
      cmd = ["tar", "-cf", archive_name, base_dir]
!     spawn (cmd, verbose=verbose, dry_run=dry_run)
  
      if compress:
!         spawn ([compress] + compress_flags[compress] + [archive_name],
!                verbose=verbose, dry_run=dry_run)
          return archive_name + compress_ext[compress]
      else:
--- 45,53 ----
      mkpath(os.path.dirname(archive_name), verbose=verbose, dry_run=dry_run)
      cmd = ["tar", "-cf", archive_name, base_dir]
!     spawn(cmd, verbose=verbose, dry_run=dry_run)
  
      if compress:
!         spawn([compress] + compress_flags[compress] + [archive_name],
!               verbose=verbose, dry_run=dry_run)
          return archive_name + compress_ext[compress]
      else:
***************
*** 58,68 ****
  
  def make_zipfile (base_name, base_dir, verbose=0, dry_run=0):
!     """Create a zip file from all the files under 'base_dir'.  The
!        output zip file will be named 'base_dir' + ".zip".  Uses either the
!        InfoZIP "zip" utility (if installed and found on the default search
!        path) or the "zipfile" Python module (if available).  If neither
!        tool is available, raises DistutilsExecError.  Returns the name
!        of the output zip file."""
! 
      # This initially assumed the Unix 'zip' utility -- but
      # apparently InfoZIP's zip.exe works the same under Windows, so
--- 58,68 ----
  
  def make_zipfile (base_name, base_dir, verbose=0, dry_run=0):
!     """Create a zip file from all the files under 'base_dir'.  The output
!     zip file will be named 'base_dir' + ".zip".  Uses either the InfoZIP
!     "zip" utility (if installed and found on the default search path) or
!     the "zipfile" Python module (if available).  If neither tool is
!     available, raises DistutilsExecError.  Returns the name of the output
!     zip file.
!     """
      # This initially assumed the Unix 'zip' utility -- but
      # apparently InfoZIP's zip.exe works the same under Windows, so
***************
*** 72,77 ****
      mkpath(os.path.dirname(zip_filename), verbose=verbose, dry_run=dry_run)
      try:
!         spawn (["zip", "-rq", zip_filename, base_dir],
!                verbose=verbose, dry_run=dry_run)
      except DistutilsExecError:
  
--- 72,77 ----
      mkpath(os.path.dirname(zip_filename), verbose=verbose, dry_run=dry_run)
      try:
!         spawn(["zip", "-rq", zip_filename, base_dir],
!               verbose=verbose, dry_run=dry_run)
      except DistutilsExecError:
  
***************
*** 97,108 ****
              for name in names:
                  path = os.path.normpath(os.path.join(dirname, name))
!                 if os.path.isfile (path):
!                     z.write (path, path)
  
          if not dry_run:
!             z = zipfile.ZipFile (zip_filename, "wb",
!                                  compression=zipfile.ZIP_DEFLATED)
  
!             os.path.walk (base_dir, visit, z)
              z.close()
  
--- 97,108 ----
              for name in names:
                  path = os.path.normpath(os.path.join(dirname, name))
!                 if os.path.isfile(path):
!                     z.write(path, path)
  
          if not dry_run:
!             z = zipfile.ZipFile(zip_filename, "wb",
!                                 compression=zipfile.ZIP_DEFLATED)
  
!             os.path.walk(base_dir, visit, z)
              z.close()
  
***************
*** 144,150 ****
          if verbose:
              print "changing into '%s'" % root_dir
!         base_name = os.path.abspath (base_name)
          if not dry_run:
!             os.chdir (root_dir)
  
      if base_dir is None:
--- 144,150 ----
          if verbose:
              print "changing into '%s'" % root_dir
!         base_name = os.path.abspath(base_name)
          if not dry_run:
!             os.chdir(root_dir)
  
      if base_dir is None:
***************
*** 162,171 ****
      for (arg,val) in format_info[1]:
          kwargs[arg] = val
!     filename = apply (func, (base_name, base_dir), kwargs)
  
      if root_dir is not None:
          if verbose:
              print "changing back to '%s'" % save_cwd
!         os.chdir (save_cwd)
  
      return filename
--- 162,171 ----
      for (arg,val) in format_info[1]:
          kwargs[arg] = val
!     filename = apply(func, (base_name, base_dir), kwargs)
  
      if root_dir is not None:
          if verbose:
              print "changing back to '%s'" % save_cwd
!         os.chdir(save_cwd)
  
      return filename