ubuntutools/archive.py: use ProxyHandler in _download_file.

This makes use of the system proxy (e.g. http_proxy).
This commit is contained in:
Daniel Hahler 2012-03-16 16:22:14 +01:00
parent 2e9d81bdda
commit ee569590a6
2 changed files with 9 additions and 2 deletions

7
debian/changelog vendored
View File

@ -1,11 +1,16 @@
ubuntu-dev-tools (0.140) UNRELEASED; urgency=low ubuntu-dev-tools (0.140) UNRELEASED; urgency=low
[ Stefano Rivera ]
* Bump Standards-Version to 3.9.3, no changes needed. * Bump Standards-Version to 3.9.3, no changes needed.
* Update machine-readable copyright Format to 1.0. * Update machine-readable copyright Format to 1.0.
* pbuilder-dist: Use the same chroot, whether the system-architecture was * pbuilder-dist: Use the same chroot, whether the system-architecture was
the supplied architecture or was chosen by default (LP: #943435) the supplied architecture or was chosen by default (LP: #943435)
-- Stefano Rivera <stefanor@debian.org> Sat, 25 Feb 2012 16:09:53 +0200 [ Daniel Hahler ]
* ubuntutools/archive.py: use ProxyHandler in _download_file.
This makes use of the system proxy (e.g. http_proxy).
-- Daniel Hahler <ubuntu@thequod.de> Fri, 16 Mar 2012 16:21:00 +0100
ubuntu-dev-tools (0.139) unstable; urgency=low ubuntu-dev-tools (0.139) unstable; urgency=low

View File

@ -317,8 +317,10 @@ class SourcePackage(object):
if parsed.scheme == 'file': if parsed.scheme == 'file':
in_ = open(parsed.path, 'r') in_ = open(parsed.path, 'r')
else: else:
proxy = urllib2.ProxyHandler() # uses default proxy from environment
opener = urllib2.build_opener(proxy)
try: try:
in_ = urllib2.urlopen(url) in_ = opener.open(url)
except urllib2.URLError: except urllib2.URLError:
return False return False