jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/647616 )
Change subject: [cleanup] Remove deprecated version.getfileversion function ......................................................................
[cleanup] Remove deprecated version.getfileversion function
Pywikibot does not have a version number for each file anymore. This function can be removed safely.
Change-Id: I449be83403e933ec3611d5982e3569b091776f52 --- M pywikibot/version.py 1 file changed, 0 insertions(+), 33 deletions(-)
Approvals: Mpaa: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/version.py b/pywikibot/version.py index ce66b6f..333a7f0 100644 --- a/pywikibot/version.py +++ b/pywikibot/version.py @@ -5,7 +5,6 @@ # # Distributed under the terms of the MIT license. # -import codecs import datetime import json import os @@ -384,38 +383,6 @@ raise ParseError(repr(e) + ' while parsing ' + repr(buf))
-@deprecated('get_module_version, get_module_filename and get_module_mtime', - since='20150221', future_warning=True) -def getfileversion(filename: str): # pragma: no cover - """Retrieve revision number of file. - - Extracts __version__ variable containing Id tag, without importing it. - (thus can be done for any file) - - The version variable containing the Id tag is read and - returned. Because it doesn't import it, the version can - be retrieved from any file. - @param filename: Name of the file to get version - """ - _program_dir = _get_program_dir() - __version__ = None - mtime = None - fn = os.path.join(_program_dir, filename) - if os.path.exists(fn): - with codecs.open(fn, 'r', 'utf-8') as f: - for line in f.readlines(): - if line.find('__version__') == 0: - with suppress(Exception): - exec(line) - break - stat = os.stat(fn) - mtime = datetime.datetime.fromtimestamp(stat.st_mtime).isoformat(' ') - if mtime and __version__: - return '%s %s %s' % (filename, __version__[5:-1][:7], mtime) - else: - return None - - @deprecated('pywikibot.__version__', since='20201003') def get_module_version(module) -> Optional[str]: """
pywikibot-commits@lists.wikimedia.org