jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/481665 )

Change subject: [IMPR] Show all environment settings starting with "PYWIKIBOT"
......................................................................

[IMPR] Show all environment settings starting with "PYWIKIBOT"

Change-Id: Ie4c3f98fbb58bb34cec6db2094e6cfa64a633064
---
M scripts/version.py
1 file changed, 9 insertions(+), 10 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/scripts/version.py b/scripts/version.py
index ed06b6e..3fe6695 100755
--- a/scripts/version.py
+++ b/scripts/version.py
@@ -28,13 +28,6 @@
 WMF_CACERT = 'MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs'


-def check_environ(environ_name) -> None:
-    """Print environment variable."""
-    pywikibot.output('{0}: {1}'.format(environ_name,
-                                       os.environ.get(environ_name,
-                                                      'Not set')))
-
-
 def main(*args) -> None:
     """Print pywikibot version and important settings."""
     pywikibot.output('Pywikibot: ' + getversion())
@@ -67,9 +60,15 @@
     if toolforge_env_hostname:
         pywikibot.output('Toolforge hostname: ' + toolforge_env_hostname)

-    check_environ('PYWIKIBOT_DIR')
-    check_environ('PYWIKIBOT_DIR_PWB')
-    check_environ('PYWIKIBOT_NO_USER_CONFIG')
+    # check environment settings
+    settings = {key for key in os.environ if key.startswith('PYWIKIBOT')}
+    settings.update(['PYWIKIBOT_DIR', 'PYWIKIBOT_DIR_PWB',
+                     'PYWIKIBOT_NO_USER_CONFIG'])
+    for environ_name in sorted(settings):
+        pywikibot.output('{0}: {1}'.format(environ_name,
+                                           os.environ.get(environ_name,
+                                                          'Not set')))
+
     pywikibot.output('Config base dir: ' + pywikibot.config2.base_dir)
     for family, usernames in pywikibot.config2.usernames.items():
         if not usernames:

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/481665
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ie4c3f98fbb58bb34cec6db2094e6cfa64a633064
Gerrit-Change-Number: 481665
Gerrit-PatchSet: 6
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: Dalba <[email protected]>
Gerrit-Reviewer: Dvorapa <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-CC: Zhuyifei1999 <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to