]> granicus.if.org Git - python/commitdiff
Deprecate the dircache module for 3.0.
authorBrett Cannon <bcannon@gmail.com>
Sat, 10 May 2008 21:12:57 +0000 (21:12 +0000)
committerBrett Cannon <bcannon@gmail.com>
Sat, 10 May 2008 21:12:57 +0000 (21:12 +0000)
Doc/library/dircache.rst
Lib/dircache.py
Lib/test/regrtest.py
Lib/test/test_dircache.py
Lib/test/test_py3kwarn.py

index 28aa6671295ed563695b65221ea8b6e8c686853c..ee48432d1905aaf90bd558335125ffec7c7b7ab4 100644 (file)
@@ -4,6 +4,12 @@
 
 .. module:: dircache
    :synopsis: Return directory listing, with cache mechanism.
+   :deprecated:
+   
+.. deprecated:: 2.6
+   The dircache module has been removed in Python 3.0.
+   
+   
 .. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il>
 
 
index 78ec7fe0f433b3ac535761e147da158569b97ac3..7e4f0b508ac74e47495622472b2382370fa3d9d9 100644 (file)
@@ -3,6 +3,9 @@
 The listdir() routine returns a sorted list of the files in a directory,
 using a cache to avoid reading the directory more often than necessary.
 The annotate() routine appends slashes to directories."""
+from warnings import warnpy3k
+warnpy3k("the dircache module has been removed in Python 3.0", stacklevel=2)
+del warnpy3k
 
 import os
 
index b092bd93b744e67d5bbd2419d41977c317d57897..7aa22ed814bdac224b5fddb173e79750b00447ef 100755 (executable)
@@ -678,7 +678,8 @@ def dash_R(the_module, test, indirect_test, huntrleaks):
 
 def dash_R_cleanup(fs, ps, pic, abcs):
     import gc, copy_reg
-    import _strptime, linecache, dircache
+    import _strptime, linecache
+    dircache = test_support.import_module('dircache', deprecated=True)
     import urlparse, urllib, urllib2, mimetypes, doctest
     import struct, filecmp
     from distutils.dir_util import _path_created
index 68f6fc28b6c49292fa0db2a418efcbc17b070ec2..276c52a5c47dd18e485340ccfbd3b93a26955458 100644 (file)
@@ -4,8 +4,9 @@
 """
 
 import unittest
-from test.test_support import run_unittest, TESTFN
-import dircache, os, time, sys, tempfile
+from test.test_support import run_unittest, TESTFN, import_module
+dircache = import_module('dircache', deprecated=True)
+import os, time, sys, tempfile
 
 
 class DircacheTests(unittest.TestCase):
@@ -66,7 +67,10 @@ class DircacheTests(unittest.TestCase):
 
 
 def test_main():
-    run_unittest(DircacheTests)
+    try:
+        run_unittest(DircacheTests)
+    finally:
+        dircache.reset()
 
 
 if __name__ == "__main__":
index e98480321017693d13bc30a4070bcd5455e1c390..991d5cf9e4d9a03815f544f3ede085b1a2c3f25e 100644 (file)
@@ -129,7 +129,7 @@ class TestStdlibRemovals(unittest.TestCase):
     # test.testall not tested as it executes all unit tests as an
     # import side-effect.
     all_platforms = ('audiodev', 'imputil', 'mutex', 'user', 'new', 'rexec',
-                        'Bastion', 'compiler')
+                        'Bastion', 'compiler', 'dircache')
     inclusive_platforms = {'irix':('pure',)}
     # XXX Don't know if lib-tk is only installed if _tkinter is built.
     optional_modules = ('bsddb185', 'Canvas')