setup.py 文件源码

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

项目:scorep_binding_python 作者: score-p 项目源码 文件源码
def fix_shebang(file_path, python_version):
    """Rewrite the  shebang for the used major python version of the install,
    use simply sed from OS"""
    print("fix python version")
    # accept array of python version from platform.python_version_tuple()
    # fix shebang only with major python version
    sed = "sed -i 's/#!.*\/usr\/bin\/.*python.*$/#!\/usr\/bin\/env python{}/'"\
            .format(python_version[0], python_version[1])
    # bring command together with file path
    cmd = ' '.join([sed, file_path])
    # execute the sed command and replace in place
    os.system(cmd)

# Get current Python version
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号