setup.py: Rework pycairo discovery to not use pkg-config
commiteb20f3c9f062fe25a44068ccab46475c4cb5e523
authorChristoph Reiter <creiter@src.gnome.org>
Sun, 10 Dec 2017 15:17:28 +0000 (10 16:17 +0100)
committerChristoph Reiter <creiter@src.gnome.org>
Sun, 10 Dec 2017 15:17:28 +0000 (10 16:17 +0100)
tree1cfb4e06c296de129c255877455ec835cf8ca054
parentde2ff6e883015741527638ab5cece47a97ef2856
setup.py: Rework pycairo discovery to not use pkg-config

Two problems with the previous approach:

* We looked into sys.prefix for the .pc file while the package
  could be installed in another location like the user dir location
  or on Debian it goes into /usr/local.
* The .pc file intalled by pycairo can contain wrong paths if
  installed through pip, since that sometimes builds a wheel
  and caches that for future installations to different locations.

Instead of using the .pc file use pkg_resources to discover the
pycairo location and then try to find the correspinding "data" installation
path for the first  matching location scheme.

See https://github.com/pygobject/pycairo/issues/85
setup.py