r46861 - Merge old-versionpy-8219: Remove old _version.py files.
hawkowl-TA+aISz0psMTMxyoc4vAAJOcrHinNvQL0E9HWUfgJXw@public.gmane.org
| Newsgroups | gmane.comp.python.twisted.commits |
|---|---|
| Message-ID | <[email protected]> |
Author: hawkowl
Date: Sat Feb 27 20:16:00 2016
New Revision: 46861
Added:
branches/release-16.0.0-8210/twisted/topfiles/8219.removal
Removed:
branches/release-16.0.0-8210/twisted/conch/_version.py
branches/release-16.0.0-8210/twisted/mail/_version.py
branches/release-16.0.0-8210/twisted/names/_version.py
branches/release-16.0.0-8210/twisted/news/_version.py
branches/release-16.0.0-8210/twisted/pair/_version.py
branches/release-16.0.0-8210/twisted/runner/_version.py
branches/release-16.0.0-8210/twisted/web/_version.py
branches/release-16.0.0-8210/twisted/words/_version.py
Modified:
branches/release-16.0.0-8210/twisted/conch/__init__.py
branches/release-16.0.0-8210/twisted/mail/__init__.py
branches/release-16.0.0-8210/twisted/names/__init__.py
branches/release-16.0.0-8210/twisted/news/__init__.py
branches/release-16.0.0-8210/twisted/pair/__init__.py
branches/release-16.0.0-8210/twisted/python/dist3.py
branches/release-16.0.0-8210/twisted/runner/__init__.py
branches/release-16.0.0-8210/twisted/test/test_twisted.py
branches/release-16.0.0-8210/twisted/web/__init__.py
branches/release-16.0.0-8210/twisted/words/__init__.py
Log:
Merge old-versionpy-8219: Remove old _version.py files.
Fixes: #8219
Author: hawkowl
Reviewer: mithrandi
Modified: branches/release-16.0.0-8210/twisted/conch/__init__.py
==============================================================================
--- branches/release-16.0.0-8210/twisted/conch/__init__.py (original)
+++ branches/release-16.0.0-8210/twisted/conch/__init__.py Sat Feb 27 20:16:00 2016
@@ -6,5 +6,13 @@
Twisted Conch: The Twisted Shell. Terminal emulation, SSHv2 and telnet.
"""
-from twisted.conch._version import version
+from twisted.python.versions import Version
+from twisted.python.deprecate import deprecatedModuleAttribute
+
+from twisted._version import version
__version__ = version.short()
+
+deprecatedModuleAttribute(
+ Version("Twisted", 16, 0, 0),
+ "Use twisted.__version__ instead.",
+ "twisted.conch", "__version__")
Modified: branches/release-16.0.0-8210/twisted/mail/__init__.py
==============================================================================
--- branches/release-16.0.0-8210/twisted/mail/__init__.py (original)
+++ branches/release-16.0.0-8210/twisted/mail/__init__.py Sat Feb 27 20:16:00 2016
@@ -5,5 +5,13 @@
Twisted Mail: Servers and clients for POP3, ESMTP, and IMAP.
"""
-from twisted.mail._version import version
+from twisted.python.versions import Version
+from twisted.python.deprecate import deprecatedModuleAttribute
+
+from twisted._version import version
__version__ = version.short()
+
+deprecatedModuleAttribute(
+ Version("Twisted", 16, 0, 0),
+ "Use twisted.__version__ instead.",
+ "twisted.mail", "__version__")
Modified: branches/release-16.0.0-8210/twisted/names/__init__.py
==============================================================================
--- branches/release-16.0.0-8210/twisted/names/__init__.py (original)
+++ branches/release-16.0.0-8210/twisted/names/__init__.py Sat Feb 27 20:16:00 2016
@@ -5,5 +5,13 @@
Twisted Names: DNS server and client implementations.
"""
-from twisted.names._version import version
+from twisted.python.versions import Version
+from twisted.python.deprecate import deprecatedModuleAttribute
+
+from twisted._version import version
__version__ = version.short()
+
+deprecatedModuleAttribute(
+ Version("Twisted", 16, 0, 0),
+ "Use twisted.__version__ instead.",
+ "twisted.names", "__version__")
Modified: branches/release-16.0.0-8210/twisted/news/__init__.py
==============================================================================
--- branches/release-16.0.0-8210/twisted/news/__init__.py (original)
+++ branches/release-16.0.0-8210/twisted/news/__init__.py Sat Feb 27 20:16:00 2016
@@ -5,5 +5,13 @@
Twisted News: A NNTP-based news service.
"""
-from twisted.news._version import version
+from twisted.python.versions import Version
+from twisted.python.deprecate import deprecatedModuleAttribute
+
+from twisted._version import version
__version__ = version.short()
+
+deprecatedModuleAttribute(
+ Version("Twisted", 16, 0, 0),
+ "Use twisted.__version__ instead.",
+ "twisted.news", "__version__")
Modified: branches/release-16.0.0-8210/twisted/pair/__init__.py
==============================================================================
--- branches/release-16.0.0-8210/twisted/pair/__init__.py (original)
+++ branches/release-16.0.0-8210/twisted/pair/__init__.py Sat Feb 27 20:16:00 2016
@@ -1,10 +1,7 @@
-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
-
"""
-
Twisted Pair: The framework of your ethernet.
Low-level networking transports and utilities.
@@ -13,8 +10,15 @@
twisted.protocols.raw and twisted.protocols.rawudp.
Maintainer: Tommi Virtanen
-
"""
-from twisted.pair._version import version
+from twisted.python.versions import Version
+from twisted.python.deprecate import deprecatedModuleAttribute
+
+from twisted._version import version
__version__ = version.short()
+
+deprecatedModuleAttribute(
+ Version("Twisted", 16, 0, 0),
+ "Use twisted.__version__ instead.",
+ "twisted.pair", "__version__")
Modified: branches/release-16.0.0-8210/twisted/python/dist3.py
==============================================================================
--- branches/release-16.0.0-8210/twisted/python/dist3.py (original)
+++ branches/release-16.0.0-8210/twisted/python/dist3.py Sat Feb 27 20:16:00 2016
@@ -121,7 +121,6 @@
"twisted.logger.test",
"twisted.names",
"twisted.names._rfc1982",
- "twisted.names._version",
"twisted.names.cache",
"twisted.names.client",
"twisted.names.common",
@@ -225,7 +224,6 @@
"twisted.web._newclient",
"twisted.web._responses",
"twisted.web._stan",
- "twisted.web._version",
"twisted.web.demo",
"twisted.web.error",
"twisted.web.guard",
Modified: branches/release-16.0.0-8210/twisted/runner/__init__.py
==============================================================================
--- branches/release-16.0.0-8210/twisted/runner/__init__.py (original)
+++ branches/release-16.0.0-8210/twisted/runner/__init__.py Sat Feb 27 20:16:00 2016
@@ -5,5 +5,13 @@
Twisted Runner: Run and monitor processes.
"""
-from twisted.runner._version import version
+from twisted.python.versions import Version
+from twisted.python.deprecate import deprecatedModuleAttribute
+
+from twisted._version import version
__version__ = version.short()
+
+deprecatedModuleAttribute(
+ Version("Twisted", 16, 0, 0),
+ "Use twisted.__version__ instead.",
+ "twisted.runner", "__version__")
Modified: branches/release-16.0.0-8210/twisted/test/test_twisted.py
==============================================================================
--- branches/release-16.0.0-8210/twisted/test/test_twisted.py (original)
+++ branches/release-16.0.0-8210/twisted/test/test_twisted.py Sat Feb 27 20:16:00 2016
@@ -9,10 +9,13 @@
from __future__ import division, absolute_import
import sys
+import twisted
+
from types import ModuleType, FunctionType
from twisted import _checkRequirements
from twisted.python.compat import _PY3
+from twisted.python import reflect
from twisted.trial.unittest import TestCase, SkipTest
@@ -634,3 +637,64 @@
pass
else:
raise SkipTest("Mismatched system version of zope.interface")
+
+
+
+class OldSubprojectDeprecationBase(TestCase):
+ """
+ Base L{TestCase} for verifying each former subproject has a deprecated
+ C{__version__} and a removed C{_version.py}.
+ """
+ subproject = None
+
+ def test_deprecated(self):
+ """
+ The C{__version__} attribute of former subprojects is deprecated.
+ """
+ module = reflect.namedAny("twisted.{}".format(self.subproject))
+ self.assertEqual(module.__version__, twisted.__version__)
+
+ warningsShown = self.flushWarnings()
+ self.assertEqual(1, len(warningsShown))
+ self.assertEqual(
+ "twisted.{}.__version__ was deprecated in Twisted 16.0.0: "
+ "Use twisted.__version__ instead.".format(self.subproject),
+ warningsShown[0]['message'])
+
+
+ def test_noversionpy(self):
+ """
+ Former subprojects no longer have an importable C{_version.py}.
+ """
+ with self.assertRaises(AttributeError):
+ reflect.namedAny(
+ "twisted.{}._version".format(self.subproject))
+
+
+
+subprojects = ["mail", "conch", "runner", "web", "words", "names", "news",
+ "pair"]
+
+for subproject in subprojects:
+
+ class SubprojectTestCase(OldSubprojectDeprecationBase):
+ """
+ See L{OldSubprojectDeprecationBase}.
+ """
+ subproject = subproject
+
+ newName = subproject.title() + "VersionDeprecationTests"
+
+ SubprojectTestCase.__name__ = newName
+ if _PY3:
+ SubprojectTestCase.__qualname__= ".".join(
+ OldSubprojectDeprecationBase.__qualname__.split()[0:-1] +
+ [newName])
+
+ globals().update({subproject.title() +
+ "VersionDeprecationTests": SubprojectTestCase})
+
+ del SubprojectTestCase
+ del newName
+
+del OldSubprojectDeprecationBase
Modified: branches/release-16.0.0-8210/twisted/web/__init__.py
==============================================================================
--- branches/release-16.0.0-8210/twisted/web/__init__.py (original)
+++ branches/release-16.0.0-8210/twisted/web/__init__.py Sat Feb 27 20:16:00 2016
@@ -11,6 +11,13 @@
a L{web client<twisted.web.client>}.
"""
-from twisted.web._version import version
+from twisted.python.versions import Version
+from twisted.python.deprecate import deprecatedModuleAttribute
+from twisted._version import version
__version__ = version.short()
+
+deprecatedModuleAttribute(
+ Version("Twisted", 16, 0, 0),
+ "Use twisted.__version__ instead.",
+ "twisted.web", "__version__")
Modified: branches/release-16.0.0-8210/twisted/words/__init__.py
==============================================================================
--- branches/release-16.0.0-8210/twisted/words/__init__.py (original)
+++ branches/release-16.0.0-8210/twisted/words/__init__.py Sat Feb 27 20:16:00 2016
@@ -7,5 +7,13 @@
services.
"""
-from twisted.words._version import version
+from twisted.python.versions import Version
+from twisted.python.deprecate import deprecatedModuleAttribute
+
+from twisted._version import version
__version__ = version.short()
+
+deprecatedModuleAttribute(
+ Version("Twisted", 16, 0, 0),
+ "Use twisted.__version__ instead.",
+ "twisted.words", "__version__")