Opened 7 years ago

Closed 6 years ago

#34889 closed defect (fixed)

py27-cairo 1.8.10 incompatible with cairo +quartz

Reported by: m214089 Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.1.1
Keywords: Cc: elelay (Eric Le Lay), g5pw (Aljaž Srebrnič), seanfarley (Sean Farley)
Port: py27-cairo

Description

port install py27-cairo

leads to a load of an installation package which is precompiled with x11 support not complaining if cairo itself is installed without x11 but with quartz. Trying to install with

port build py27-cairo

and

port destroot py27-cairo

does not install properly.

Attachments (2)

py27-cairo.patch (3.3 KB) - added by g5pw (Aljaž Srebrnič) 6 years ago.
Portfile (2.4 KB) - added by g5pw (Aljaž Srebrnič) 6 years ago.

Download all attachments as: .zip

Change History (26)

comment:1 Changed 7 years ago by mf2k (Frank Schima)

Keywords: python cairo build installation removed
Port: @1.8.10 removed

comment:2 Changed 6 years ago by elelay (Eric Le Lay)

example stacktrace:

1353435148.901207 [gpodder.log] ERROR: Uncaught exception: Traceback (most recent call last):
  File "/Applications/MacPorts/gPodder.app/Contents/MacOS/gpodder", line 175, in <module>
    main()
  File "/Applications/MacPorts/gPodder.app/Contents/MacOS/gpodder", line 168, in main
    from gpodder.gtkui import main
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gpodder/gtkui/main.py", line 22, in <module>
    import gtk
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.py", line 40, in <module>
    from gtk import _gtk
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cairo/__init__.py", line 1, in <module>
    from _cairo import *
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cairo/_cairo.so, 2): Symbol not found: _cairo_xlib_surface_get_depth
  Referenced from: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cairo/_cairo.so
  Expected in: /opt/local/lib/libcairo.2.dylib
 in /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cairo/_cairo.so

A solution would be to add a quartz variant to py-cairo, like in py27-gtk, and maybe a check for actual installation of quartz variant of gtk before proceeding with install, like in gtk-osx-application.

comment:3 Changed 6 years ago by elelay (Eric Le Lay)

Cc: elelay@… added

Cc Me!

comment:4 Changed 6 years ago by g5pw (Aljaž Srebrnič)

Hello! I resolved the problem simply by updating to 1.10.0. Attaching the patch for you to take a look, and then I'll commit it. I'm not so sure about some things, like the exec_prefix. It would be great to unify this port with the python portgroup, too...

This has a duplicate, #34724

Last edited 6 years ago by g5pw (Aljaž Srebrnič) (previous) (diff)

Changed 6 years ago by g5pw (Aljaž Srebrnič)

Attachment: py27-cairo.patch added

comment:5 in reply to:  4 Changed 6 years ago by seanfarley (Sean Farley)

Replying to g5pw@…:

Hello! I resolved the problem simply by updating to 1.10.0. Attaching the patch for you to take a look, and then I'll commit it. I'm not so sure about some things, like the exec_prefix. It would be great to unify this port with the python portgroup, too...

This has a duplicate, #34724

It's been a while since I looked at this port, but I was able to unify it with python group and avoid using the crazy ./waf script stuff. My portfile is located here:

https://bitbucket.org/seanfarley/scienceports/src/b4bac6a7317a8f94c29ce39e81ae693d5a3503f0/python/py-cairo/Portfile?at=default

comment:6 Changed 6 years ago by g5pw (Aljaž Srebrnič)

Cc: g5pw@… added

Cc Me!

comment:7 Changed 6 years ago by g5pw (Aljaž Srebrnič)

What's wrong with the waf script stuff? It's the official way to install it, autoconf &make is unsupported, or so says the readme...

comment:8 in reply to:  7 Changed 6 years ago by seanfarley (Sean Farley)

Replying to g5pw@…:

What's wrong with the waf script stuff? It's the official way to install it, autoconf &make is unsupported, or so says the readme...

Good question. I wish I had saved my notes but I seem to remember ./waf not getting the correct python (even when run from the command line!). Ah, right, here is the error I got:

$ python3.2 ./waf configure --prefix=$SANDBOX/local-cairo3
  ./options()
Setting top to                           : /Users/sean/sandbox/pycairo-1.10.0 
Setting out to                           : /Users/sean/sandbox/pycairo-1.10.0/build_directory 
  ./configure()
Checking for 'gcc' (c compiler)          : ok 
Checking for program python              : /opt/local/bin/python 
python executable '/opt/local/bin/python' different from sys.executable '/opt/local/Library/Frameworks/Python.framework/Versions/3.2/Resources/Python.app/Contents/MacOS/Python'
Checking for python version              : (2, 7, 3, 'final', 0) 
The python version is too old, expecting (3, 1, 0)
(complete log in /Users/sean/sandbox/pycairo-1.10.0/build_directory/config.log)

There are some comments here,

http://stackoverflow.com/questions/6232529/how-to-install-pycairo-for-python-3-on-ubuntu-10-04

that also complain about ./waf not getting the correct version of python. I just checked and it's still not fixed in the git repos :-(

comment:9 Changed 6 years ago by g5pw (Aljaž Srebrnič)

