<s> """<STR_LIT>""" <EOL> import os <EOL> from fabric . api import env , cd <EOL> from cloudbio . custom . shared import _make_tmp_dir <EOL> from cloudbio . package import brew <EOL> from cloudbio . package . deb import ( _apt_packages , _add_apt_gpg_keys , <EOL> _setup_apt_automation , _setup_apt_sources ) <EOL> from cloudbio . package . rpm import ( _yum_packages , _setup_yum_bashrc , <EOL> _setup_yum_sources ) <EOL> def _configure_and_install_native_packages ( env , pkg_install ) : <EOL> """<STR_LIT>""" <EOL> home_dir = env . safe_run ( "<STR_LIT>" ) <EOL> if home_dir : <EOL> if env . shell_config . startswith ( "<STR_LIT>" ) : <EOL> nonhome = env . shell_config . split ( "<STR_LIT>" , <NUM_LIT:1> ) [ - <NUM_LIT:1> ] <EOL> env . shell_config = os . path . join ( home_dir , nonhome ) <EOL> if env . distribution in [ "<STR_LIT>" , "<STR_LIT>" ] : <EOL> _setup_apt_sources ( ) <EOL> _setup_apt_automation ( ) <EOL> _add_apt_gpg_keys ( ) <EOL> _apt_packages ( pkg_install ) <EOL> elif env . distribution in [ "<STR_LIT>" , "<STR_LIT>" ] : <EOL> _setup_yum_sources ( ) <EOL> _yum_packages ( pkg_install ) <EOL> _setup_yum_bashrc ( ) <EOL> elif env . distribution in [ "<STR_LIT>" , "<STR_LIT>" ] : <EOL> pass <EOL> elif env . distribution == "<STR_LIT>" : <EOL> brew . install_packages ( env , pkg_install ) <EOL> else : <EOL> raise NotImplementedError ( "<STR_LIT>" ) <EOL> def _connect_native_packages ( env , pkg_install , lib_install ) : <EOL> """<STR_LIT>""" <EOL> bin_dir = os . path . join ( env . system_install , "<STR_LIT>" ) <EOL> exports = _get_shell_exports ( env ) <EOL> path = env . safe_run_output ( "<STR_LIT>" ) <EOL> comment_line = "<STR_LIT>" <EOL> if not env . safe_contains ( env . shell_config , comment_line ) : <EOL> env . safe_append ( env . shell_config , "<STR_LIT:\n>" + comment_line ) <EOL> if bin_dir not in path and env . safe_exists ( env . shell_config ) : <EOL> if not env . safe_contains ( env . shell_config , exports [ "<STR_LIT:path>" ] ) : <EOL> env . safe_append ( env . shell_config , exports [ "<STR_LIT:path>" ] ) <EOL> if "<STR_LIT>" in pkg_install and "<STR_LIT>" in lib_install : <EOL> _create_local_virtualenv ( env . system_install ) <EOL> def _get_shell_exports ( env ) : <EOL> bin_dir = os . path . join ( env . system_install , "<STR_LIT>" ) <EOL> return { "<STR_LIT:path>" : "<STR_LIT>" % bin_dir } <EOL> def _print_shell_exports ( env ) : <EOL> """<STR_LIT>""" <EOL> exports = _get_shell_exports ( env ) <EOL> print "<STR_LIT>" <EOL> for e in [ "<STR_LIT:path>" ] : <EOL> print exports [ e ] <EOL> def _create_local_virtualenv ( target_dir ) : <EOL> """<STR_LIT>""" <EOL> url = "<STR_LIT>" <EOL> if not os . path . exists ( os . path . join ( target_dir , "<STR_LIT>" , "<STR_LIT>" ) ) : <EOL> with _make_tmp_dir ( ) as work_dir : <EOL> with cd ( work_dir ) : <EOL> env . safe_run ( "<STR_LIT>" % url ) <EOL> env . safe_run ( "<STR_LIT>" % target_dir ) </s>
