[Python-checkins] CVS: python/dist/src/Lib uu.py,1.13,1.14

Guido van Rossum python-dev@python.org
Wed, 10 Jan 2001 11:14:31 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv20098

Modified Files:
	uu.py 
Log Message:
Adapted version of SF Patch #103173 by pyretic: make uu.decode work
with spaces in filename.

I changed the module to use string methods instead of the string
module.  Also, instead of stripping the last character of the filename
(assuming this is the linefeed), I strip trailing whitespace (assuming
creating files with trailing whitespace in their name cannot possibly
be a wise idea).

(Note that I believe that /F's "workaround for broken uuencoders" is
no longer needed since the recent fix to binascii.c, but I'll leave it
in since it appears pretty harmless.)


Index: uu.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/uu.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** uu.py	2000/12/12 23:20:45	1.13
--- uu.py	2001/01/10 19:14:28	1.14
***************
*** 33,37 ****
  import binascii
  import os
- import string
  import sys
  
--- 33,36 ----
***************
*** 98,112 ****
          if hdr[:5] != 'begin':
              continue
!         hdrfields = string.split(hdr)
          if len(hdrfields) == 3 and hdrfields[0] == 'begin':
              try:
!                 string.atoi(hdrfields[1], 8)
                  break
              except ValueError:
                  pass
      if out_file is None:
!         out_file = hdrfields[2]
      if mode is None:
!         mode = string.atoi(hdrfields[1], 8)
      #
      # Open the output file
--- 97,111 ----
          if hdr[:5] != 'begin':
              continue
!         hdrfields = hdr.split(" ", 2)
          if len(hdrfields) == 3 and hdrfields[0] == 'begin':
              try:
!                 int(hdrfields[1], 8)
                  break
              except ValueError:
                  pass
      if out_file is None:
!         out_file = hdrfields[2].rstrip()
      if mode is None:
!         mode = int(hdrfields[1], 8)
      #
      # Open the output file