def install(path, remove=False, prefix=sys.prefix, recursing=False):
    """
    install Menu and shortcuts
    """
    # this sys.prefix is intentional.  We want to reflect the state of the root installation.
    if sys.platform == 'win32' and not exists(join(sys.prefix, '.nonadmin')):
        if isUserAdmin():
            _install(path, remove, prefix, mode='system')
        else:
            from pywintypes import error
            try:
                if not recursing:
                    retcode = runAsAdmin([join(sys.prefix, 'python'), '-c',
                                          "import menuinst; menuinst.install(%r, %r, %r, %r)" % (
                                              path, bool(remove), prefix, True)])
                else:
                    retcode = 1
            except error:
                retcode = 1

            if retcode != 0:
                logging.warn("Insufficient permissions to write menu folder.  "
                             "Falling back to user location")
                _install(path, remove, prefix, mode='user')
    else:
        _install(path, remove, prefix, mode='user')
def install ( path , remove = False , prefix = sys . prefix , recursing = False ) : if sys . platform == 'win32' and not exists ( join ( sys . prefix , '.nonadmin' ) ) : if isUserAdmin ( ) : _install ( path , remove , prefix , mode = 'system' ) else : from pywintypes import error try : if not recursing : retcode = runAsAdmin ( [ join ( sys . prefix , 'python' ) , '-c' , "import menuinst; menuinst.install(%r, %r, %r, %r)" % ( path , bool ( remove ) , prefix , True ) ] ) else : retcode = 1 except error : retcode = 1 if retcode != 0 : logging . warn ( "Insufficient permissions to write menu folder.  " "Falling back to user location" ) _install ( path , remove , prefix , mode = 'user' ) else : _install ( path , remove , prefix , mode = 'user' )
install Menu and shortcuts