Rev 3423: Cherrypick the deprecation suppression for 1.5 in http://bzr.arbash-meinel.com/branches/bzr/jam-integration
John Arbash Meinel
john at arbash-meinel.com
Fri May 16 17:55:25 BST 2008
At http://bzr.arbash-meinel.com/branches/bzr/jam-integration
------------------------------------------------------------
revno: 3423
revision-id: john at arbash-meinel.com-20080516165444-p55ebidnm1oc469p
parent: john at arbash-meinel.com-20080516164503-y3ebewxs2gsypbtr
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Fri 2008-05-16 11:54:44 -0500
message:
Cherrypick the deprecation suppression for 1.5
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/commands.py bzr.py-20050309040720-d10f4714595cf8c3
bzrlib/symbol_versioning.py symbol_versioning.py-20060105104851-9ecf8af605d15a80
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2008-05-16 16:45:03 +0000
+++ b/NEWS 2008-05-16 16:54:44 +0000
@@ -8,6 +8,14 @@
bzr 1.5 2008-05-16
------------------
+ CHANGES:
+
+ * Suppress deprecation warnings when bzrlib is a 'final' release. This way
+ users of packaged software won't be bothered with DeprecationWarnings,
+ but developers and testers will still see them. (John Arbash Meinel)
+
+ DOCUMENTATION:
+
* Incorporate feedback from Jelmer Vernooij and Neil Martinsen-Burrell
on the plugin and integration chapters of the User Guide.
(Ian Clatworthy)
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py 2008-05-08 04:21:01 +0000
+++ b/bzrlib/commands.py 2008-05-16 16:54:44 +0000
@@ -824,6 +824,11 @@
import bzrlib.ui
from bzrlib.ui.text import TextUIFactory
bzrlib.ui.ui_factory = TextUIFactory()
+
+ # Is this a final release version? If so, we should suppress warnings
+ if bzrlib.version_info[3] == 'final':
+ from bzrlib import symbol_versioning
+ symbol_versioning.suppress_deprecation_warnings()
try:
argv = [a.decode(bzrlib.user_encoding) for a in argv[1:]]
except UnicodeDecodeError:
=== modified file 'bzrlib/symbol_versioning.py'
--- a/bzrlib/symbol_versioning.py 2008-05-02 07:31:24 +0000
+++ b/bzrlib/symbol_versioning.py 2008-05-16 16:54:44 +0000
@@ -328,3 +328,29 @@
return self._warn_deprecated(list.pop)
return _DeprecatedList(initial_value)
+
+
+def suppress_deprecation_warnings():
+ """Call this function to suppress all deprecation warnings.
+
+ When this is a final release version, we don't want to annoy users with
+ lots of deprecation warnings. We only want the deprecation warnings when
+ running a dev or release candidate.
+ """
+ import warnings
+ warnings.filterwarnings('ignore', category=DeprecationWarning)
+
+
+def activate_deprecation_warnings():
+ """Call this function to activate deprecation warnings.
+
+ When running in a 'final' release we suppress deprecation warnings.
+ However, the test suite wants to see them. So when running selftest, we
+ re-enable the deprecation warnings.
+
+ Note: warnings that have already been issued under 'ignore' will not be
+ reported after this point. The 'warnings' module has already marked them as
+ handled, so they don't get issued again.
+ """
+ import warnings
+ warnings.filterwarnings('default', category=DeprecationWarning)
More information about the bazaar-commits
mailing list