如何获得“客户名称:"使用“p4 info"的 perforce 工作区从python脚本? [英] How to get "Client name:" of a perforce workspace using "p4 info" from python script?

查看:99
本文介绍了如何获得“客户名称:"使用“p4 info"的 perforce 工作区从python脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个场景,我需要 perforce 工作区客户端名称信息.尝试使用脚本如下:

I have a scenario where i need to have perforce workspace Client name information. Trying out with script as follows:

    import sys
    import subprocess
    cmd = "p4 info | grep" + """ "Client name" """ +""
    print ("p4 command is: ",cmd)
    p4 = subprocess.call(cmd)
    print( p4)       

我的出处是:

    p4 command is: p4 info | grep "Client name"
    Usage: info [-s]
    Unexpected arguments.
    1

我也尝试过如下操作,但没有奏效:

I tried doing as follows too but did not worked:

    import sys
    import subprocess
    p4_info = subprocess.call([sys.executable, "p4 info | grep "Client name""])

我实际上只想获取客户端名称信息.所以,建议我如何拥有它.如果有另一种方法,请提出建议.该脚本将在工作区中执行并返回唯一的客户端名称:

I actually want to fetch only Client name information. So, suggest me how i may have that. If there is another way of doing it please suggest. The script will be executed within the workspace and shall return the only Client name:

推荐答案

做:

p4 -Ztag -F %clientName% info

这篇关于如何获得“客户名称:"使用“p4 info"的 perforce 工作区从python脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