[Python-modules-commits] [awscli] 01/04: New upstream version 1.11.121

Takaki Taniguchi takaki at moszumanska.debian.org
Wed Jul 19 10:04:47 UTC 2017


This is an automated email from the git hooks/post-receive script.

takaki pushed a commit to branch master
in repository awscli.

commit bf6733d5a4e2bdbc9d024ba01621877d0f60dbb3
Author: TANIGUCHI Takaki <takaki at asis.media-as.org>
Date:   Wed Jul 19 19:02:00 2017 +0900

    New upstream version 1.11.121
---
 PKG-INFO                                           |  2 +-
 awscli.egg-info/PKG-INFO                           |  2 +-
 awscli.egg-info/requires.txt                       | 10 +--
 awscli/__init__.py                                 |  2 +-
 awscli/alias.py                                    |  3 +-
 awscli/compat.py                                   | 78 ++++++++++++++++++++++
 awscli/customizations/cloudformation/deployer.py   |  8 ++-
 awscli/customizations/cloudformation/yamlhelper.py | 19 ++++--
 setup.cfg                                          |  2 +-
 setup.py                                           |  2 +-
 10 files changed, 109 insertions(+), 19 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index 77d30de..2ccee69 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: awscli
-Version: 1.11.117
+Version: 1.11.121
 Summary: Universal Command Line Environment for AWS.
 Home-page: http://aws.amazon.com/cli/
 Author: Amazon Web Services
diff --git a/awscli.egg-info/PKG-INFO b/awscli.egg-info/PKG-INFO
index 77d30de..2ccee69 100644
--- a/awscli.egg-info/PKG-INFO
+++ b/awscli.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: awscli
-Version: 1.11.117
+Version: 1.11.121
 Summary: Universal Command Line Environment for AWS.
 Home-page: http://aws.amazon.com/cli/
 Author: Amazon Web Services
diff --git a/awscli.egg-info/requires.txt b/awscli.egg-info/requires.txt
index a50bbe1..f240b84 100644
--- a/awscli.egg-info/requires.txt
+++ b/awscli.egg-info/requires.txt
@@ -1,9 +1,9 @@
-botocore==1.5.80
-colorama>=0.2.5,<=0.3.7
+botocore==1.5.84
+colorama<=0.3.7,>=0.2.5
 docutils>=0.10
-rsa>=3.1.2,<=3.5.0
-s3transfer>=0.1.9,<0.2.0
-PyYAML>=3.10,<=3.12
+rsa<=3.5.0,>=3.1.2
+s3transfer<0.2.0,>=0.1.9
+PyYAML<=3.12,>=3.10
 
 [:python_version=="2.6"]
 argparse>=1.1
