[英]getting tortoise svn version to python binary from py2exe
I generated a py2exe binary of my project. 我生成了项目的py2exe二进制文件。 I use TortoiseSVN.
我使用TortoiseSVN。 How do I extract the SVN Revision Number (which I later need to incorporate into the binary).
如何提取SVN修订号(以后需要将其合并到二进制文件中)。 Do I need to implement the same in
Python
? 我是否需要在
Python
实现相同的功能? If so, how do I go about the same? 如果是这样,我该怎么做?
You need to execute this command: 您需要执行以下命令:
svn info path/to/working/copy
and then parse the output. 然后解析输出。 The output looks a little like this:
输出看起来像这样:
Path: path/to/working/copy
Working Copy Root Path: blah blah
URL: https://blah blah
Repository Root: https://blah blah
Repository UUID: blah blah
Revision: 42
Node Kind: directory
Schedule: normal
Last Changed Author: blah blah
Last Changed Rev: 42
Last Changed Date: 2013-02-25 09:52:55 +0000 (Mon, 25 Feb 2013)
Use subprocess.check_output
to execute the svn
command and read in the output. 使用
subprocess.check_output
执行svn
命令并读入输出。 Then parse it however you feel like. 然后解析它,但是您感觉像。 For example you could use a simple regex with
re
to find the information. 例如,您可以使用带有
re
的简单正则表达式来查找信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.