Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
e9e7ed0c
提交
e9e7ed0c
authored
3月 06, 2012
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
PEP 8 fixes, assisted by Syntastic and flake8.
上级
adbc78dd
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
20 行增加
和
7 行删除
+20
-7
distribute_setup.py
distribute_setup.py
+20
-7
没有找到文件。
distribute_setup.py
浏览文件 @
e9e7ed0c
...
@@ -144,7 +144,7 @@ def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
...
@@ -144,7 +144,7 @@ def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
except
ImportError
:
except
ImportError
:
return
_do_download
(
version
,
download_base
,
to_dir
,
download_delay
)
return
_do_download
(
version
,
download_base
,
to_dir
,
download_delay
)
try
:
try
:
pkg_resources
.
require
(
"distribute>="
+
version
)
pkg_resources
.
require
(
"distribute>="
+
version
)
return
return
except
pkg_resources
.
VersionConflict
:
except
pkg_resources
.
VersionConflict
:
e
=
sys
.
exc_info
()[
1
]
e
=
sys
.
exc_info
()[
1
]
...
@@ -167,6 +167,7 @@ def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
...
@@ -167,6 +167,7 @@ def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
if
not
no_fake
:
if
not
no_fake
:
_create_fake_setuptools_pkg_info
(
to_dir
)
_create_fake_setuptools_pkg_info
(
to_dir
)
def
download_setuptools
(
version
=
DEFAULT_VERSION
,
download_base
=
DEFAULT_URL
,
def
download_setuptools
(
version
=
DEFAULT_VERSION
,
download_base
=
DEFAULT_URL
,
to_dir
=
os
.
curdir
,
delay
=
15
):
to_dir
=
os
.
curdir
,
delay
=
15
):
"""Download distribute from a specified location and return its filename
"""Download distribute from a specified location and return its filename
...
@@ -203,6 +204,7 @@ def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
...
@@ -203,6 +204,7 @@ def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
dst
.
close
()
dst
.
close
()
return
os
.
path
.
realpath
(
saveto
)
return
os
.
path
.
realpath
(
saveto
)
def
_no_sandbox
(
function
):
def
_no_sandbox
(
function
):
def
__no_sandbox
(
*
args
,
**
kw
):
def
__no_sandbox
(
*
args
,
**
kw
):
try
:
try
:
...
@@ -227,6 +229,7 @@ def _no_sandbox(function):
...
@@ -227,6 +229,7 @@ def _no_sandbox(function):
return
__no_sandbox
return
__no_sandbox
def
_patch_file
(
path
,
content
):
def
_patch_file
(
path
,
content
):
"""Will backup the file then patch it"""
"""Will backup the file then patch it"""
existing_content
=
open
(
path
)
.
read
()
existing_content
=
open
(
path
)
.
read
()
...
@@ -245,15 +248,18 @@ def _patch_file(path, content):
...
@@ -245,15 +248,18 @@ def _patch_file(path, content):
_patch_file
=
_no_sandbox
(
_patch_file
)
_patch_file
=
_no_sandbox
(
_patch_file
)
def
_same_content
(
path
,
content
):
def
_same_content
(
path
,
content
):
return
open
(
path
)
.
read
()
==
content
return
open
(
path
)
.
read
()
==
content
def
_rename_path
(
path
):
def
_rename_path
(
path
):
new_name
=
path
+
'.OLD.
%
s'
%
time
.
time
()
new_name
=
path
+
'.OLD.
%
s'
%
time
.
time
()
log
.
warn
(
'Renaming
%
s into
%
s'
,
path
,
new_name
)
log
.
warn
(
'Renaming
%
s into
%
s'
,
path
,
new_name
)
os
.
rename
(
path
,
new_name
)
os
.
rename
(
path
,
new_name
)
return
new_name
return
new_name
def
_remove_flat_installation
(
placeholder
):
def
_remove_flat_installation
(
placeholder
):
if
not
os
.
path
.
isdir
(
placeholder
):
if
not
os
.
path
.
isdir
(
placeholder
):
log
.
warn
(
'Unkown installation at
%
s'
,
placeholder
)
log
.
warn
(
'Unkown installation at
%
s'
,
placeholder
)
...
@@ -289,11 +295,13 @@ def _remove_flat_installation(placeholder):
...
@@ -289,11 +295,13 @@ def _remove_flat_installation(placeholder):
_remove_flat_installation
=
_no_sandbox
(
_remove_flat_installation
)
_remove_flat_installation
=
_no_sandbox
(
_remove_flat_installation
)
def
_after_install
(
dist
):
def
_after_install
(
dist
):
log
.
warn
(
'After install bootstrap.'
)
log
.
warn
(
'After install bootstrap.'
)
placeholder
=
dist
.
get_command_obj
(
'install'
)
.
install_purelib
placeholder
=
dist
.
get_command_obj
(
'install'
)
.
install_purelib
_create_fake_setuptools_pkg_info
(
placeholder
)
_create_fake_setuptools_pkg_info
(
placeholder
)
def
_create_fake_setuptools_pkg_info
(
placeholder
):
def
_create_fake_setuptools_pkg_info
(
placeholder
):
if
not
placeholder
or
not
os
.
path
.
exists
(
placeholder
):
if
not
placeholder
or
not
os
.
path
.
exists
(
placeholder
):
log
.
warn
(
'Could not find the install location'
)
log
.
warn
(
'Could not find the install location'
)
...
@@ -321,7 +329,9 @@ def _create_fake_setuptools_pkg_info(placeholder):
...
@@ -321,7 +329,9 @@ def _create_fake_setuptools_pkg_info(placeholder):
finally
:
finally
:
f
.
close
()
f
.
close
()
_create_fake_setuptools_pkg_info
=
_no_sandbox
(
_create_fake_setuptools_pkg_info
)
_create_fake_setuptools_pkg_info
=
_no_sandbox
(
_create_fake_setuptools_pkg_info
)
def
_patch_egg_dir
(
path
):
def
_patch_egg_dir
(
path
):
# let's check if it's already patched
# let's check if it's already patched
...
@@ -343,6 +353,7 @@ def _patch_egg_dir(path):
...
@@ -343,6 +353,7 @@ def _patch_egg_dir(path):
_patch_egg_dir
=
_no_sandbox
(
_patch_egg_dir
)
_patch_egg_dir
=
_no_sandbox
(
_patch_egg_dir
)
def
_before_install
():
def
_before_install
():
log
.
warn
(
'Before install bootstrap.'
)
log
.
warn
(
'Before install bootstrap.'
)
_fake_setuptools
()
_fake_setuptools
()
...
@@ -351,7 +362,7 @@ def _before_install():
...
@@ -351,7 +362,7 @@ def _before_install():
def
_under_prefix
(
location
):
def
_under_prefix
(
location
):
if
'install'
not
in
sys
.
argv
:
if
'install'
not
in
sys
.
argv
:
return
True
return
True
args
=
sys
.
argv
[
sys
.
argv
.
index
(
'install'
)
+
1
:]
args
=
sys
.
argv
[
(
sys
.
argv
.
index
(
'install'
)
+
1
)
:]
for
index
,
arg
in
enumerate
(
args
):
for
index
,
arg
in
enumerate
(
args
):
for
option
in
(
'--root'
,
'--prefix'
):
for
option
in
(
'--root'
,
'--prefix'
):
if
arg
.
startswith
(
'
%
s='
%
option
):
if
arg
.
startswith
(
'
%
s='
%
option
):
...
@@ -359,7 +370,7 @@ def _under_prefix(location):
...
@@ -359,7 +370,7 @@ def _under_prefix(location):
return
location
.
startswith
(
top_dir
)
return
location
.
startswith
(
top_dir
)
elif
arg
==
option
:
elif
arg
==
option
:
if
len
(
args
)
>
index
:
if
len
(
args
)
>
index
:
top_dir
=
args
[
index
+
1
]
top_dir
=
args
[
index
+
1
]
return
location
.
startswith
(
top_dir
)
return
location
.
startswith
(
top_dir
)
if
arg
==
'--user'
and
USER_SITE
is
not
None
:
if
arg
==
'--user'
and
USER_SITE
is
not
None
:
return
location
.
startswith
(
USER_SITE
)
return
location
.
startswith
(
USER_SITE
)
...
@@ -380,7 +391,8 @@ def _fake_setuptools():
...
@@ -380,7 +391,8 @@ def _fake_setuptools():
replacement
=
False
))
replacement
=
False
))
except
TypeError
:
except
TypeError
:
# old distribute API
# old distribute API
setuptools_dist
=
ws
.
find
(
pkg_resources
.
Requirement
.
parse
(
'setuptools'
))
setuptools_dist
=
ws
.
find
(
pkg_resources
.
Requirement
.
parse
(
'setuptools'
))
if
setuptools_dist
is
None
:
if
setuptools_dist
is
None
:
log
.
warn
(
'No setuptools distribution found'
)
log
.
warn
(
'No setuptools distribution found'
)
...
@@ -422,7 +434,8 @@ def _relaunch():
...
@@ -422,7 +434,8 @@ def _relaunch():
log
.
warn
(
'Relaunching...'
)
log
.
warn
(
'Relaunching...'
)
# we have to relaunch the process
# we have to relaunch the process
# pip marker to avoid a relaunch bug
# pip marker to avoid a relaunch bug
if
sys
.
argv
[:
3
]
==
[
'-c'
,
'install'
,
'--single-version-externally-managed'
]:
if
(
sys
.
argv
[:
3
]
==
[
'-c'
,
'install'
,
'--single-version-externally-managed'
]):
sys
.
argv
[
0
]
=
'setup.py'
sys
.
argv
[
0
]
=
'setup.py'
args
=
[
sys
.
executable
]
+
sys
.
argv
args
=
[
sys
.
executable
]
+
sys
.
argv
sys
.
exit
(
subprocess
.
call
(
args
))
sys
.
exit
(
subprocess
.
call
(
args
))
...
@@ -448,7 +461,7 @@ def _extractall(self, path=".", members=None):
...
@@ -448,7 +461,7 @@ def _extractall(self, path=".", members=None):
# Extract directories with a safe mode.
# Extract directories with a safe mode.
directories
.
append
(
tarinfo
)
directories
.
append
(
tarinfo
)
tarinfo
=
copy
.
copy
(
tarinfo
)
tarinfo
=
copy
.
copy
(
tarinfo
)
tarinfo
.
mode
=
448
# decimal for oct 0700
tarinfo
.
mode
=
448
# decimal for oct 0700
self
.
extract
(
tarinfo
,
path
)
self
.
extract
(
tarinfo
,
path
)
# Reverse sort directories.
# Reverse sort directories.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论