cli.py 文件源码

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

项目:pipenv 作者: pypa 项目源码 文件源码
def run_open(module, three=None, python=None):

    # Ensure that virtualenv is available.
    ensure_project(three=three, python=python, validate=False)

    c = delegator.run('{0} -c "import {1}; print({1}.__file__);"'.format(which('python'), module))

    try:
        assert c.return_code == 0
    except AssertionError:
        click.echo(crayons.red('Module not found!'))
        sys.exit(1)

    if '__init__.py' in c.out:
        p = os.path.dirname(c.out.strip().rstrip('cdo'))
    else:
        p = c.out.strip().rstrip('cdo')

    click.echo(crayons.normal('Opening {0!r} in your EDITOR.'.format(p), bold=True))
    click.edit(filename=p)
    sys.exit(0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号