Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
9ce7ddec
提交
9ce7ddec
authored
12月 02, 2011
作者:
nouiz
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #257 from josharian/issue12
Fix #12
上级
d3a51f4f
48e23838
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
24 行增加
和
28 行删除
+24
-28
setup.py
setup.py
+24
-18
hg_version_hook.sh
theano/misc/hg_version_hook.sh
+0
-10
没有找到文件。
setup.py
浏览文件 @
9ce7ddec
...
@@ -53,9 +53,15 @@ ISRELEASED = False
...
@@ -53,9 +53,15 @@ ISRELEASED = False
VERSION
=
'
%
d.
%
d.
%
d
%
s'
%
(
MAJOR
,
MINOR
,
MICRO
,
SUFFIX
)
VERSION
=
'
%
d.
%
d.
%
d
%
s'
%
(
MAJOR
,
MINOR
,
MICRO
,
SUFFIX
)
# Return the hg revision as a string -- borrowed from hg_version in NumPy's
def
git_version
():
# setup.py file
"""
def
hg_version
():
Return the sha1 of local git HEAD as a string.
"""
# josharian: I doubt that the minimal environment stuff here is
# still needed; it is inherited. This was originally
# an hg_version function borrowed from NumPy's setup.py.
# I'm leaving it in for now because I don't have enough other
# environments to test in to be confident that it is safe to remove.
def
_minimal_ext_cmd
(
cmd
):
def
_minimal_ext_cmd
(
cmd
):
# construct minimal environment
# construct minimal environment
env
=
{}
env
=
{}
...
@@ -69,47 +75,47 @@ def hg_version():
...
@@ -69,47 +75,47 @@ def hg_version():
env
[
'LC_ALL'
]
=
'C'
env
[
'LC_ALL'
]
=
'C'
out
=
subprocess
.
Popen
(
out
=
subprocess
.
Popen
(
cmd
,
cmd
,
stdout
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
env
=
env
env
=
env
)
.
communicate
()[
0
]
)
.
communicate
()[
0
]
return
out
return
out
try
:
try
:
out
=
_minimal_ext_cmd
([
'
hg'
,
'-q'
,
'id
'
])
out
=
_minimal_ext_cmd
([
'
git'
,
'rev-parse'
,
'HEAD
'
])
HG_REVISION
=
out
.
strip
()
.
decode
(
'ascii'
)
git_revision
=
out
.
strip
()
.
decode
(
'ascii'
)
except
OSError
:
except
OSError
:
HG_REVISION
=
"unknown-hg
"
git_revision
=
"unknown-git
"
return
HG_REVISION
return
git_revision
def
write_version_py
(
filename
=
'theano/version.py'
):
def
write_version_py
(
filename
=
'theano/version.py'
):
cnt
=
"""
cnt
=
"""
# THIS FILE IS GENERATED FROM THEANO SETUP.PY
# THIS FILE IS GENERATED FROM THEANO SETUP.PY
short_version = '
%(version)
s'
short_version = '
%(version)
s'
version = '
%(version)
s'
version = '
%(version)
s'
hg_revision = '
%(hg
_revision)
s'
git_revision = '
%(git
_revision)
s'
full_version = '
%(version)
s.dev-
%%(
hg_revision)
s'
%%
{'hg_revision': hg
_revision}
full_version = '
%(version)
s.dev-
%%(
git_revision)
s'
%%
{'git_revision': git
_revision}
release =
%(isrelease)
s
release =
%(isrelease)
s
if not release:
if not release:
version = full_version
version = full_version
"""
"""
FULL_VERSION
=
VERSION
FULL_VERSION
=
VERSION
if
os
.
path
.
exists
(
'.hg
'
):
if
os
.
path
.
isdir
(
'.git
'
):
HG_REVISION
=
hg
_version
()
GIT_REVISION
=
git
_version
()
elif
os
.
path
.
exists
(
filename
):
elif
os
.
path
.
exists
(
filename
):
# must be a source distribution, use existing version file
# must be a source distribution, use existing version file
HG
_REVISION
=
"RELEASE"
GIT
_REVISION
=
"RELEASE"
else
:
else
:
HG_REVISION
=
"unknown-hg
"
GIT_REVISION
=
"unknown-git
"
FULL_VERSION
+=
'.dev-'
+
HG
_REVISION
FULL_VERSION
+=
'.dev-'
+
GIT
_REVISION
a
=
open
(
filename
,
'w'
)
a
=
open
(
filename
,
'w'
)
try
:
try
:
try
:
try
:
a
.
write
(
cnt
%
{
'version'
:
VERSION
,
a
.
write
(
cnt
%
{
'version'
:
VERSION
,
'full_version'
:
FULL_VERSION
,
'full_version'
:
FULL_VERSION
,
'hg_revision'
:
HG
_REVISION
,
'git_revision'
:
GIT
_REVISION
,
'isrelease'
:
str
(
ISRELEASED
)})
'isrelease'
:
str
(
ISRELEASED
)})
except
Exception
,
e
:
except
Exception
,
e
:
print
e
print
e
finally
:
finally
:
...
...
theano/misc/hg_version_hook.sh
deleted
100755 → 0
浏览文件 @
d3a51f4f
#!/bin/sh
# Script to update version.py in response to Mercurial hooks. This should
# not appear in a release tarball.
if
[
-z
"
$HG_NODE
"
]
;
then
echo
No HG_NODE, skipping update of theano.__version__
exit
0
# this seems to be normal sometimes
else
sed
-e
"s/^hg_revision.*/hg_revision = '
`
python
-c
\"
print
\\
"
$HG_NODE
\\
"
[
0:12]
\"
`
'/"
theano/version.py
>
theano/version.py.out
&&
mv
theano/version.py.out theano/version.py
fi
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论