[PATCH] use pycurl only when engine initializable

Martin Pool mbp at sourcefrog.net
Mon Apr 24 10:02:03 BST 2006


On 24/04/2006, at 6:54 PM, Alexander Belchenko wrote:

> On my windows machine pycurl usable only when I'm have actual Internet
> connection. When I'm offline any attempt to use pycurl raise error:
>
>  >>> import pycurl
>  >>> pycurl.Curl()
> Traceback (most recent call last):
>    File "<stdin>", line 1, in ?
> pycurl.error: initializing curl failed
>
> As result there is a bunch of unrelated errors during selftest.
>
> Attached patch ensure that pycurl is usable. Othwerwise it raise
> exception. And all PyCurl test will be skipped.

If it's really always going to fail then that looks like a reasonable  
fix.  Do you know why it fails?  Is it trying to do a DNS lookup  
perhaps?

>
> --
> Alexander
>
> === modified file 'a/bzrlib/transport/http/_pycurl.py'
> --- a/bzrlib/transport/http/_pycurl.py	
> +++ b/bzrlib/transport/http/_pycurl.py	
> @@ -38,6 +38,12 @@
>      import pycurl
>  except ImportError, e:
>      mutter("failed to import pycurl: %s", e)
> +    raise DependencyNotPresent('pycurl', e)
> +
> +try:
> +    pycurl.Curl()
> +except pycurl.error, e:
> +    mutter("failed to initialize pycurl: %s", e)
>      raise DependencyNotPresent('pycurl', e)
>
>
>
>

-- 
Martin







More information about the bazaar mailing list