使用 Mercurial 自动更新 `__version__`?
类似于 如何用 git 重写 python __version__ ?,它是什么在 python 文件中存储自动更新版本号的最佳方法?
我的有多好使用 Mercurial hooks 将版本号嵌入到我的应用程序中的方法? 和 Mercurial 关键字计划 明确自动更新 $Revision$
或 $Id$
的 svn 风格方法是不可取的,并且构建系统应该做这项工作。但这是Python,没有构建系统,而且这是一个完全包含在一个文件中的小程序,因此没有打包。
Possible Duplicate:
How to display current working copy version of an hg repository on a PHP page
Similar to How can I rewrite python __version__ with git?, what it is the best method to store an automatically updated version number inside a python file?
How good is my method of embedding version numbers into my application using Mercurial hooks? and the Mercurial keyword plan make it clear the svn-style method of automatically updating $Revision$
or $Id$
is not desirable and that the build system should do that work instead. This is python though, there is no build system and this is for a small program wholly contained in one file, so there is no packaging.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无论您使用哪种语言编写程序,您始终可以添加构建系统。您可能会说“但是语言 X 不需要构建系统”,但这个问题表明它确实需要:它需要它来完成那些重复性任务需要在任何发布之前完成。这些任务包括构建文档、运行测试以及将结果上传到某处。
一个简单的 Makefile 或 shell 脚本就足够了:
You can always add a build system, no matter which language you write your program in. You might say "but language X doesn't need a build system", but this question shows that it does: it needs it for those repetitive tasks that needs to be done before any release. This is tasks like building the documentation, running tests, and uploading the result somewhere.
A simple Makefile or a shell script is enough: