From 2a869138645a38bea2517d00133158567a39caaf Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Sun, 11 May 2008 03:01:47 +0000 Subject: Deprecated the mhlib module for removal in 3.0. --- Doc/library/mhlib.rst | 6 ++++++ Lib/mhlib.py | 4 ++++ Lib/test/test_mhlib.py | 4 ++-- Lib/test/test_py3kwarn.py | 2 +- Lib/test/test_pyclbr.py | 1 - Misc/NEWS | 2 ++ 6 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Doc/library/mhlib.rst b/Doc/library/mhlib.rst index f6edf28..2a6a2db 100644 --- a/Doc/library/mhlib.rst +++ b/Doc/library/mhlib.rst @@ -3,6 +3,12 @@ .. module:: mhlib :synopsis: Manipulate MH mailboxes from Python. + :deprecated: + +.. deprecated:: 2.6 + The :mod:`mhlib` module has been removed in Python 3.0. Use the + :mod:`mailbox` instead. + .. sectionauthor:: Skip Montanaro The :mod:`mhlib` module provides a Python interface to MH folders and their diff --git a/Lib/mhlib.py b/Lib/mhlib.py index 1a90375..856e878 100644 --- a/Lib/mhlib.py +++ b/Lib/mhlib.py @@ -52,6 +52,10 @@ s = m.getheadertext(pred) # text of message's headers, filtered by pred s = m.getbodytext() # text of message's body, decoded s = m.getbodytext(0) # text of message's body, not decoded """ +from warnings import warnpy3k +warnpy3k("the mhlib module has been removed in Python 3.0; use the mailbox " + "module instead", stacklevel=2) +del warnpy3k # XXX To do, functionality: # - annotate messages diff --git a/Lib/test/test_mhlib.py b/Lib/test/test_mhlib.py index a6dc00a..04571ea 100644 --- a/Lib/test/test_mhlib.py +++ b/Lib/test/test_mhlib.py @@ -7,10 +7,10 @@ ### mhlib. It should. import unittest -from test.test_support import run_unittest, TESTFN, TestSkipped +from test.test_support import run_unittest, TESTFN, TestSkipped, import_module import os, StringIO import sys -import mhlib +mhlib = import_module('mhlib', deprecated=True) if (sys.platform.startswith("win") or sys.platform=="riscos" or sys.platform.startswith("atheos")): diff --git a/Lib/test/test_py3kwarn.py b/Lib/test/test_py3kwarn.py index 6835fa8..13c0ec3 100644 --- a/Lib/test/test_py3kwarn.py +++ b/Lib/test/test_py3kwarn.py @@ -130,7 +130,7 @@ class TestStdlibRemovals(unittest.TestCase): # import side-effect. all_platforms = ('audiodev', 'imputil', 'mutex', 'user', 'new', 'rexec', 'Bastion', 'compiler', 'dircache', 'fpformat', - 'ihooks') + 'ihooks', 'mhlib') inclusive_platforms = {'irix':('pure',)} # XXX Don't know if lib-tk is only installed if _tkinter is built. optional_modules = ('bsddb185', 'Canvas', 'dl', 'linuxaudiodev') diff --git a/Lib/test/test_pyclbr.py b/Lib/test/test_pyclbr.py index d747f2f..3617edf 100644 --- a/Lib/test/test_pyclbr.py +++ b/Lib/test/test_pyclbr.py @@ -164,7 +164,6 @@ class PyclbrTest(TestCase): # These were once about the 10 longest modules cm('random', ignore=('Random',)) # from _random import Random as CoreGenerator cm('cgi', ignore=('log',)) # set with = in module - cm('mhlib') cm('urllib', ignore=('getproxies_registry', 'proxy_bypass_registry', 'open_https', diff --git a/Misc/NEWS b/Misc/NEWS index 9471c52..d796735 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -23,6 +23,8 @@ Extension Modules Library ------- +- The mhlib module has been deprecated for removal in Python 3.0. + - The linuxaudiodev module has been deprecated for removal in Python 3.0. - The ihooks module has been deprecated for removal in Python 3.0. -- cgit v0.12