From d984b1576ca0b73fbb2096bd073fb4145f308be4 Mon Sep 17 00:00:00 2001 From: Ilan Schnell Date: Thu, 15 Oct 2015 17:03:14 -0500 Subject: [PATCH] simplify mk_menus() --- conda/install.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/conda/install.py b/conda/install.py index 6ed82962a17..7c4fcbc85ae 100644 --- a/conda/install.py +++ b/conda/install.py @@ -328,21 +328,11 @@ def mk_menus(prefix, files, remove=False): logging.warn("Menuinst could not be imported:") logging.warn(e.message) return + + env_name = (None if abspath(prefix) == abspath(sys.prefix) else + basename(prefix)) + env_setup_cmd = ("activate %s" % env_name) if env_name else None for f in menu_files: - env_name = os.getenv("CONDA_DEFAULT_ENV") - # this should always be the root, because Conda can only be - # installed in the root environment, thus this script should only - # ever be running with the root interpreter. - if env_name: - # Windows uses full paths; only the last folder is the env name. - # Other platforms still use just name. - end_name = os.path.split(env_name) - env_name = end_name[1] if len(end_name) > 1 else env_name - if sys.platform == "win32": - env_setup_cmd = "activate {}" - else: - env_setup_cmd = "source activate {}" - env_setup_cmd = env_setup_cmd.format(env_name) if env_name else None try: if menuinst.__version__.startswith('1.0'): menuinst.install(join(prefix, f), remove, prefix)