[Piuparts-devel] Chroot.create_apt_conf

Herbert Fortes terberh at gmail.com
Sat Feb 23 12:35:51 GMT 2019

On 2/21/19 1:17 PM, Herbert Fortes wrote:
> On 2/21/19 11:37 AM, Andreas Beckmann wrote:
>> Did someone consider using
>> apt-config dump Acquire::http::Proxy
> What I should did at first.

Patch with Andreas tips:


proxy will be '' or the entire text (PY2 and Py3).

>>> import subprocess
>>> p = subprocess.Popen(['apt-config', 'dump', 'Acquire::http::Proxy'], stdout=subprocess.PIPE, encoding='utf-8')
>>> s, _ = p.communicate()
>>> if s: print(s)
Acquire::http::Proxy "http://www.proxy.com:89/";


In version 3.3 timeout was added to p.communicate()


obs: lines does not need to be a list(). Or at least 
     the first 4 lines.append() are not necessary.

     The way it was written looks like a string '+='.  Using
     a string concat, the "''.join()" is not needed when 
     IMO string concat is better than a list() in this case.

More information about the Piuparts-devel mailing list