util: Mark deprecated functions with warning

This ensures the functions can actually be removed as expected.

Signed-off-by: Stephen Finucane <stephen@that.guru>
This commit is contained in:
Stephen Finucane 2018-02-05 21:37:45 +00:00
parent 05f851fa19
commit d35cda9943
2 changed files with 12 additions and 2 deletions

View File

@ -18,6 +18,7 @@ import sys
import tempfile
import traceback
import unicodedata
import warnings
from codecs import BOM_UTF8
from collections import deque
from datetime import datetime
@ -29,6 +30,7 @@ from six import text_type, binary_type, itervalues
from six.moves import range
from six.moves.urllib.parse import urlsplit, urlunsplit, quote_plus, parse_qsl, urlencode
from sphinx.deprecation import RemovedInSphinx30Warning
from sphinx.errors import PycodeError, SphinxParallelError, ExtensionError
from sphinx.util import logging
from sphinx.util.console import strip_colors, colorize, bold, term_width_line # type: ignore
@ -172,6 +174,9 @@ def copy_static_entry(source, targetdir, builder, context={},
Handles all possible cases of files, directories and subdirectories.
"""
warnings.warn('sphinx.util.copy_static_entry is deprecated for removal',
RemovedInSphinx30Warning)
if exclude_matchers:
relpath = relative_path(path.join(builder.srcdir, 'dummy'), source)
for matcher in exclude_matchers:

View File

@ -19,11 +19,14 @@ import re
import shutil
import sys
import time
import warnings
from io import BytesIO, StringIO
from os import path
from six import PY2, PY3, text_type
from sphinx.deprecation import RemovedInSphinx30Warning
if False:
# For type annotation
from typing import Any, Iterator, List, Tuple, Union # NOQA
@ -181,8 +184,10 @@ def make_filename(string):
def ustrftime(format, *args):
# type: (unicode, Any) -> unicode
# [DEPRECATED] strftime for unicode strings
# It will be removed at Sphinx-1.5
"""[DEPRECATED] strftime for unicode strings."""
warnings.warn('sphinx.util.osutil.ustrtime is deprecated for removal',
RemovedInSphinx30Warning)
if not args:
# If time is not specified, try to use $SOURCE_DATE_EPOCH variable
# See https://wiki.debian.org/ReproducibleBuilds/TimestampsProposal