Re: Python 3.6 can find cairo libs but not Python 2.7

2018-07-13 Thread Peter Otten
D'Arcy Cain wrote:

> On 2018-07-13 10:28 AM, Peter Otten wrote:
>> As far as I can see -- without having access to a netbsd machine -- this
> 
> Would it help if I gave you a login on one?

Sorry, no.
 
> Interestingly, I don't have this issue on my NetBSD machine built from
> HEAD.  Maybe it is something that was fixed but not pulled up to 7.
> 
> More weirdness - I do have the issue on my HEAD system but only with
> 3.7.  I can give you an account on that server as well.

If you have a working 3.6 and a 3.7 that does not work the code in 
ctypes.util might be similar enough that you can spot suspicious changes in 
the diff between the two versions.


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.6 can find cairo libs but not Python 2.7

2018-07-13 Thread D'Arcy Cain
On 2018-07-13 10:28 AM, Peter Otten wrote:
> As far as I can see -- without having access to a netbsd machine -- this 

Would it help if I gave you a login on one?

Interestingly, I don't have this issue on my NetBSD machine built from
HEAD.  Maybe it is something that was fixed but not pulled up to 7.

More weirdness - I do have the issue on my HEAD system but only with
3.7.  I can give you an account on that server as well.

-- 
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:da...@vex.net VoIP: sip:da...@vybenetworks.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.6 can find cairo libs but not Python 2.7

2018-07-13 Thread Peter Otten
D'Arcy Cain wrote:

> On 2018-07-13 08:05 AM, Peter Otten wrote:
>> D'Arcy Cain wrote:
>>> Nope.  Both are 64 bit.
>> 
>> Just to be 100% sure, what does
>> 
>> $ python2.7 -c 'import struct; print(struct.calcsize("l"))'
>> 
>> $ python3.6 -c 'import struct; print(struct.calcsize("l"))'
>> 
>> print?
> 
> $ python2.7 -c 'import struct; print(struct.calcsize("l"))'
> 8
> $ python3.6 -c 'import struct; print(struct.calcsize("l"))'
> 8
> 
>> If both print 8, what is sys.platform? (This is just that I can look at
>> the right branch of the ctypes.util source for differences)?
> 
> $ python2.7 -c 'import sys; print(sys.platform)'
> netbsd7
> $ python3.6 -c 'import sys; print(sys.platform)'
> netbsd7
> 
> Thanks for checking this.

As far as I can see -- without having access to a netbsd machine -- this 
leads to the standard 'posix' implementation of find_library() which in both 
Python 2 and 3 runs /sbin/ldconfig and then searches its output with a 
regex.

On my (linux) machine that regex is the same for both python 2.7 and 3.6:

$ python3.6 -c 'import sys; sys.platform="netbsd7"; from ctypes import util; 
print(util.find_library("cairo"))'
XXX b'\\s+(libcairo\\.[^\\s]+)\\s+\\(libc6,x86-64'
libcairo.so.2
$ python2.7 -c 'import sys; sys.platform="netbsd7"; from ctypes import util; 
print(util.find_library("cairo"))'
YYY '\\s+(libcairo\\.[^\\s]+)\\s+\\(libc6,x86-64'
libcairo.so.2

Given the implementation

   def find_library(name):
return _findSoname_ldconfig(name) or 
_get_soname(_findLib_gcc(name))

you might try calling _findSoname_ldconfig() directly -- if it fails for 
both 2.7 and 3.6 the next step would be to have a look at the fallback.




-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.6 can find cairo libs but not Python 2.7

2018-07-13 Thread D'Arcy Cain
On 2018-07-13 08:05 AM, Peter Otten wrote:
> D'Arcy Cain wrote:
>> Nope.  Both are 64 bit.
> 
> Just to be 100% sure, what does
> 
> $ python2.7 -c 'import struct; print(struct.calcsize("l"))'
> 
> $ python3.6 -c 'import struct; print(struct.calcsize("l"))'
> 
> print? 

$ python2.7 -c 'import struct; print(struct.calcsize("l"))'
8
$ python3.6 -c 'import struct; print(struct.calcsize("l"))'
8

> If both print 8, what is sys.platform? (This is just that I can look at the 
> right branch of the ctypes.util source for differences)?

$ python2.7 -c 'import sys; print(sys.platform)'
netbsd7
$ python3.6 -c 'import sys; print(sys.platform)'
netbsd7

Thanks for checking this.

-- 
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:da...@vex.net VoIP: sip:da...@vybenetworks.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.6 can find cairo libs but not Python 2.7

