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

Change subject: ask for permission to run patch command warning that several 
scripts might fail, if modules are not installed as needed
......................................................................


ask for permission to run patch command
warning that several scripts might fail, if modules are not installed as needed

Change-Id: Ieaea7b24bee1f569577a1c9ce9dfc9c6f84f4ef4
---
M externals/__init__.py
1 file changed, 18 insertions(+), 1 deletion(-)

Approvals:
  Merlijn van Deen: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/externals/__init__.py b/externals/__init__.py
index 83045f5..c58c375 100644
--- a/externals/__init__.py
+++ b/externals/__init__.py
@@ -162,6 +162,8 @@
                  'pydmtx', 'py_w3c', '_zbar', ]
 # OPEN: 'opencv', 'slic', '_bob', 'xbob_flandmark',
 
+_patch_permission = None
+
 
 import os
 import sys
@@ -206,6 +208,15 @@
                      " (y/N)")
     v = raw_input().upper()
     return v == 'Y' or v == 'YES'
+
+def show_patch_question():
+    globals _patch_permission
+    if _patch_permission is None:
+        lowlevel_warning("Give externals permission to execute the patch 
command?"
+                         " (y/N)")
+        v = raw_input().upper()
+        _patch_permission = (v == 'Y') or (v == 'YES')
+    return _patch_permission
 
 
 def python_module_exists(module_name):
@@ -335,7 +346,7 @@
             shutil.rmtree(os.path.join(path, '__setup_tmp/'))
 
             result = 0
-            if 'patch' in package:
+            if ('patch' in package) and show_patch_question():
                 lowlevel_warning(u'Install package "%s" by applying patch to 
%s.'
                                  % (module, os.path.join(path, module)))
                 if sys.platform == 'win32':
@@ -389,6 +400,12 @@
         return
 
     lowlevel_warning(u'Package "%s" could not be found nor installed!' % m)
+    lowlevel_warning(u'Several scripts might fail, if some modules are not'
+                     u' installed as needed! You can either install them'
+                     u' by yourself to the system or extract them into the'
+                     u' externals/ directory. If you chose to not install them'
+                     u' this script will ask you again next time whether you'
+                     u' whish to install the external code.')
 
 
 def check_setup_all():

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

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

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

Reply via email to