diff MoinMoin/support/werkzeug/script.py @ 6129:7f12cf241d5e

update werkzeug to 0.12.1, update CHANGES
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 11 Apr 2017 22:42:23 +0200
parents 9f12f41504fc
children
line wrap: on
line diff
--- a/MoinMoin/support/werkzeug/script.py	Tue Nov 01 17:56:32 2016 +0100
+++ b/MoinMoin/support/werkzeug/script.py	Tue Apr 11 22:42:23 2017 +0200
@@ -75,6 +75,7 @@
 import sys
 import inspect
 import getopt
+from warnings import warn
 from os.path import basename
 from werkzeug._compat import iteritems
 
@@ -95,6 +96,11 @@
 }
 
 
+def _deprecated():
+    warn(DeprecationWarning('werkzeug.script is deprecated and '
+                            'will be removed soon'), stacklevel=2)
+
+
 def run(namespace=None, action_prefix='action_', args=None):
     """Run the script.  Participating actions are looked up in the caller's
     namespace if no namespace is given, otherwise in the dict provided.
@@ -109,6 +115,7 @@
     :param args: the arguments for the function.  If not specified
                  :data:`sys.argv` without the first argument is used.
     """
+    _deprecated()
     if namespace is None:
         namespace = sys._getframe(1).f_locals
     actions = find_actions(namespace, action_prefix)
@@ -179,12 +186,14 @@
 
 def fail(message, code=-1):
     """Fail with an error."""
+    _deprecated()
     print('Error: %s' % message, file=sys.stderr)
     sys.exit(code)
 
 
 def find_actions(namespace, action_prefix):
     """Find all the actions in the namespace."""
+    _deprecated()
     actions = {}
     for key, value in iteritems(namespace):
         if key.startswith(action_prefix):
@@ -194,6 +203,7 @@
 
 def print_usage(actions):
     """Print the usage information.  (Help screen)"""
+    _deprecated()
     actions = sorted(iteritems(actions))
     print('usage: %s <action> [<options>]' % basename(sys.argv[0]))
     print('       %s --help' % basename(sys.argv[0]))
@@ -220,6 +230,7 @@
 
 def analyse_action(func):
     """Analyse a function."""
+    _deprecated()
     description = inspect.getdoc(func) or 'undocumented action'
     arguments = []
     args, varargs, kwargs, defaults = inspect.getargspec(func)
@@ -255,6 +266,7 @@
                    not specified a generic banner is used instead.
     :param use_ipython: if set to `True` ipython is used if available.
     """
+    _deprecated()
     if banner is None:
         banner = 'Interactive Werkzeug Shell'
     if init_func is None:
@@ -267,14 +279,14 @@
             try:
                 try:
                     from IPython.frontend.terminal.embed import InteractiveShellEmbed
-                    sh = InteractiveShellEmbed(banner1=banner)
+                    sh = InteractiveShellEmbed.instance(banner1=banner)
                 except ImportError:
                     from IPython.Shell import IPShellEmbed
                     sh = IPShellEmbed(banner=banner)
             except ImportError:
                 pass
             else:
-                sh(global_ns={}, local_ns=namespace)
+                sh(local_ns=namespace)
                 return
         from code import interact
         interact(banner, local=namespace)
@@ -304,6 +316,8 @@
     :param extra_files: optional list of extra files to track for reloading.
     :param ssl_context: optional SSL context for running server in HTTPS mode.
     """
+    _deprecated()
+
     def action(hostname=('h', hostname), port=('p', port),
                reloader=use_reloader, debugger=use_debugger,
                evalex=use_evalex, threaded=threaded, processes=processes):