DrTrigon has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/77341


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(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/compat 
refs/changes/41/77341/1

diff --git a/externals/__init__.py b/externals/__init__.py
index 13ea4c4..c1c41ba 100644
--- a/externals/__init__.py
+++ b/externals/__init__.py
@@ -164,6 +164,8 @@
                  'pydmtx', 'py_w3c', '_zbar', ]
 # OPEN: 'opencv', 'slic', '_bob', 'xbob_flandmark',
 
+_patch_permission = None
+
 
 import os
 import sys
@@ -208,6 +210,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):
@@ -337,7 +348,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':
@@ -391,6 +402,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: newchange
Gerrit-Change-Id: Ieaea7b24bee1f569577a1c9ce9dfc9c6f84f4ef4
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: DrTrigon <dr.tri...@surfeu.ch>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to