From c719da5bca1d574b297b073803f158677bb29091 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Sat, 8 Oct 2016 17:21:36 +0100 Subject: [PATCH] [sstruct/xmlWriter]: issue a deprecation warning when the two top-level modules are imported Part of #696 (These are a actually `UserWarning` instead of `DeprecationWarning`, as the latter are normally muted) --- Lib/sstruct.py | 7 +++++++ Lib/xmlWriter.py | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/Lib/sstruct.py b/Lib/sstruct.py index aeb06c53f..075705f44 100644 --- a/Lib/sstruct.py +++ b/Lib/sstruct.py @@ -5,3 +5,10 @@ from fontTools.misc.py23 import * from fontTools.misc.sstruct import * from fontTools.misc.sstruct import __doc__ + +import warnings + +warnings.warn( + "Importing the stand-alone `sstruct` module is deprecated. " + "Use `from fontTools.misc import sstruct` instead.", + stacklevel=2) diff --git a/Lib/xmlWriter.py b/Lib/xmlWriter.py index ddf244a49..a94230ff9 100644 --- a/Lib/xmlWriter.py +++ b/Lib/xmlWriter.py @@ -5,3 +5,10 @@ from fontTools.misc.py23 import * from fontTools.misc.xmlWriter import * from fontTools.misc.xmlWriter import __doc__ + +import warnings + +warnings.warn( + "Importing the stand-alone `xmlWriter` module is deprecated. " + "Use `from fontTools.misc import xmlWriter` instead.", + stacklevel=2)