2018-07-13 Thread Peter Otten
D'Arcy Cain wrote:

> On 2018-07-12 07:41 PM, Peter Otten wrote:
>> Wild guess: one Python is 64 bit and the other is 32 bit, and you have
>> only one version of the library installed.
> 
> Nope.  Both are 64 bit.

Just to be 100% sure, what does

$ python2.7 -c 'import struct; print(struct.calcsize("l"))'

$ python3.6 -c 'import struct; print(struct.calcsize("l"))'

print? 

If both print 8, what is sys.platform? (This is just that I can look at the 
right branch of the ctypes.util source for differences)?


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.6 can find cairo libs but not Python 2.7

2018-07-13 Thread D'Arcy Cain
On 2018-07-12 07:41 PM, Peter Otten wrote:
> Wild guess: one Python is 64 bit and the other is 32 bit, and you have only 
> one version of the library installed.

Nope.  Both are 64 bit.

-- 
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:da...@vex.net VoIP: sip:da...@vybenetworks.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.6 can find cairo libs but not Python 2.7

2018-07-13 Thread D'Arcy Cain
On 2018-07-12 04:17 PM, Terry Reedy wrote:
> On 7/12/2018 3:52 PM, D'Arcy Cain wrote:
>> $ python2.7 -c "import ctypes.util;
>> print(ctypes.util.find_library('cairo'))"
>> libcairo.so.2
>> $ python3.6 -c "import ctypes.util;
>> print(ctypes.util.find_library('cairo'))"
>> None
>>
>> I have the 3.6 version of py-cairo installed.  Any thoughts?
>>
>> NetBSD 7.1.2
> 
> what is sys.path?  Where in py-cairo installed?

For 3.6 it includes '/usr/pkg/lib/python3.6/site-packages' and for 2.7
it includes '/usr/pkg/lib/python2.7/site-packages'.  The py-cairo files
are in the 3.6 site-packages.  There are no Cairo files in the 2.7
Python directory.

I'm not sure why that matters though.  It's the system libraries that it
can't find unless having py-cairo installed is somehow blocking the
search for the libraries.

Of course, my actual use depends on a cairo package.  In fact, the
failure that led me to the above issue happens when I load cairocffi.

$ python3.6 -c "import cairocffi"
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/pkg/lib/python3.6/site-packages/cairocffi/__init__.py",
line 41, in 
cairo = dlopen(ffi, 'cairo', 'cairo-2')
  File "/usr/pkg/lib/python3.6/site-packages/cairocffi/__init__.py",
line 38, in dlopen
raise OSError("dlopen() failed to load a library: %s" % ' /
'.join(names))
OSError: dlopen() failed to load a library: cairo / cairo-2

-- 
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:da...@vex.net VoIP: sip:da...@vybenetworks.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.6 can find cairo libs but not Python 2.7

2018-07-12 Thread Peter Otten
D'Arcy Cain wrote:

> $ python2.7 -c "import ctypes.util;
> print(ctypes.util.find_library('cairo'))"
> libcairo.so.2
> $ python3.6 -c "import ctypes.util;
> print(ctypes.util.find_library('cairo'))"
> None
> 
> I have the 3.6 version of py-cairo installed.  Any thoughts?
> 
> NetBSD 7.1.2

Wild guess: one Python is 64 bit and the other is 32 bit, and you have only 
one version of the library installed.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.6 can find cairo libs but not Python 2.7

2018-07-12 Thread Terry Reedy

On 7/12/2018 3:52 PM, D'Arcy Cain wrote:

$ python2.7 -c "import ctypes.util;
print(ctypes.util.find_library('cairo'))"
libcairo.so.2
$ python3.6 -c "import ctypes.util;
print(ctypes.util.find_library('cairo'))"
None

I have the 3.6 version of py-cairo installed.  Any thoughts?

NetBSD 7.1.2


what is sys.path?  Where in py-cairo installed?


--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Python 3.6 can find cairo libs but not Python 2.7

2018-07-12 Thread D'Arcy Cain
$ python2.7 -c "import ctypes.util;
print(ctypes.util.find_library('cairo'))"
libcairo.so.2
$ python3.6 -c "import ctypes.util;
print(ctypes.util.find_library('cairo'))"
None

I have the 3.6 version of py-cairo installed.  Any thoughts?

NetBSD 7.1.2

Cheers.

-- 
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:da...@vex.net
VoIP: sip:da...@vex.net
-- 
https://mail.python.org/mailman/listinfo/python-list