locations.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:krpcScripts 作者: jwvanderbeck 项目源码 文件源码
def _get_build_prefix():
    """ Returns a safe build_prefix """
    path = os.path.join(tempfile.gettempdir(), 'pip-build-%s' % \
        getpass.getuser())
    if sys.platform == 'win32':
        """ on windows(tested on 7) temp dirs are isolated """
        return path
    try:
        os.mkdir(path)
    except OSError:
        file_uid = None
        try:
            fd = os.open(path, os.O_RDONLY | os.O_NOFOLLOW)
            file_uid = os.fstat(fd).st_uid
            os.close(fd)
        except OSError:
            file_uid = None
        if file_uid != os.getuid():
            msg = "The temporary folder for building (%s) is not owned by your user!" \
                % path
            print (msg)
            print("pip will not work until the temporary folder is " + \
                 "either deleted or owned by your user account.")
            raise pip.exceptions.InstallationError(msg)
    return path
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号