diff options
Diffstat (limited to 'Lib/lib-old')
-rw-r--r-- | Lib/lib-old/codehack.py | 4 | ||||
-rw-r--r-- | Lib/lib-old/newdir.py | 8 | ||||
-rw-r--r-- | Lib/lib-old/packmail.py | 24 |
3 files changed, 31 insertions, 5 deletions
diff --git a/Lib/lib-old/codehack.py b/Lib/lib-old/codehack.py index d00d2bfec9..1f16814224 100644 --- a/Lib/lib-old/codehack.py +++ b/Lib/lib-old/codehack.py @@ -7,6 +7,10 @@ import string import os import linecache +# XXX The functions getcodename() and getfuncname() are now obsolete +# XXX as code and function objects now have a name attribute -- +# XXX co.co_name and f.func_name. + # Extract the function or class name from a code object. # This is a bit of a hack, since a code object doesn't contain # the name directly. So what do we do: diff --git a/Lib/lib-old/newdir.py b/Lib/lib-old/newdir.py index 26a7df0c1b..937c49e67b 100644 --- a/Lib/lib-old/newdir.py +++ b/Lib/lib-old/newdir.py @@ -65,11 +65,9 @@ def is_function(x): # Approximation of builtin dir(); but note that this lists the user's # variables by default, not the current local name space. -def dir(*args): - if len(args) > 0: - if len(args) == 1: - args = args[0] - return listattrs(args) +def dir(x = None): + if x is not None: + return listattrs(x) else: import __main__ return listattrs(__main__) diff --git a/Lib/lib-old/packmail.py b/Lib/lib-old/packmail.py index d612c88a8e..13b1bdcdea 100644 --- a/Lib/lib-old/packmail.py +++ b/Lib/lib-old/packmail.py @@ -41,12 +41,28 @@ def packsome(outfp, dirname, names): # Pack all files from a directory def packall(outfp, dirname): names = os.listdir(dirname) + try: + names.remove('.') + except: + pass + try: + names.remove('..') + except: + pass names.sort() packsome(outfp, dirname, names) # Pack all files from a directory that are not older than a give one def packnotolder(outfp, dirname, oldest): names = os.listdir(dirname) + try: + names.remove('.') + except: + pass + try: + names.remove('..') + except: + pass oldest = os.path.join(dirname, oldest) st = os.stat(oldest) mtime = st[ST_MTIME] @@ -67,6 +83,14 @@ def packtree(outfp, dirname): print 'packtree', dirname outfp.write('mkdir ' + unixfix(dirname) + '\n') names = os.listdir(dirname) + try: + names.remove('.') + except: + pass + try: + names.remove('..') + except: + pass subdirs = [] for name in names: fullname = os.path.join(dirname, name) |