Hmm... ok, but we'd be forced to rewrite the setup.py every time something changes upstream... I compiled with waf, and it all went OK!

comment:10 in reply to:  9 Changed 6 years ago by seanfarley (Sean Farley)

Replying to g5pw@…:

Hmm... ok, but we'd be forced to rewrite the setup.py every time something changes upstream... I compiled with waf, and it all went OK!

Did you try changing the python version (e.g. python3.2)? I think it works by chance that the system python is the same as python27. Also, the files don't get installed into the right "python" directories.

One thing we could try to use a newer waf script from:

http://code.google.com/p/waf/

and then move the ${prefix}/lib and ${prefix}/include directories into the framework structure during the post-destroot stage. I might be able to write that patch this afternoon.

comment:11 in reply to:  9 Changed 6 years ago by seanfarley (Sean Farley)

Replying to g5pw@…:

Hmm... ok, but we'd be forced to rewrite the setup.py every time something changes upstream... I compiled with waf, and it all went OK!

Ah, also, the setup.py comes straight from the pycairo repo. It seems they are switching (slowly) to setup.py for python3. In my portfile, I just use their setup.py and patch it to work for python2.X. I'm trying to get waf to work with a new version but it is a major pain-in-the-ass.

comment:12 Changed 6 years ago by seanfarley (Sean Farley)

Here's one of the devs saying that they support setup.py for python3:

https://bugs.freedesktop.org/show_bug.cgi?id=51458

Since I can't get waf to work out, I'm going to suggest using pycairo's setup.py and backporting it to python2 when needed.

comment:13 in reply to:  4 Changed 6 years ago by elelay (Eric Le Lay)

Replying to g5pw@…:

Hello! I resolved the problem simply by updating to 1.10.0.

Hi g5pw, You have not only updated: you have added the quartz variant, as suggested.

I think also checking for the installed version of gtk is important for consistency. Cheers, Eric

comment:14 Changed 6 years ago by g5pw (Aljaž Srebrnič)

Sean, I like your version then, I'll commit it if you want. Would you take maintainership, too?

comment:15 in reply to:  14 Changed 6 years ago by seanfarley (Sean Farley)

Replying to g5pw@…:

Sean, I like your version then, I'll commit it if you want. Would you take maintainership, too?

Oh man, I missed this comment (it seems that these don't forward to email?). Sure, I'd be happy to take ownership … but I have no committers rights :-/ I really would like to have a unified port for this since it's blocking the update for py3x-matplotlib (well, with the +cairo variant).

comment:16 Changed 6 years ago by g5pw (Aljaž Srebrnič)

Sean, I can commit everything for you :) just send me the patches or new files!

comment:17 Changed 6 years ago by mf2k (Frank Schima)

@sean.michael.farley: You missed the comment because you weren't Cc'ed on this ticket. Anyone can be maintainer for a port. You can attach patches to Tickets. Once you have a history of writing good patches, you can apply to be a committer.

comment:18 Changed 6 years ago by mf2k (Frank Schima)

Cc: sean.michael.farley@… added

comment:19 in reply to:  17 Changed 6 years ago by seanfarley (Sean Farley)

Replying to g5pw@…:

Sean, I can commit everything for you :) just send me the patches or new files!

Oh, sweet! Since I made a lot of patches to fix this issue and update the port, I would say just include the version I have in my repo:

https://bitbucket.org/seanfarley/scienceports/src/46319aea8af3889e68b80de28ab93d4f10a445bd/python/py-cairo/Portfile?at=default

If you really want the patches, then they can be downloaded from the bitbucket repo individually as well.

Replying to macsforever2000@…:

@sean.michael.farley: You missed the comment because you weren't Cc'ed on this ticket. Anyone can be maintainer for a port. You can attach patches to Tickets. Once you have a history of writing good patches, you can apply to be a committer.

Ah, I see now. I was wrongly under the impression that if I replied then I would be cc'ed. Thanks for including me now!

comment:20 Changed 6 years ago by g5pw (Aljaž Srebrnič)

with your permission, I'd like to add openmaintainer, to speed up small fixes, and use the active_variants portgroup to check for the active cairo variant. Oh, and the modeline :) is it ok with you?

comment:21 in reply to:  20 Changed 6 years ago by seanfarley (Sean Farley)

Replying to g5pw@…:

with your permission, I'd like to add openmaintainer, to speed up small fixes, and use the active_variants portgroup to check for the active cairo variant. Oh, and the modeline :) is it ok with you?

Sure, sounds good :-)

comment:22 Changed 6 years ago by g5pw (Aljaž Srebrnič)

I'm attaching the portfile I'll commit, with your permission. Take a look!

Changed 6 years ago by g5pw (Aljaž Srebrnič)

Attachment: Portfile added

comment:23 in reply to:  22 Changed 6 years ago by seanfarley (Sean Farley)

Replying to g5pw@…:

I'm attaching the portfile I'll commit, with your permission. Take a look!

Looks good! :-) I like the use of the active_variants port group, very nice!

comment:24 Changed 6 years ago by g5pw (Aljaž Srebrnič)

Resolution: fixed
Status: newclosed

Commited everything in r100265. From now on, of you wanna make changes, drop an email to me with the diff or open a ticket ;)

Note: See TracTickets for help on using tickets.