def symlink_script(self, scriptname, ep):
"""Symlink script from scripts directory to entry point module"""
from setuptools.command.easy_install import chmod, current_umask
# build dest module path
dest = os.path.join(self.dest_dir, *ep.module_name.split('.')) + '.py'
if not os.path.exists(dest):
raise ValueError("Module %s not found (entry_point: %s)" % (dest, ep))
# ep.attrs ignored!
target = os.path.join(self.install_dir, scriptname)
dest = os.path.relpath(dest, os.path.dirname(target))
log.info('symlink_script: %s -> %s', target, dest)
self.outfiles.append(target)
mask = current_umask()
if not self.dry_run:
ensure_directory(target)
if os.path.exists(target):
log.info('symlink_script: target exists: %s: replace', target)
os.unlink(target)
os.symlink(dest, target)
# make dest module executable through target
chmod(target, 0o777 - mask)
评论列表
文章目录