Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
3822e3e7
Commit
3822e3e7
authored
Nov 14, 2013
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delint syntax
--HG-- extra : amend_source : 0f58aa917ebc71efd2904638fac3838fd0b0e4dd
parent
2e0ef2a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
setuptools/package_index.py
setuptools/package_index.py
+9
-10
No files found.
setuptools/package_index.py
View file @
3822e3e7
...
...
@@ -920,29 +920,29 @@ def _encode_auth(auth):
# strip the trailing carriage return
return
encoded
.
rstrip
()
class
PyPirc
:
class
PyPirc
(
object
)
:
def
__init__
(
self
):
"""
Extract pypirc authentication information from home directory
Extract pypirc authentication information from home directory
"""
self
.
dict_
=
{}
if
os
.
environ
.
has_key
(
'HOME'
)
:
if
'HOME'
in
os
.
environ
:
rc
=
os
.
path
.
join
(
os
.
environ
[
'HOME'
],
'.pypirc'
)
if
os
.
path
.
exists
(
rc
):
config
=
ConfigParser
.
ConfigParser
({
'username'
:
''
,
'password'
:
''
,
'repository'
:
''
})
'username'
:
''
,
'password'
:
''
,
'repository'
:
''
})
config
.
read
(
rc
)
for
section
in
config
.
sections
():
if
config
.
get
(
section
,
'repository'
).
strip
():
value
=
'%s:%s'
%
(
config
.
get
(
section
,
'username'
).
strip
(),
value
=
'%s:%s'
%
(
config
.
get
(
section
,
'username'
).
strip
(),
config
.
get
(
section
,
'password'
).
strip
())
self
.
dict_
[
config
.
get
(
section
,
'repository'
).
strip
()]
=
value
def
__call__
(
self
,
url
):
""" """
for
base_url
,
auth
in
self
.
dict_
.
items
():
...
...
@@ -950,7 +950,6 @@ class PyPirc:
return
auth
def
open_with_auth
(
url
,
opener
=
urllib2
.
urlopen
):
"""Open a urllib2 request, handling HTTP authentication"""
...
...
@@ -968,7 +967,7 @@ def open_with_auth(url, opener=urllib2.urlopen):
if
not
auth
:
auth
=
PyPirc
()(
url
)
log
.
info
(
'Authentication found for URL: %s'
%
url
)
log
.
info
(
'Authentication found for URL: %s'
%
url
)
if
auth
:
auth
=
"Basic "
+
_encode_auth
(
auth
)
...
...
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