Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
14aa5417
Commit
14aa5417
authored
May 19, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2955 from jarv/devel
pip module blowing up when name is not included in arg list
parents
7dfb29f8
daf4c358
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
32 deletions
+31
-32
library/packaging/pip
+31
-32
No files found.
library/packaging/pip
View file @
14aa5417
...
...
@@ -20,6 +20,7 @@
#
import
tempfile
import
os
DOCUMENTATION
=
'''
---
...
...
@@ -32,7 +33,7 @@ version_added: "0.7"
options:
name:
description:
- The name of a Python library to install or the url of the remote package.
- The name of a Python library to install or the url of the remote package.
required: false
default: null
version:
...
...
@@ -184,22 +185,6 @@ def main():
if
state
==
'latest'
and
version
is
not
None
:
module
.
fail_json
(
msg
=
'version is incompatible with state=latest'
)
# pip can accept a path to a local project or a VCS url beginning
# with svn+, git+, hg+, or bz+ and these sources usually do not qualify
# --use-mirrors. Furthermore, the -e option is applied only when
# source is a VCS url. Therefore, we will have branch cases for each
# type of sources.
#
# is_vcs includes those begin with svn+, git+, hg+ or bzr+
# is_tar ends with .zip, .tar.gz, or .tar.bz2
is_vcs
=
False
is_tar
=
False
if
name
.
endswith
(
'.tar.gz'
)
or
name
.
endswith
(
'.tar.bz2'
)
or
name
.
endswith
(
'.zip'
):
is_tar
=
True
elif
name
.
startswith
(
'svn+'
)
or
name
.
startswith
(
'git+'
)
or
\
name
.
startswith
(
'hg+'
)
or
name
.
startswith
(
'bzr+'
):
is_vcs
=
True
err
=
''
out
=
''
...
...
@@ -226,27 +211,41 @@ def main():
cmd
=
'
%
s
%
s'
%
(
pip
,
state_map
[
state
])
# If is_vcs=True, we must add -e option (we assume users won't add that to extra_args).
if
is_vcs
:
args_list
=
[]
# used if extra_args is not used at all
if
extra_args
:
args_list
=
extra_args
.
split
(
' '
)
if
'-e'
not
in
args_list
:
args_list
.
append
(
'-e'
)
# Ok, we will reconstruct the option string
extra_args
=
' '
.
join
(
args_list
)
# for tarball or vcs source, applying --use-mirrors doesn't really make sense
is_package
=
is_vcs
or
is_tar
# just a shortcut for bool
if
not
is_package
and
state
!=
'absent'
and
use_mirrors
:
cmd
+=
' --use-mirrors'
if
extra_args
:
cmd
+=
'
%
s'
%
extra_args
if
name
:
# pip can accept a path to a local project or a VCS url beginning
# with svn+, git+, hg+, or bz+ and these sources usually do not qualify
# --use-mirrors. Furthermore, the -e option is applied only when
# source is a VCS url. Therefore, we will have branch cases for each
# type of sources.
#
# is_vcs includes those begin with svn+, git+, hg+ or bzr+
# is_tar ends with .zip, .tar.gz, or .tar.bz2
is_vcs
=
False
is_tar
=
False
if
name
.
endswith
(
'.tar.gz'
)
or
name
.
endswith
(
'.tar.bz2'
)
or
name
.
endswith
(
'.zip'
):
is_tar
=
True
elif
name
.
startswith
(
'svn+'
)
or
name
.
startswith
(
'git+'
)
or
\
name
.
startswith
(
'hg+'
)
or
name
.
startswith
(
'bzr+'
):
is_vcs
=
True
# If is_vcs=True, we must add -e option (we assume users won't add that to extra_args).
if
is_vcs
:
args_list
=
[]
# used if extra_args is not used at all
if
extra_args
:
args_list
=
extra_args
.
split
(
' '
)
if
'-e'
not
in
args_list
:
args_list
.
append
(
'-e'
)
# Ok, we will reconstruct the option string
extra_args
=
' '
.
join
(
args_list
)
# for tarball or vcs source, applying --use-mirrors doesn't really make sense
is_package
=
is_vcs
or
is_tar
# just a shortcut for bool
if
not
is_package
and
state
!=
'absent'
and
use_mirrors
:
cmd
+=
' --use-mirrors'
cmd
+=
'
%
s'
%
_get_full_name
(
name
,
version
)
elif
requirements
:
cmd
+=
' -r
%
s'
%
requirements
if
module
.
check_mode
:
module
.
exit_json
(
changed
=
True
)
os
.
chdir
(
tempfile
.
gettempdir
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment