#!/usr/bin/env python # -*- coding: utf-8 -*- import os import platform def get_completion_install_location(shell): prefix = '' if os.getuid() == 0: # running as root uname = platform.uname()[0] if uname == 'Linux': prefix = '/' if shell == 'bash': location = os.path.join(prefix, 'etc/bash_completion.d') elif shell == 'zsh': location = os.path.join(prefix, 'share/zsh/site-functions') else: raise ValueError('unsupported shell: {0}'.format(shell)) return location