Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Python_Packaging_Authority
pip
提交
6a24249f
P
pip
项目概览
镜像
/
Python_Packaging_Authority
/
pip
12 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
pip
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6a24249f
编写于
7月 01, 2009
作者:
J
Jannis Leidel
浏览文件
操作
浏览文件
下载
差异文件
Automated merge with
http://bitbucket.org/jezdez/pip-download/
上级
25ab228f
6697d7e3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
23 deletion
+36
-23
docs/index.txt
docs/index.txt
+2
-2
docs/news.txt
docs/news.txt
+15
-0
pip.py
pip.py
+19
-21
未找到文件。
docs/index.txt
浏览文件 @
6a24249f
...
...
@@ -136,7 +136,7 @@ tell you what all the exact versions are.
To create a new requirements file from a known working environment, use::
$ pip freeze stable-req.txt
$ pip freeze
>
stable-req.txt
This will write a listing of *all* installed libraries to ``stable-req.txt``
with exact versions for every library. You may want to edit the file down after
...
...
@@ -146,7 +146,7 @@ stable starting point for constructing your requirements file.
You can also give it an existing requirements file, and it will use that as a
sort of template for the new file. So if you do::
$ pip freeze
stable-req.txt -r devel
-req.txt
$ pip freeze
-r devel-req.txt > stable
-req.txt
it will keep the packages listed in ``devel-req.txt`` in order and preserve
comments.
...
...
docs/news.txt
浏览文件 @
6a24249f
News for pip
============
tip
---
* Added ability to override the default log file name (``pip-log.txt``)
with the environmental variable ``$PIP_LOG_FILE``.
* Made the freeze command to return the installed packages instead of
writing them to a file. Use simple redirection (e.g.
``pip freeze > stable-req.txt``) to get a file with requirements.
* Fixed problem of freezing an editable packages from a Git repository.
* Added support for base URLs using ``<base href='...'>`` when parsing
HTML pages.
0.4
---
...
...
pip.py
浏览文件 @
6a24249f
...
...
@@ -290,7 +290,7 @@ class Command(object):
if
log_fp
is
not
None
:
log_fp
.
close
()
if
exit
:
log_fn
=
'./pip-log.txt'
log_fn
=
os
.
environ
.
get
(
'PIP_LOG_FILE'
,
'./pip-log.txt'
)
text
=
'
\n
'
.
join
(
complete_log
)
logger
.
fatal
(
'Storing complete log in %s'
%
log_fn
)
log_fp
=
open_logfile_append
(
log_fn
)
...
...
@@ -501,8 +501,8 @@ DownloadCommand()
class
FreezeCommand
(
Command
):
name
=
'freeze'
usage
=
'%prog [OPTIONS]
FREEZE_NAME.txt
'
summary
=
'
Put all currently installed packages (exact versions) into a requirements file
'
usage
=
'%prog [OPTIONS]'
summary
=
'
Output all currently installed packages (exact versions) to stdout
'
def
__init__
(
self
):
super
(
FreezeCommand
,
self
).
__init__
()
...
...
@@ -522,10 +522,6 @@ class FreezeCommand(Command):
help
=
'URL for finding packages, which will be added to the frozen requirements file'
)
def
run
(
self
,
options
,
args
):
if
args
:
filename
=
args
[
0
]
else
:
filename
=
'-'
requirement
=
options
.
requirement
find_links
=
options
.
find_links
or
[]
## FIXME: Obviously this should be settable:
...
...
@@ -534,15 +530,11 @@ class FreezeCommand(Command):
if
os
.
environ
.
get
(
'PIP_SKIP_REQUIREMENTS_REGEX'
):
skip_match
=
re
.
compile
(
os
.
environ
[
'PIP_SKIP_REQUIREMENTS_REGEX'
])
if
filename
==
'-'
:
logger
.
move_stdout_to_stderr
()
logger
.
move_stdout_to_stderr
()
dependency_links
=
[]
if
filename
==
'-'
:
f
=
sys
.
stdout
else
:
## FIXME: should be possible to overwrite requirement file
logger
.
notify
(
'Writing frozen requirements to %s'
%
filename
)
f
=
open
(
filename
,
'w'
)
f
=
sys
.
stdout
for
dist
in
pkg_resources
.
working_set
:
if
dist
.
has_metadata
(
'dependency_links.txt'
):
dependency_links
.
extend
(
dist
.
get_metadata_lines
(
'dependency_links.txt'
))
...
...
@@ -593,9 +585,6 @@ class FreezeCommand(Command):
f
.
write
(
'## The following requirements were added by pip --freeze:
\n
'
)
for
installation
in
sorted
(
installations
.
values
(),
key
=
lambda
x
:
x
.
name
):
f
.
write
(
str
(
installation
))
if
filename
!=
'-'
:
logger
.
notify
(
'Put requirements in %s'
%
filename
)
f
.
close
()
FreezeCommand
()
...
...
@@ -2258,6 +2247,7 @@ class HTMLPage(object):
## These aren't so aweful:
_rel_re
=
re
.
compile
(
"""<[^>]*\srel\s*=\s*['"]?([^'">]+)[^>]*>"""
,
re
.
I
)
_href_re
=
re
.
compile
(
'href=(?:"([^"]*)"|
\'
([^
\'
]*)
\'
|([^>
\\
s
\\
n]*))'
,
re
.
I
|
re
.
S
)
_base_re
=
re
.
compile
(
r
"""<base\s+href\s*=\s*['"]?([^'">]+)"""
,
re
.
I
)
def
__init__
(
self
,
content
,
url
,
headers
=
None
):
self
.
content
=
content
...
...
@@ -2355,12 +2345,19 @@ class HTMLPage(object):
finally
:
conn
.
close
()
@
property
def
base_url
(
self
):
match
=
self
.
_base_re
.
search
(
self
.
content
)
if
match
:
return
match
.
group
(
1
)
return
self
.
url
@
property
def
links
(
self
):
"""Yields all links in the page"""
for
match
in
self
.
_href_re
.
finditer
(
self
.
content
):
url
=
match
.
group
(
1
)
or
match
.
group
(
2
)
or
match
.
group
(
3
)
url
=
self
.
clean_link
(
urlparse
.
urljoin
(
self
.
url
,
url
))
url
=
self
.
clean_link
(
urlparse
.
urljoin
(
self
.
base_
url
,
url
))
yield
Link
(
url
,
self
)
def
rel_links
(
self
):
...
...
@@ -2382,7 +2379,7 @@ class HTMLPage(object):
if
not
match
:
continue
url
=
match
.
group
(
1
)
or
match
.
group
(
2
)
or
match
.
group
(
3
)
url
=
self
.
clean_link
(
urlparse
.
urljoin
(
self
.
url
,
url
))
url
=
self
.
clean_link
(
urlparse
.
urljoin
(
self
.
base_
url
,
url
))
yield
Link
(
url
,
self
)
def
scraped_rel_links
(
self
):
...
...
@@ -2396,7 +2393,7 @@ class HTMLPage(object):
url
=
match
.
group
(
1
)
or
match
.
group
(
2
)
or
match
.
group
(
3
)
if
not
url
:
continue
url
=
self
.
clean_link
(
urlparse
.
urljoin
(
self
.
url
,
url
))
url
=
self
.
clean_link
(
urlparse
.
urljoin
(
self
.
base_
url
,
url
))
yield
Link
(
url
,
self
)
_clean_re
=
re
.
compile
(
r
'[^a-z0-9$&+,/:;=?@.#%_\\|-]'
,
re
.
I
)
...
...
@@ -3024,6 +3021,7 @@ class Git(VersionControl):
[
GIT_CMD
,
'branch'
,
'-r'
],
show_stdout
=
False
,
cwd
=
location
)
branch_revs
=
[]
for
line
in
branches
.
splitlines
():
line
=
line
.
split
(
'->'
)[
0
].
strip
()
branch
=
""
.
join
([
b
for
b
in
line
.
split
()
if
b
!=
'*'
])
rev
=
call_subprocess
(
[
GIT_CMD
,
'rev-parse'
,
branch
],
show_stdout
=
False
,
cwd
=
location
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录