Skip to content

Commit

Permalink
Merge remove-pre-split-code-3581-2
Browse files Browse the repository at this point in the history
Author: thijs, exarkun
Reviewer: exarkun, mwh
Fixes: twisted#3581

Remove the compatibility layer added for modules which were moved to new
locations for the 2.0 split.


git-svn-id: svn://svn.twistedmatrix.com/svn/Twisted/trunk@26541 bbbe8e31-12d6-0310-92fd-ac37d47ddeeb
  • Loading branch information
exarkun committed Mar 30, 2009
1 parent ba532b4 commit 0058516
Show file tree
Hide file tree
Showing 19 changed files with 25 additions and 150 deletions.
6 changes: 0 additions & 6 deletions twisted/im.py

This file was deleted.

6 changes: 0 additions & 6 deletions twisted/protocols/dns.py

This file was deleted.

7 changes: 0 additions & 7 deletions twisted/protocols/ethernet.py

This file was deleted.

7 changes: 0 additions & 7 deletions twisted/protocols/http.py

This file was deleted.

7 changes: 0 additions & 7 deletions twisted/protocols/imap4.py

This file was deleted.

7 changes: 0 additions & 7 deletions twisted/protocols/ip.py

This file was deleted.

7 changes: 0 additions & 7 deletions twisted/protocols/irc.py

This file was deleted.

7 changes: 0 additions & 7 deletions twisted/protocols/jabber.py

This file was deleted.

7 changes: 0 additions & 7 deletions twisted/protocols/msn.py

This file was deleted.

7 changes: 0 additions & 7 deletions twisted/protocols/nntp.py

This file was deleted.

7 changes: 0 additions & 7 deletions twisted/protocols/oscar.py

This file was deleted.

6 changes: 0 additions & 6 deletions twisted/protocols/pop3.py

This file was deleted.

7 changes: 0 additions & 7 deletions twisted/protocols/raw.py

This file was deleted.

7 changes: 0 additions & 7 deletions twisted/protocols/rawudp.py

This file was deleted.

6 changes: 0 additions & 6 deletions twisted/protocols/smtp.py

This file was deleted.

7 changes: 0 additions & 7 deletions twisted/protocols/sux.py

This file was deleted.

7 changes: 0 additions & 7 deletions twisted/protocols/toc.py

This file was deleted.

14 changes: 14 additions & 0 deletions twisted/python/test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,20 @@ def test_gidFromGroupnameString(self):
"Group Name/GID conversion requires the grp module.")


def test_moduleMovedForSplitDeprecation(self):
"""
Calling L{moduleMovedForSplit} results in a deprecation warning.
"""
util.moduleMovedForSplit("foo", "bar", "baz", "quux", "corge", {})
warnings = self.flushWarnings(
offendingFunctions=[self.test_moduleMovedForSplitDeprecation])
self.assertEquals(
warnings[0]['message'],
"moduleMovedForSplit is deprecated since Twisted 9.0.")
self.assertEquals(warnings[0]['category'], DeprecationWarning)
self.assertEquals(len(warnings), 1)



class TestMergeFunctionMetadata(unittest.TestCase):
"""
Expand Down
46 changes: 11 additions & 35 deletions twisted/python/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,9 @@ def str_xor(s, b):
return ''.join([chr(ord(c) ^ b) for c in s])

def keyed_md5(secret, challenge):
"""Create the keyed MD5 string for the given secret and challenge."""
import warnings
"""
Create the keyed MD5 string for the given secret and challenge.
"""
warnings.warn(
"keyed_md5() is deprecated. Use the stdlib module hmac instead.",
DeprecationWarning, stacklevel=2
Expand Down Expand Up @@ -716,38 +717,13 @@ def getvalue(self):

def moduleMovedForSplit(origModuleName, newModuleName, moduleDesc,
projectName, projectURL, globDict):
from twisted.python import reflect
modoc = """
%(moduleDesc)s
This module is DEPRECATED. It has been split off into a third party
package, Twisted %(projectName)s. Please see %(projectURL)s.
This is just a place-holder that imports from the third-party %(projectName)s
package for backwards compatibility. To use it, you need to install
that package.
""" % {'moduleDesc': moduleDesc,
'projectName': projectName,
'projectURL': projectURL}

#origModule = reflect.namedModule(origModuleName)
try:
newModule = reflect.namedModule(newModuleName)
except ImportError:
raise ImportError("You need to have the Twisted %s "
"package installed to use %s. "
"See %s."
% (projectName, origModuleName, projectURL))

# Populate the old module with the new module's contents
for k,v in vars(newModule).items():
globDict[k] = v
globDict['__doc__'] = modoc
import warnings
warnings.warn("%s has moved to %s. See %s." % (origModuleName, newModuleName,
projectURL),
DeprecationWarning, stacklevel=3)
return
"""
No-op function; only present for backwards compatibility. There is no
reason to call this function.
"""
warnings.warn(
"moduleMovedForSplit is deprecated since Twisted 9.0.",
DeprecationWarning, stacklevel=2)


def untilConcludes(f, *a, **kw):
Expand Down Expand Up @@ -951,5 +927,5 @@ def runAsEffectiveUser(euid, egid, function, *args, **kwargs):
"raises", "IntervalDifferential", "FancyStrMixin", "FancyEqMixin",
"dsu", "switchUID", "SubclassableCStringIO", "moduleMovedForSplit",
"unsignedID", "mergeFunctionMetadata", "nameToLabel", "uidFromString",
"gidFromString", "runAsEffectiveUser",
"gidFromString", "runAsEffectiveUser", "moduleMovedForSplit",
]

0 comments on commit 0058516

Please sign in to comment.