From 8306771da37e7615b85a332ee867f9a46d8f2a01 Mon Sep 17 00:00:00 2001 From: Rahul Rajaram Date: Wed, 22 May 2019 22:55:33 -0700 Subject: [PATCH 1/5] Fix issue involving spaces within virtualenv DEST_DIR path When the value of the --location argument of ebcli_installer.py (or the path of the HOME directory) contain spaces, the installer passes multiple values in place of virtualenv's DEST_DIR positional argument. virtualenv rejects the multi-value input and causes the creation of the EB CLI's vrtualenv to fail. This was originally reported in Issue #20 [1]. This commit fixes the problem by enclosing the value for DEST_DIR within quotes before passing it to the virtualenv executable. [1] https://github.com/aws/aws-elastic-beanstalk-cli-setup/issues/20 --- scripts/ebcli_installer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ebcli_installer.py b/scripts/ebcli_installer.py index 22d4137..2c8b12b 100644 --- a/scripts/ebcli_installer.py +++ b/scripts/ebcli_installer.py @@ -447,11 +447,11 @@ def _create_virtualenv( virtualenv_args = [ virtualenv_executable or 'virtualenv', - virtualenv_directory + '"{}"'.format(virtualenv_directory) ] python_installation and virtualenv_args.extend( - ['-p', python_installation] + ['-p', '"{}"'.format(python_installation)] ) if _exec_cmd(virtualenv_args, quiet) != 0: From dcd941dfaedfa49a3b81dfc14ddafe891d5c0746 Mon Sep 17 00:00:00 2001 From: Rahul Rajaram Date: Wed, 22 May 2019 23:04:47 -0700 Subject: [PATCH 2/5] Default to creating virtualenv using Python used to invoke ebcli_installer.py The current behaviour of the ebcli_installer.py is to not pass a Python executable's PATH to virtualenv to create a sandbox for the EB CLI. As a result, virtualenv may use a Python other than the one used to invoke ebcli_installer.py. This behaviour is confusing. On some systems where the default Python is 2.7, virtualenv may use that, thereby defeating the goal to use the latest and greatest. This commit ensures that ebcli_installer.py passes the path to the Python executable used to invoke it to virtualenv to create a sandbox for the EB CLI with. --- scripts/ebcli_installer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ebcli_installer.py b/scripts/ebcli_installer.py index 2c8b12b..b16b059 100644 --- a/scripts/ebcli_installer.py +++ b/scripts/ebcli_installer.py @@ -426,6 +426,7 @@ def _create_virtualenv( """ virtualenv_location = virtualenv_location or _user_local_directory() virtualenv_directory = os.path.join(virtualenv_location, VIRTUALENV_DIR_NAME) + python_installation = python_installation or sys.executable if ( os.path.exists(virtualenv_directory) From df683359ddd17112c05500c6fbdae728b758dc0c Mon Sep 17 00:00:00 2001 From: Rahul Rajaram Date: Wed, 22 May 2019 23:16:06 -0700 Subject: [PATCH 3/5] Add suggestion to install zlib on OS X Python 3.7.2 installation on OS X can fail if Zlib modules are unavailable. This issue was originally brought up in Issue #22 [1]. This commit recommends customers to run `brew install zlib` prior to setting the linker and compiler flags for zlib. [1] - https://github.com/aws/aws-elastic-beanstalk-cli-setup/issues/22 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a530bcc..c628759 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ On **Bash** and **Zsh** on OS X/Linux: **NOTE:** On OS X, if you see installation failing with the following message, "zipimport.ZipImportError: can't decompress data; zlib not available", perform the following exports and then retry the above command: ```bash +brew install zlib export LDFLAGS="-L/usr/local/opt/zlib/lib" export CPPFLAGS="-I/usr/local/opt/zlib/include" ``` From 5fc517f742763631ef7d6624967b14263516d32c Mon Sep 17 00:00:00 2001 From: Rahul Rajaram Date: Wed, 22 May 2019 23:24:55 -0700 Subject: [PATCH 4/5] Exit with a non-zero code when EB CLI installation fails --- scripts/ebcli_installer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/ebcli_installer.py b/scripts/ebcli_installer.py index b16b059..378562e 100644 --- a/scripts/ebcli_installer.py +++ b/scripts/ebcli_installer.py @@ -554,7 +554,10 @@ def _install_ebcli(quiet, version, ebcli_source): '--upgrade', '--upgrade-strategy', 'eager', ] - _exec_cmd(install_args, quiet) + returncode = _exec_cmd(install_args, quiet) + + if returncode != 0: + exit(returncode) def _add_ebcli_stamp(virtualenv_directory): From b94e281ba01fcf3def61408cd22930712c8bcc51 Mon Sep 17 00:00:00 2001 From: Rahul Rajaram Date: Thu, 23 May 2019 11:20:19 -0700 Subject: [PATCH 5/5] Update package version to v0.1.2 This release fixes: 1. Issue involving spaces within virtualenv DEST_DIR path ( Issue #20 ) 2. Non-determinism involved in choosing Python executable to create virtualenv with when multiple Pythons are available on the computer. 3. zlib-related recommendation for OS X in the README ( Issues #22 / #23 ) 4. the continuation of the ebcli_installer.py script beyond its failure to install the EB CLI. --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 6e8bf73..d917d3e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0 +0.1.2