install_symlinked_scripts.py 文件源码

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

项目:squid_dedup 作者: frispete 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号