jenkins-bot merged this change.

View Change

Approvals: Dvorapa: Looks good to me, approved jenkins-bot: Verified
[bugfix] fix getversion_svn for Python 3.6+

- fix getversion_svn for Python 3.6+ which has a different
value for struct_time.n_fields attribute; use len() instead.

- pathlib is mandatory for pywikibot. It is no longer necessary
to have a fallback to os.

- remove getversion_svn deprecation warning

getversion_svn_setuptools uses svn_utils from setuptools
or setuptools_svn. Both aren't included neither in Python 3
nor in Python 2. It is not usefull to recommend installing
an external library to just get the version.

getversion_svn is still working and needed as a fallback
if external packages aren't installed. Do no longer show a
deprecation warning which is not appropriate.

Bug: T253617
Bug: T132292
Change-Id: I66ae3f6a4ba5a7be343ec10c6f8e9671894763f5
---
M pywikibot/version.py
1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/pywikibot/version.py b/pywikibot/version.py
index 696d72e..3806e06 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Module to determine the pywikibot version (tag, revision and date)."""
#
-# (C) Pywikibot team, 2007-2019
+# (C) Pywikibot team, 2007-2020
#
# Distributed under the terms of the MIT license.
#
@@ -34,10 +34,8 @@
try:
import pathlib
except ImportError:
- try:
- import pathlib2 as pathlib
- except ImportError as e:
- pathlib = e
+ import pathlib2 as pathlib # Python 2
+

import pywikibot

@@ -148,7 +146,6 @@
return cache


-@deprecated('getversion_svn_setuptools', since='20150405')
def svn_rev_info(path):
"""Fetch information about the current revision of an Subversion checkout.

@@ -254,7 +251,6 @@
return (tag, rev, date, hsh)


-@deprecated('getversion_svn_setuptools', since='20150405')
def getversion_svn(path=None):
"""Get version info for a Subversion checkout.

@@ -274,7 +270,7 @@
# date.tm_isdst is -1 means unknown state
# compare its contents except daylight saving time status
else:
- for i in range(date.n_fields - 1):
+ for i in range(len(date) - 1):
assert date[i] == date2[i], 'Date of version is not consistent'

rev = 's%s' % rev
@@ -570,16 +566,10 @@
# Remove any pywikibot sub-modules which were loaded as a package.
# e.g. 'wikipedia_family.py' is loaded as 'wikipedia'
_program_dir = _get_program_dir()
- if isinstance(pathlib, Exception):
- dir_parts = _program_dir.split(os.sep)
- else:
- dir_parts = pathlib.Path(_program_dir).parts
+ dir_parts = pathlib.Path(_program_dir).parts
length = len(dir_parts)
for path, name in paths.items():
- if isinstance(pathlib, Exception):
- lib_parts = os.path.normpath(path).split(os.sep)
- else:
- lib_parts = pathlib.Path(path).parts
+ lib_parts = pathlib.Path(path).parts
if dir_parts != lib_parts[:length]:
continue
if lib_parts[length] != '.tox':

To view, visit change 282524. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I66ae3f6a4ba5a7be343ec10c6f8e9671894763f5
Gerrit-Change-Number: 282524
Gerrit-PatchSet: 5
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot (75)