Example #1
0
def install_anaconda_prompt(target_path, conda_prefix):
    # target_path: join(conda_prefix, 'condacmd', 'Anaconda Prompt.lnk')
    # target: join(os.environ["HOMEPATH"], "Desktop", "Anaconda Prompt.lnk")
    icon_path = join(CONDA_PACKAGE_ROOT, 'shell', 'conda_icon.ico')

    args = (
        '/K',
        '""%s" && "%s""' %
        (join(conda_prefix, 'condacmd', 'conda_hook.bat'),
         join(conda_prefix, 'condacmd', 'conda_auto_activate.bat')),
    )
    # The API for the call to 'create_shortcut' has 3
    # required arguments (path, description, filename)
    # and 4 optional ones (args, working_dir, icon_path, icon_index).
    if not context.dry_run:
        create_shortcut(
            "%windir%\\System32\\cmd.exe",
            "Anconda Prompt",
            '' + target_path,
            ' '.join(args),
            '' + expanduser('~'),
            '' + icon_path,
        )
    # TODO: need to make idempotent / support NO_CHANGE
    return Result.MODIFIED
Example #2
0
def install_anaconda_prompt(target_path, conda_prefix):
    # target_path: join(conda_prefix, 'condacmd', 'Anaconda Prompt.lnk')
    # target: join(os.environ["HOMEPATH"], "Desktop", "Anaconda Prompt.lnk")
    icon_path = join(CONDA_PACKAGE_ROOT, 'shell', 'conda_icon.ico')

    args = (
        '/K',
        '""%s" && "%s""' % (join(conda_prefix, 'condacmd', 'conda_hook.bat'),
                            join(conda_prefix, 'condacmd', 'conda_auto_activate.bat')),
    )
    # The API for the call to 'create_shortcut' has 3
    # required arguments (path, description, filename)
    # and 4 optional ones (args, working_dir, icon_path, icon_index).
    if not context.dry_run:
        create_shortcut(
            "%windir%\\System32\\cmd.exe",
            "Anconda Prompt",
            '' + target_path,
            ' '.join(args),
            '' + expanduser('~'),
            '' + icon_path,
        )
    # TODO: need to make idempotent / support NO_CHANGE
    return Result.MODIFIED