本文整理匯總了Python中pip.backwardcompat.get_path_uid方法的典型用法代碼示例。如果您正苦於以下問題:Python backwardcompat.get_path_uid方法的具體用法?Python backwardcompat.get_path_uid怎麽用?Python backwardcompat.get_path_uid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pip.backwardcompat
的用法示例。
在下文中一共展示了backwardcompat.get_path_uid方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _get_build_prefix
# 需要導入模塊: from pip import backwardcompat [as 別名]
# 或者: from pip.backwardcompat import get_path_uid [as 別名]
def _get_build_prefix():
""" Returns a safe build_prefix """
path = os.path.join(tempfile.gettempdir(), 'pip_build_%s' %
__get_username())
if sys.platform == 'win32':
""" on windows(tested on 7) temp dirs are isolated """
return path
try:
os.mkdir(path)
write_delete_marker_file(path)
except OSError:
file_uid = None
try:
# raises OSError for symlinks
# https://github.com/pypa/pip/pull/935#discussion_r5307003
file_uid = get_path_uid(path)
except OSError:
file_uid = None
if file_uid != os.geteuid():
msg = "The temporary folder for building (%s) is either not owned by you, or is a symlink." \
% path
print (msg)
print("pip will not work until the temporary folder is " + \
"either deleted or is a real directory owned by your user account.")
raise pip.exceptions.InstallationError(msg)
return path