summaryrefslogtreecommitdiffstats
path: root/Mac/Lib/maccache.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2003-11-19 14:34:18 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2003-11-19 14:34:18 (GMT)
commit28ecf70db57828db2ca279643bf9aeca7662f35c (patch)
tree09b7767bbc411f85313b58d6fe7e5e67d9392973 /Mac/Lib/maccache.py
parent6045b9c93511c767f6cfa2d2fa299c76181acd9b (diff)
downloadcpython-28ecf70db57828db2ca279643bf9aeca7662f35c.zip
cpython-28ecf70db57828db2ca279643bf9aeca7662f35c.tar.gz
cpython-28ecf70db57828db2ca279643bf9aeca7662f35c.tar.bz2
Getting rid of support for MacOS9 and earlier. This is the first step,
and the biggest in size, but probably the easiest. Hunting through the source code comes next.
Diffstat (limited to 'Mac/Lib/maccache.py')
-rw-r--r--Mac/Lib/maccache.py61
1 files changed, 0 insertions, 61 deletions
diff --git a/Mac/Lib/maccache.py b/Mac/Lib/maccache.py
deleted file mode 100644
index 1e2b3d0..0000000
--- a/Mac/Lib/maccache.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# Module 'maccache'
-#
-# Maintain a cache of listdir(), isdir(), isfile() or exists() outcomes.
-# XXX Should merge with module statcache
-
-import os
-
-
-# The cache.
-# Keys are absolute pathnames;
-# values are 0 (nothing), 1 (file) or [...] (dir).
-#
-cache = {}
-
-
-# Current working directory.
-#
-cwd = os.getcwd()
-
-
-# Constants.
-#
-NONE = 0
-FILE = 1
-LISTTYPE = type([])
-
-def _stat(name):
- name = os.path.join(cwd, name)
- if cache.has_key(name):
- return cache[name]
- if os.path.isfile(name):
- cache[name] = FILE
- return FILE
- try:
- list = os.listdir(name)
- except:
- cache[name] = NONE
- return NONE
- cache[name] = list
- if name[-1:] == ':': cache[name[:-1]] = list
- else: cache[name+':'] = list
- return list
-
-def isdir(name):
- st = _stat(name)
- return type(st) == LISTTYPE
-
-def isfile(name):
- st = _stat(name)
- return st == FILE
-
-def exists(name):
- st = _stat(name)
- return st <> NONE
-
-def listdir(name):
- st = _stat(name)
- if type(st) == LISTTYPE:
- return st
- else:
- raise RuntimeError, 'list non-directory'