Bug 80688 - pycairo 1.10.0 fails to build with CPython 3.4, works fine with CPython 3.3
Summary: pycairo 1.10.0 fails to build with CPython 3.4, works fine with CPython 3.3
Status: RESOLVED FIXED
Alias: None
Product: pycairo
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium blocker
Assignee: Steve Chaplin
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-29 18:57 UTC by Daniel Richard Stromberg
Modified: 2017-07-05 14:57 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Daniel Richard Stromberg 2014-06-29 18:57:38 UTC
pycairo 1.10.0 fails to build on CPython 3.4, because 3.4's python-config became a /bin/sh script. In CPython 3.3, python-config is a python script. This would be fine if python-config were allowed to get its interpreter via a #!, but pycairo tries to run the script via a python interpreter explicitly, which of course produces a syntax error.

The error looks like:
Checking for program python3.4-config              : /usr/local/cpython-3.4/bin/python-config
command ['/usr/local/cpython-3.4/bin/python', '/usr/local/cpython-3.4/bin/python-config', '--includes'] returned 1
  ./options()
  ./configure()

And the beginning of 3.4's python-config:
$ head /usr/local/cpython-3.4/bin/python-config
#!/bin/sh

# Keep this script in sync with python-config.in

exit_with_usage ()
{
    echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir"
    exit $1
}

But the beginning of 3.3's python-config looks like:
$ head /usr/local/cpython-3.3/bin/python-config
#!/usr/local/cpython-3.3/bin/python3.3m
# -*- python -*-

import getopt
import os
import sys
import sysconfig

valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags',
              'ldflags', 'extension-suffix', 'help', 'abiflags', 'configdir']

Thanks.
Comment 1 lucidbee 2014-07-10 18:54:51 UTC
I ran into this also though with 2.7. My python2.7-config was a csh script. I copied a python2.7-config from another ubuntu system that was python and overwrote the csh version and then was able to install.
Comment 2 Lawrence D'Oliveiro 2015-02-16 06:39:51 UTC
I have been building pycairo 1.10.1 just fine for Python 3.2, 3.3 and 3.4. So let me suggest this bug report is obsolete.
Comment 3 David H. Gutteridge 2015-12-12 07:22:21 UTC
This issue is certainly still relevant in some environments. Building on NetBSD fails with:

command ['/usr/pkg/bin/python3.4', '/usr/pkg/bin/python3.4-config', '--includes'] returned 1
*** Error code 1

That is, it fails unless this is patched around, as it is via pkgsrc.org.
Comment 4 Michael Aldridge 2016-02-14 07:36:22 UTC
This bug is certainly still present and prevents building pycairo on Void Linux using CPython3.4.
Comment 5 David H. Gutteridge 2016-02-14 09:38:08 UTC
In case this helps anyone else, the pkgsrc.org patch to work around this problem is here:

http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/pkgsrc/graphics/py-cairo3/patches/patch-.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6_waflib_Tools_python.py?rev=1.1&content-type=text/plain&only_with_tag=MAIN

The issue is caused by waf assuming that python-config is a python script. Modifying its code so it calls python-config without prepending a path to the python interpreter fixes the issue.
Comment 6 Christoph Reiter 2017-07-05 14:57:21 UTC
Since 1.11 pycairo uses distutils for building. If there are any problems with the new system please file a bug: https://github.com/pygobject/pycairo/issues


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.