jenkins-bot has submitted this change and it was merged.
Change subject: Decommission compat
......................................................................
Decommission compat
- update CONTENTS file and add a deprecation warning
- update copyright not in LICENSE file
- provide a user warning for decommission compat but only show it once.
The throttle.ctl is used by all scripts. Use it to remember whether
a deprecation warning is already shown to the operator.
Bug: T99365
Bug: T101214
Change-Id: I395c3560e954ccef183636b5c0b0d4e8288bc6ab
---
M CONTENTS
M LICENSE
M pywikibot/throttle.py
3 files changed, 62 insertions(+), 12 deletions(-)
Approvals:
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/CONTENTS b/CONTENTS
index ff60416..5a15700 100644
--- a/CONTENTS
+++ b/CONTENTS
@@ -2,14 +2,29 @@
example robots are included.
=======================================================================
+PLEASE NOTE: This pywikibot branch is deprecated. You may use it but no
+bug fixes, features or support is provided by the pywikibot developer
+team anymore. This package only runs for MediaWiki versions not higher
+than 1.27. Python version 2.7.2 or higher is needed but Python 3.X is
+not supported.
+
+Please use the new core branch of the pywikibot framework which supports
+MediaWiki version 1.14 upto the current version and Python release 2.7.2
+and higher as well as 3.3 and higher. Compat scripts are already migrated
+to core branch and there is a migrating tool which helps converting of
+your private scripts.
+
+To get started on proper usage of the new bot framework, please refer to:
+
+
http://www.mediawiki.org/wiki/Manual:Pywikibot
+
+=======================================================================
+
+-----------------------------------------------------------------------
PLEASE DO NOT PLAY WITH THIS PACKAGE. These programs can actually
modify the live wiki on the net, and proper wiki-etiquette should
be followed before running it on any wiki.
-=======================================================================
-
-To get started on proper usage of the bot framework, please refer to:
-
-
http://www.mediawiki.org/wiki/Manual:Pywikibot
+-----------------------------------------------------------------------
The contents of the package are:
@@ -311,10 +326,7 @@
You need to have at least python version 2.7.2 (
http://www.python.org/download/)
or newer installed on your computer to be able to run any of the code in this
-package, but not 3.x, because pywikibot is still not updated to it! Support
-for older versions of python is not planned. Some scripts could run with older
-python releases. Please refer the manual at mediawiki for further details and
-restrictions.
+package, but not 3.x. Support for other versions of python is not planned.
You do not need to "install" this package to be able to make use of
it. You can actually just run it from the directory where you unpacked
diff --git a/LICENSE b/LICENSE
index 724e5a4..3ca9422 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2015 Pywikibot team
+Copyright (c) 2004-2016 Pywikibot team
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
diff --git a/pywikibot/throttle.py b/pywikibot/throttle.py
index 08b1383..c72762a 100644
--- a/pywikibot/throttle.py
+++ b/pywikibot/throttle.py
@@ -1,9 +1,9 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
"""
Mechanics to slow down wiki read and/or write rate.
"""
#
-# (C) Pywikipedia bot team, 2008
+# (C) Pywikipedia bot team, 2008-2016
#
# Distributed under the terms of the MIT license.
#
@@ -33,6 +33,9 @@
access.
"""
+
+ message = 'Compat deprecation warning shown\n'
+
def __init__(self, mindelay=None, maxdelay=None, writedelay=None,
multiplydelay=True, verbosedelay=False, write=False):
self.lock = threading.RLock()
@@ -64,9 +67,31 @@
self.setDelay()
self.write = write
+ def _show_warning(self):
+ """Show compat deprecation waring once."""
+ pywikibot.input("""\03{lightyellow}
+PLEASE NOTE: compat pywikibot branch is deprecated. You may use it but no
+bug fixes, features or support is provided by the pywikibot developer
+team anymore.
+
+This package only runs for MediaWiki versions not higher than 1.27.
+
+Please use the new core branch of the pywikibot framework which supports
+the current version of MediaWiki. Compat scripts are already migrated
+to core branch and there is a migrating tool which helps converting of
+your private scripts.
+
+Please refer to:
+
http://www.mediawiki.org/wiki/Manual:Pywikibot
+
https://phabricator.wikimedia.org/T99365
+
+Press <enter> to continue.
+\03{default}""")
+
def checkMultiplicity(self):
"""Count running processes for site and set
process_multiplicity."""
global pid
+ warning = True
self.lock.acquire()
mysite = self.mysite = str(pywikibot.getSite())
if pywikibot.verbose:
@@ -86,6 +111,9 @@
else:
now = time.time()
for line in f.readlines():
+ if line == self.message:
+ warning = False
+ continue
# parse line; format is "pid timestamp site"
try:
line = line.split(' ')
@@ -108,6 +136,9 @@
if not pid and this_pid >= my_pid:
my_pid = this_pid+1 # next unused process id
+ if warning:
+ self._show_warning()
+
if not pid:
pid = my_pid
self.checktime = time.time()
@@ -117,6 +148,7 @@
processes.sort(key=lambda p:(p['pid'], p['site']))
try:
f = open(self.ctrlfilename, 'w')
+ f.write(self.message)
for p in processes:
f.write("%(pid)s %(time)s %(site)s\n" % p)
except IOError:
@@ -193,6 +225,7 @@
# drop all throttles with this process's pid, regardless of site
self.checktime = 0
processes = []
+ warning = False
try:
f = open(self.ctrlfilename, 'r')
except IOError:
@@ -201,6 +234,9 @@
now = time.time()
for line in f.readlines():
try:
+ if line == self.message:
+ warning = True
+ continue
line = line.split(' ')
this_pid = int(line[0])
ptime = int(line[1].split('.')[0])
@@ -216,6 +252,8 @@
processes.sort(key=lambda p:p['pid'])
try:
f = open(self.ctrlfilename, 'w')
+ if warning:
+ f.write(self.message)
for p in processes:
f.write("%(pid)s %(time)s %(site)s\n" % p)
except IOError:
--
To view, visit
https://gerrit.wikimedia.org/r/322502
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I395c3560e954ccef183636b5c0b0d4e8288bc6ab
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Andre Engels <andreengels(a)gmail.com>
Gerrit-Reviewer: BinĂ¡ris2 <wikiposta+wikitech(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <Ladsgroup(a)gmail.com>
Gerrit-Reviewer: Luke081515 <luke081515(a)web.de>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Multichill <maarten(a)mdammers.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>