diff options
author | Brett Cannon <bcannon@gmail.com> | 2008-05-10 21:12:57 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2008-05-10 21:12:57 (GMT) |
commit | 0aa6e1b8fb8c3ae656518a7e319a5f697158e7bf (patch) | |
tree | a51acc70eca609cdedfe1d87efaf69a9514d9342 | |
parent | 10f5db6424595f0389ff84e053a12a1b60d73cd2 (diff) | |
download | cpython-0aa6e1b8fb8c3ae656518a7e319a5f697158e7bf.zip cpython-0aa6e1b8fb8c3ae656518a7e319a5f697158e7bf.tar.gz cpython-0aa6e1b8fb8c3ae656518a7e319a5f697158e7bf.tar.bz2 |
Deprecate the dircache module for 3.0.
-rw-r--r-- | Doc/library/dircache.rst | 6 | ||||
-rw-r--r-- | Lib/dircache.py | 3 | ||||
-rwxr-xr-x | Lib/test/regrtest.py | 3 | ||||
-rw-r--r-- | Lib/test/test_dircache.py | 10 | ||||
-rw-r--r-- | Lib/test/test_py3kwarn.py | 2 |
5 files changed, 19 insertions, 5 deletions
diff --git a/Doc/library/dircache.rst b/Doc/library/dircache.rst index 28aa667..ee48432 100644 --- a/Doc/library/dircache.rst +++ b/Doc/library/dircache.rst @@ -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> diff --git a/Lib/dircache.py b/Lib/dircache.py index 78ec7fe..7e4f0b5 100644 --- a/Lib/dircache.py +++ b/Lib/dircache.py @@ -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 diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index b092bd9..7aa22ed 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -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 diff --git a/Lib/test/test_dircache.py b/Lib/test/test_dircache.py index 68f6fc2..276c52a 100644 --- a/Lib/test/test_dircache.py +++ b/Lib/test/test_dircache.py @@ -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__": diff --git a/Lib/test/test_py3kwarn.py b/Lib/test/test_py3kwarn.py index e984803..991d5cf 100644 --- a/Lib/test/test_py3kwarn.py +++ b/Lib/test/test_py3kwarn.py @@ -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') |