diff --git a/awscli/__init__.py b/awscli/__init__.py
index 435a311..e585d61 100644
--- a/awscli/__init__.py
+++ b/awscli/__init__.py
@@ -17,7 +17,7 @@ A Universal Command Line Environment for Amazon Web Services.
 """
 import os
 
-__version__ = '1.11.117'
+__version__ = '1.11.121'
 
 #
 # Get our data path to be added to botocore's search path
diff --git a/awscli/alias.py b/awscli/alias.py
index 90feb6d..31e58ad 100644
--- a/awscli/alias.py
+++ b/awscli/alias.py
@@ -17,6 +17,7 @@ import subprocess
 
 from botocore.configloader import raw_config_parse
 
+from awscli.compat import compat_shell_quote
 from awscli.commands import CLICommand
 from awscli.utils import emit_top_level_args_parsed_event
 
@@ -274,7 +275,7 @@ class ExternalAliasCommand(BaseAliasCommand):
         command_components = [
             self._alias_value[1:]
         ]
-        command_components.extend(args)
+        command_components.extend(compat_shell_quote(a) for a in args)
         command = ' '.join(command_components)
         LOG.debug(
             'Using external alias %r with value: %r to run: %r',
diff --git a/awscli/compat.py b/awscli/compat.py
index 0a7a7be..19bf70a 100644
--- a/awscli/compat.py
+++ b/awscli/compat.py
@@ -179,3 +179,81 @@ def compat_input(prompt):
     sys.stdout.write(prompt)
     sys.stdout.flush()
     return raw_input()
+
+
+def compat_shell_quote(s, platform=None):
+    """Return a shell-escaped version of the string *s*
+
+    Unfortunately `shlex.quote` doesn't support Windows, so this method
+    provides that functionality.
+    """
+    if platform is None:
+        platform = sys.platform
+
+    if platform == "win32":
+        return _windows_shell_quote(s)
+    else:
+        return shlex_quote(s)
+
+
+def _windows_shell_quote(s):
+    """Return a Windows shell-escaped version of the string *s*
+
+    Windows has potentially bizarre rules depending on where you look. When 
+    spawning a process via the Windows C runtime the rules are as follows:
+
+    https://docs.microsoft.com/en-us/cpp/cpp/parsing-cpp-command-line-arguments
+
+    To summarize the relevant bits:
+
+    * Only space and tab are valid delimiters
+    * Double quotes are the only valid quotes
+    * Backslash is interpreted literally unless it is part of a chain that 
+      leads up to a double quote. Then the backslashes escape the backslashes,
+      and if there is an odd number the final backslash escapes the quote.
+
+    :param s: A string to escape
+    :return: An escaped string
+    """
+    if not s:
+        return '""'
+
+    buff = []
+    num_backspaces = 0
+    for character in s:
+        if character == '\\':
+            # We can't simply append backslashes because we don't know if
+            # they will need to be escaped. Instead we separately keep track
+            # of how many we've seen.
+            num_backspaces += 1
+        elif character == '"':
+            if num_backspaces > 0:
+                # The backslashes are part of a chain that lead up to a
+                # double quote, so they need to be escaped.
+                buff.append('\\' * (num_backspaces * 2))
+                num_backspaces = 0
+
+            # The double quote also needs to be escaped. The fact that we're
+            # seeing it at all means that it must have been escaped in the
+            # original source.
+            buff.append('\\"')
+        else:
+            if num_backspaces > 0:
+                # The backslashes aren't part of a chain leading up to a
+                # double quote, so they can be inserted directly without
+                # being escaped.
+                buff.append('\\' * num_backspaces)
+                num_backspaces = 0
+            buff.append(character)
+
+    # There may be some leftover backspaces if they were on the trailing
+    # end, so they're added back in here.
+    if num_backspaces > 0:
+        buff.append('\\' * num_backspaces)
+
+    new_s = ''.join(buff)
+    if ' ' in new_s or '\t' in new_s:
+        # If there are any spaces or tabs then the string needs to be double
+        # quoted.
+        return '"%s"' % new_s
+    return new_s
diff --git a/awscli/customizations/cloudformation/deployer.py b/awscli/customizations/cloudformation/deployer.py
index 533a95e..2cf69c2 100644
--- a/awscli/customizations/cloudformation/deployer.py
+++ b/awscli/customizations/cloudformation/deployer.py
@@ -124,8 +124,8 @@ class Deployer(object):
 
         # Wait for changeset to be created
         waiter = self._client.get_waiter("change_set_create_complete")
-        # Poll every 10 seconds. Changeset creation should be fast
-        waiter.config.delay = 10
+        # Poll every 5 seconds. Changeset creation should be fast
+        waiter.config.delay = 5
         try:
             waiter.wait(ChangeSetName=changeset_id, StackName=stack_name)
         except botocore.exceptions.WaiterError as ex:
@@ -169,6 +169,10 @@ class Deployer(object):
             raise RuntimeError("Invalid changeset type {0}"
                                .format(changeset_type))
 
+        # Poll every 5 seconds. Optimizing for the case when the stack has only
+        # minimal changes, such the Code for Lambda Function
+        waiter.config.delay = 5
+
         try:
             waiter.wait(StackName=stack_name)
         except botocore.exceptions.WaiterError as ex:
diff --git a/awscli/customizations/cloudformation/yamlhelper.py b/awscli/customizations/cloudformation/yamlhelper.py
index c20815c..84d6044 100644
--- a/awscli/customizations/cloudformation/yamlhelper.py
+++ b/awscli/customizations/cloudformation/yamlhelper.py
@@ -10,11 +10,12 @@
 # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
 # ANY KIND, either express or implied. See the License for the specific
 # language governing permissions and limitations under the License.
-
+import json
 import yaml
-from awscli.compat import six
 from yaml.resolver import ScalarNode, SequenceNode
 
+from awscli.compat import six
+
 
 def intrinsics_multi_constructor(loader, tag_prefix, node):
     """
@@ -63,7 +64,13 @@ def yaml_dump(dict_to_dump):
 
 
 def yaml_parse(yamlstr):
-
-    yaml.SafeLoader.add_multi_constructor("!", intrinsics_multi_constructor)
-
-    return yaml.safe_load(yamlstr)
+    """Parse a yaml string"""
+    try:
+        # PyYAML doesn't support json as well as it should, so if the input
+        # is actually just json it is better to parse it with the standard
+        # json parser.
+        return json.loads(yamlstr)
+    except ValueError:
+        yaml.SafeLoader.add_multi_constructor(
+            "!", intrinsics_multi_constructor)
+        return yaml.safe_load(yamlstr)
diff --git a/setup.cfg b/setup.cfg
index bd2b195..42ef405 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -3,7 +3,7 @@ universal = 1
 
 [metadata]
 requires-dist = 
-	botocore==1.5.80
+	botocore==1.5.84
 	colorama>=0.2.5,<=0.3.7
 	docutils>=0.10
 	rsa>=3.1.2,<=3.5.0
diff --git a/setup.py b/setup.py
index 76b54e7..af0a803 100644
--- a/setup.py
+++ b/setup.py
@@ -23,7 +23,7 @@ def find_version(*file_paths):
     raise RuntimeError("Unable to find version string.")
 
 
-requires = ['botocore==1.5.80',
+requires = ['botocore==1.5.84',
             'colorama>=0.2.5,<=0.3.7',
             'docutils>=0.10',
             'rsa>=3.1.2,<=3.5.0',

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/awscli.git



More information about the Python-modules-commits mailing list