From 7081aac0cc00bd46da125e9ee9afb94aefdf5419 Mon Sep 17 00:00:00 2001 From: xqt Date: Wed, 4 Dec 2024 11:24:12 +0100 Subject: [PATCH] cleanup: remove svn_rev_info and getversion_svn functions from version module SVN repository is no longer supported. Bug: T378898 Change-Id: I8978bbb0f9a48e14624b38b0eeda2005b1f016c1 --- ROADMAP.rst | 4 +-- pywikibot/version.py | 70 ++------------------------------------------ 2 files changed, 5 insertions(+), 69 deletions(-) diff --git a/ROADMAP.rst b/ROADMAP.rst index da7976576c..013f0af6fa 100644 --- a/ROADMAP.rst +++ b/ROADMAP.rst @@ -11,6 +11,8 @@ Current Release Changes **Breaking changes and code cleanups** +* ``svn_rev_info`` and ``getversion_svn`` of :mod:`version` module were be removed. + SVN repository is no longer supported. (:phab:`T362484`) * Old color escape sequences like ``\03{color}`` were dropped in favour of new color format like ``<>`` * ``tools.formatter.color_format()`` was removed; the new color literals can be used instead * RedirectPageBot and NoRedirectPageBot bot classes were removed in favour of @@ -85,8 +87,6 @@ Pending removal in Pywikibot 11 Pending removal in Pywikibot 10 ------------------------------- -* 9.1.0: :func:`version.svn_rev_info` and :func:`version.getversion_svn` will be removed. SVN is no longer supported. - (:phab:`T362484`) * 7.7.0: :mod:`tools.threading` classes should no longer imported from :mod:`tools` * 7.6.0: :mod:`tools.itertools` datatypes should no longer imported from :mod:`tools` * 7.6.0: :mod:`tools.collections` datatypes should no longer imported from :mod:`tools` diff --git a/pywikibot/version.py b/pywikibot/version.py index 4daf5a5108..4078314b4e 100644 --- a/pywikibot/version.py +++ b/pywikibot/version.py @@ -11,12 +11,11 @@ import os import pathlib import socket -import sqlite3 import subprocess import sys import sysconfig import time -from contextlib import closing, suppress +from contextlib import suppress from importlib import import_module from pathlib import Path from warnings import warn @@ -26,8 +25,7 @@ from pywikibot.backports import cache from pywikibot.comms.http import fetch from pywikibot.exceptions import VersionParseError -from pywikibot.tools import deprecated, suppress_warnings -from pywikibot.tools._deprecate import _NotImplementedWarning +from pywikibot.tools import deprecated def _get_program_dir() -> str: @@ -91,14 +89,10 @@ def getversiondict() -> dict[str, str]: exceptions = {} for vcs_func in (getversion_git, - getversion_svn, getversion_nightly, getversion_package): try: - with suppress_warnings( - f'.*({vcs_func.__name__}|svn_rev_info) is deprecated since ' - 'release 9.1.', _NotImplementedWarning): - tag, rev, date, hsh = vcs_func(_program_dir) + tag, rev, date, hsh = vcs_func(_program_dir) except Exception as e: exceptions[vcs_func] = vcs_func.__name__, e else: @@ -128,64 +122,6 @@ def getversiondict() -> dict[str, str]: return {'tag': tag, 'rev': rev, 'date': datestring, 'hsh': hsh} -@deprecated(since='9.1') -def svn_rev_info(path): - """Fetch information about the current revision of a Subversion checkout. - - .. deprecated:: 9.1 - update to git repository. - .. versionchanged:: 9.1 - drop support for svn 1.6 and older. - - :param path: directory of the Subversion checkout - :return: - - tag (name for the repository), - - rev (current Subversion revision identifier), - - date (date of current revision), - :rtype: ``tuple`` of two ``str`` and a ``time.struct_time`` - """ - if not os.path.isdir(os.path.join(path, '.svn')): - path = os.path.join(path, '..') - - with closing( - sqlite3.connect(os.path.join(path, '.svn/wc.db'))) as con: - cur = con.cursor() - cur.execute("""select -local_relpath, repos_path, revision, changed_date, checksum from nodes -order by revision desc, changed_date desc""") - _name, tag, rev, date, _checksum = cur.fetchone() - cur.execute('select root from repository') - tag, = cur.fetchone() - - tag = os.path.split(tag)[1] - date = time.gmtime(date / 1_000_000) - return tag, rev, date - - -@deprecated(since='9.1') -def getversion_svn(path=None): - """Get version info for a Subversion checkout. - - .. deprecated:: 9.1 - update to git repository. - - :param path: directory of the Subversion checkout - :return: - - tag (name for the repository), - - rev (current Subversion revision identifier), - - date (date of current revision), - - hash '(unknown)' - :rtype: ``tuple`` of three ``str`` and a ``time.struct_time`` - """ - _program_dir = path or _get_program_dir() - tag, rev, date = svn_rev_info(_program_dir) - rev = f's{rev}' - - if (not date or not tag or not rev) and not path: - raise VersionParseError - return (tag, rev, date, '(unknown)') - - def getversion_git(path=None): """Get version info for a Git clone.