jenkins-bot has submitted this change and it was merged.

Change subject: Make family file generator work with broken user_config
......................................................................


Make family file generator work with broken user_config

This reverts the removal of os.path.exists monkey patching that was
done in r10886 (git sha1 971d1150f66ddde5ea53def0c7e8f0e1edbd763c),
which means config.py will not find any user-config.py file. However,
we also restore the functionality after importing config, because
importing wikipedia requires a working os.path.exists.

Change-Id: I050d050dee536d0c44589651bff4dce866c50942
---
M generate_family_file.py
1 file changed, 7 insertions(+), 1 deletion(-)

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



diff --git a/generate_family_file.py b/generate_family_file.py
index 06464c9..05b264f 100644
--- a/generate_family_file.py
+++ b/generate_family_file.py
@@ -32,10 +32,16 @@
 import wikipediatools
 wikipediatools.get_base_dir = lambda: '.'
 
-# Set some config settings
+# Set some config settings, but monkey-patch os.path.exists to prevent loading 
user_config.py
+import os
+oldexists = os.path.exists
+os.path.exists = lambda x: False
+
 import config
 config.mylang = 'en'
 
+os.path.exists = oldexists
+
 # Now we can boot the framework
 import wikipedia
 import family

-- 
To view, visit https://gerrit.wikimedia.org/r/80238
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I050d050dee536d0c44589651bff4dce866c50942
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to