Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version api #2985

Merged
merged 9 commits into from
Dec 6, 2017
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion doc/design/releasing_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Paddle每次发新的版本,遵循以下流程:
1. 从`develop`分支派生出新的分支,分支名为`release/版本号`。例如,`release/0.10.0`
2. 将新分支的版本打上tag,tag为`版本号rc.Patch号`。第一个tag为`0.10.0rc1`,第二个为`0.10.0rc2`,依次类推。
3. 对这个版本的提交,做如下几个操作:
* 修改`python/setup.py.in`中的版本信息,并将`istaged`字段设为`True`。
* 编译这个版本的Docker发行镜像,发布到dockerhub。如果失败,修复Docker编译镜像问题,Patch号加一,返回第二步
* 编译这个版本的Ubuntu Deb包。如果失败,修复Ubuntu Deb包编译问题,Patch号加一,返回第二步。
* 使用Regression Test List作为检查列表,测试Docker镜像/ubuntu安装包的功能正确性
Expand Down Expand Up @@ -34,7 +35,7 @@ Paddle开发过程使用[git-flow](http://nvie.com/posts/a-successful-git-branch
* 建议,开发者fork的版本库使用`develop`分支同步主版本库的`develop`分支
* 建议,开发者fork的版本库中,再基于`develop`版本fork出自己的功能分支。
* 当功能分支开发完毕后,向Paddle的主版本库提交`Pull Reuqest`,进而进行代码评审。
* 在评审过程中,开发者修改自己的代码,可以继续在自己的功能分支提交代码。
* 在评审过程中,开发者修改自己的代码,可以继续在自己的功能分支提交代码。

* BugFix分支也是在开发者自己的fork版本库维护,与功能分支不同的是,BugFix分支需要分别给主版本库的`master`、`develop`与可能有的`release/版本号`分支,同时提起`Pull Request`。

Expand Down
52 changes: 52 additions & 0 deletions python/setup.py.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,56 @@
from setuptools import setup
import subprocess

MAJOR = 0
MINOR = 10
PATCH = 0
RC = 0
ISTAGED = False



def git_commit():
try:
cmd = ["git", "rev-parse", "HEAD"]
git_commit = subprocess.Popen(cmd, stdout = subprocess.PIPE).communicate()[0].strip()
except:
git_commit = "Unknown"
return git_commit

def write_version_py(filename="paddle/version.py"):
cnt = """
# THIS FILE IS GENERATED FROM PADDLEPADDLE SETUP.PY
#
full_version = "%(major)d.%(minor)d.%(patch)d"
major = "%(major)d"
minor = "%(minor)d"
patch = "%(patch)d"
rc = "%(rc)d"
istaged = %(istaged)s
commit = "%(commit)s"

def show():
if istaged:
print "full_version:", full_version
print "major:", major
print "minor:", minor
print "patch:", patch
print "rc:", rc
else:
print "commit:", commit
"""
commit = git_commit()
with open(filename, "w") as f:
f.write(cnt % {
"major": MAJOR,
"minor": MINOR,
"patch": PATCH,
"rc": RC,
"version": "${PADDLE_VERSION}",
"commit": commit,
"istaged": ISTAGED})

write_version_py(filename="${PROJ_ROOT}/python/paddle/version.py")

packages=['paddle',
'paddle.proto',
Expand Down