@@ -330,9 +330,24 @@ def _announce_success(virtualenv_location):
330
330
331
331
332
332
def _print_in_foreground (message , color_number ):
333
+ """
334
+ Function prints a given `message` on the terminal in the foreground. `color_number`
335
+ is a number between and including 0 and 255. FOr a list of color codes see:
336
+
337
+ https://misc.flogisoft.com/bash/tip_colors_and_formatting#background1
338
+
339
+ On Windows, `color_number` is rejected, and hence not used. At present, PowerShell
340
+ is able to recognize ANSI/VT100 escape sequences, however, CMD prompt is not.
341
+
342
+ :param message: a string to print in the foreground on the terminal
343
+ :param color_number: an integer between and including 0 and 255 representing
344
+ a color
345
+ :return: None
346
+ """
333
347
if sys .platform .startswith ('win32' ):
334
348
print (message )
335
349
else :
350
+ # Courtesy https://misc.flogisoft.com/bash/tip_colors_and_formatting
336
351
print (
337
352
"\033 [38;5;{color_number}m{message}\033 [0m" .format (
338
353
color_number = color_number ,
@@ -468,17 +483,23 @@ def _generate_ebcli_wrappers(virtualenv_location):
468
483
469
484
470
485
@Step ('Installing EBCLI' )
471
- def _install_ebcli (quiet , version ):
486
+ def _install_ebcli (quiet , version , ebcli_source ):
472
487
"""
473
488
Function installs the awsebcli presumably within the virtualenv,
474
489
".ebcli-virtual-env", created and activated by this script apriori.
475
490
If `version` is passed, the specific version of the EBCLI is installed.
491
+
492
+ The presence of `version` and `ebcli_source` will lead to an exception
493
+ as they represent two different ways of installing the EBCLI.
494
+
476
495
:param quiet: whether to display the output of awsebcli installation to
477
496
the terminal or not
478
497
:param version: the specific version of awsebcli to install
479
498
:return None
480
499
"""
481
- if version :
500
+ if ebcli_source :
501
+ install_args = ['pip' , 'install' , '{}' .format (ebcli_source .strip ())]
502
+ elif version :
482
503
install_args = ['pip' , 'install' , 'awsebcli=={}' .format (version .strip ())]
483
504
else :
484
505
install_args = [
@@ -665,6 +686,11 @@ def _parse_arguments():
665
686
'--version' ,
666
687
help = 'version of EBCLI to install'
667
688
)
689
+ parser .add_argument (
690
+ '-s' , '--ebcli-source' ,
691
+ help = 'filesystem path to a Git repository of the EBCLI, or a .zip or .tar file of '
692
+ 'the EBCLI source code; useful when testing a development version of the EBCLI.'
693
+ )
668
694
return parser .parse_args ()
669
695
670
696
@@ -735,6 +761,10 @@ def _python_script_body(virtualenv_location):
735
761
arguments_context .quiet
736
762
)
737
763
_activate_virtualenv (virtualenv_location )
738
- _install_ebcli (arguments_context .quiet , arguments_context .version )
764
+ _install_ebcli (
765
+ arguments_context .quiet ,
766
+ arguments_context .version ,
767
+ arguments_context .ebcli_source
768
+ )
739
769
_generate_ebcli_wrappers (virtualenv_location )
740
770
_announce_success (virtualenv_location )
0 commit comments