-
Notifications
You must be signed in to change notification settings - Fork 229
Script to create a self-contained installation of the EBCLI #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
e548ccc
to
5ff6123
Compare
This script will: - create a unique virtualenv for the EBCLI - create .py, .bat, .ps1 wrappers around it such that when any of these wrappers is invoked to execute an 'eb' command, the unique virtualenv is activated. After the 'eb' process is returned, the virtualenv is deactivated.
This will be useful during testing specific commits/development versions of the package
5ff6123
to
34de91a
Compare
|
||
Prerequisites: | ||
|
||
1. Python + pip (preferably Python 3.7, although Python 2.7, 3.4, 3.5, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonder if this may be digging us a hole that leads to problems down the line. Why not just make it 3.7?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
There was a brief period where I felt it might be more work to restrict Python 2.7 usage, however, I don't think that is a problem anymore given that we are providing a way for them to install Python as well.
I'll make the change in future PR.
ebcli_ps1_script_path = os.path.join(executables_dir, 'eb.ps1') | ||
ebcli_bat_script_path = os.path.join(executables_dir, 'eb.bat') | ||
|
||
if sys.platform.startswith('win32'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this true for both x86 and amd64 platforms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes :)
1. Overview
This script will:
.py
,.bat
,.ps1
wrappers around it such that when any of these wrappers is invoked to execute an 'eb' command, the uniquevirtualenv
is activated. After theeb
process is returned, thevirtualenv
is deactivated.2. Installation Prerequisites
virtualenv
Typically, modern Python installations include
pip
, so the user shouldn't have to installpip
separately.It has been recognized that installing Python, and
virtualenv
(throughpip
) can challenge some users, so a future effort will solve this problem throughpyenv
.3. Testing:
Without a Python in
PATH
:python bundled_installer.py
, the script fails/path/to/python bundled_installer.py
, the script fails to create a virtualenv, and hence fails/path/to/python bundled_installer.py --python-installation /path/to/python
:virtualenv
cannot be found, the script failsvirtualenv
exists, the script succeeds in installingeb
and its wrappersupon a successful installation on Linux/MacOS:
eb
was successfully installedupon a successful installation on Windows:
eb
will be unavailable; the shell needs to be restarted.by default, the latest version of the EBCLI on PyPi is installed. If the isolated virtualenv already exists, an attempt to upgrade the installation will be made (the script will always perform
pip install --upgrade awsebcli
.older versions of the EBCLI can be installed as
python bundled_installer.py --version VERSION
.by default, the virtualenv is installed in the user's home directory. If home cannot be determined, the script is exited after informing the user that they need to pass
--location LOCATION
explicitly.with the
--location LOCATION
argument, the virtualenv is installed atLOCATION
. Consequently, the instructions to amend path will referenceLOCATION
.each of the
eb
wrappers should exit with the exit code the realeb
command returned. (useecho $?
,$LASTEXITCODE
,echo %ERRORLEVEL%
, on Bash/Zsh, PowerShell and CMD Promp respectively).if the virtualenv already exists but was not created by the script, an error message is printed asking the user to either delete the directory or to specify an alternate location using
--location LOCATION
.4. Shortcomings
installation is not supported on Windows using Cygwin, git-bash, and other Unix-like shells.
Python, and
virtualenv
are prerequisitesBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.