本文整理汇总了Python中pythonz.util.symlink函数的典型用法代码示例。如果您正苦于以下问题:Python symlink函数的具体用法?Python symlink怎么用?Python symlink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了symlink函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: symlink
def symlink(self):
install_dir = os.path.realpath(self.install_dir)
bin_dir = os.path.join(install_dir, 'bin')
if self.options.framework:
# create symlink bin -> /path/to/Frameworks/Python.framework/Versions/?.?/bin
if os.path.exists(bin_dir):
rm_r(bin_dir)
m = re.match(r'\d\.\d', self.pkg.version)
if m:
version = m.group(0)
symlink(os.path.join(install_dir, 'Frameworks', 'Python.framework', 'Versions', version, 'bin'), os.path.join(bin_dir))
path_python = os.path.join(bin_dir, 'python')
if not os.path.isfile(path_python):
for f in os.listdir(bin_dir):
if re.match(r'python\d\.\d$', f):
symlink(os.path.join(bin_dir, f), path_python)
break
示例2: symlink
def symlink(self):
install_dir = os.path.realpath(self.install_dir)
if self.pkg.type == 'pypy':
bin_dir = os.path.join(install_dir, 'bin')
symlink(os.path.join(bin_dir, 'pypy'), os.path.join(bin_dir, 'python'))
return
if self.options.framework:
# create symlink bin -> /path/to/Frameworks/Python.framework/Versions/?.?/bin
bin_dir = os.path.join(install_dir, 'bin')
if os.path.exists(bin_dir):
rm_r(bin_dir)
m = re.match(r'\d\.\d', self.pkg.version)
if m:
version = m.group(0)
symlink(os.path.join(install_dir, 'Frameworks', 'Python.framework', 'Versions', version, 'bin'), os.path.join(bin_dir))
path_python = os.path.join(install_dir, 'bin', 'python')
if not os.path.isfile(path_python):
src = None
for d in os.listdir(os.path.join(install_dir, 'bin')):
if re.match(r'python\d\.\d', d):
src = d
break
if src:
path_src = os.path.join(install_dir, 'bin', src)
symlink(path_src, path_python)
示例3: symlink
def symlink(self):
install_dir = os.path.realpath(self.install_dir)
if self.pkg.type == "pypy":
bin_dir = os.path.join(install_dir, "bin")
symlink(os.path.join(bin_dir, "pypy"), os.path.join(bin_dir, "python"))
return
if self.options.framework:
# create symlink bin -> /path/to/Frameworks/Python.framework/Versions/?.?/bin
bin_dir = os.path.join(install_dir, "bin")
if os.path.exists(bin_dir):
rm_r(bin_dir)
m = re.match(r"\d\.\d", self.pkg.version)
if m:
version = m.group(0)
symlink(
os.path.join(install_dir, "Frameworks", "Python.framework", "Versions", version, "bin"),
os.path.join(bin_dir),
)
path_python = os.path.join(install_dir, "bin", "python")
if not os.path.isfile(path_python):
src = None
for d in os.listdir(os.path.join(install_dir, "bin")):
if re.match(r"python\d\.\d", d):
src = d
break
if src:
path_src = os.path.join(install_dir, "bin", src)
symlink(path_src, path_python)