jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/327857 )
Change subject: Make script_wui.py not require the `resource` module ......................................................................
Make script_wui.py not require the `resource` module
The module, which is unix specific, is only used for part of a debug statement.
Change-Id: I706b8f85ff280d7a40d7277aa1654c33705d3f6c --- M scripts/script_wui.py 1 file changed, 14 insertions(+), 7 deletions(-)
Approvals: John Vandenberg: Looks good to me, but someone else must approve Magul: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/script_wui.py b/scripts/script_wui.py index ba75271..e024b66 100755 --- a/scripts/script_wui.py +++ b/scripts/script_wui.py @@ -74,7 +74,6 @@ import gc import logging import re -import resource import sys import threading import traceback @@ -104,6 +103,10 @@ else: import thread # flake8: disable=H237 (module does not exist in Python 3)
+try: + import resource +except ImportError: + resource = None
bot_config = { 'BotName': "{username}", @@ -273,12 +276,16 @@ # safety; restore settings pywikibot.config.simulate = __simulate sys.argv = __sys_argv - - pywikibot.output( - u'environment: garbage; %s / memory; %s / members; %s' % ( - gc.collect(), - resource.getrusage(resource.RUSAGE_SELF).ru_maxrss * resource.getpagesize(), - len(dir()))) + if resource: + pywikibot.output( + u'environment: garbage; %s / memory; %s / members; %s' % ( + gc.collect(), + resource.getrusage(resource.RUSAGE_SELF).ru_maxrss * resource.getpagesize(), + len(dir()))) + else: + pywikibot.output( + u'environment: garbage; %s / members; %s' % ( + gc.collect(), len(dir()))) # 'len(dir())' is equivalent to 'len(inspect.getmembers(__main__))'
# append result to output page
pywikibot-commits@lists.wikimedia.org