Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect linkage if system PyCXX is found #1884

Merged
merged 1 commit into from Apr 25, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 21 additions & 6 deletions setupext.py
Expand Up @@ -281,7 +281,8 @@ def setup_extension(self, ext, package, default_include_dirs=[],
use_defaults = True
if self.has_pkgconfig:
try:
output = check_output(command, shell=True)
output = check_output(command, shell=True,
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError:
pass
else:
Expand All @@ -303,7 +304,7 @@ def setup_extension(self, ext, package, default_include_dirs=[],
dir = os.path.join(base, lib)
if os.path.exists(dir):
ext.library_dirs.append(dir)
ext.libraries = default_libraries
ext.libraries.extend(default_libraries)
return True

return False
Expand All @@ -321,6 +322,7 @@ def get_version(self, package):
return output
return None


# The PkgConfig class should be used through this singleton
pkg_config = PkgConfig()

Expand Down Expand Up @@ -402,13 +404,17 @@ def _check_for_pkg_config(self, package, include_file, min_version=None,
if version is None:
version = pkg_config.get_version(package)

if version is None:
raise CheckFailed(
"pkg-config information for '%s' could not be found" %
package)

if min_version == 'PATCH':
raise CheckFailed(
"Requires patches that have not been merged upstream.")

if min_version:
if (version is not None and
not is_min_version(version, min_version)):
if (not is_min_version(version, min_version)):
raise CheckFailed(
"Requires %s %s or later. Found %s." %
(package, min_version, version))
Expand Down Expand Up @@ -665,8 +671,17 @@ def check(self):
return self._check_for_pkg_config(
'PyCXX', 'CXX/Extensions.hxx', min_version='6.2.4')
except CheckFailed as e:
self.__class__.found_external = False
return str(e) + ' Using local copy.'
# Since there is no .pc file for PyCXX upstream, many
# distros don't package it either. We don't necessarily
# need to fall back to a local build in that scenario if
# the header files can be found.
base_include_dirs = [
os.path.join(x, 'include') for x in get_base_dirs()]
if has_include_file(base_include_dirs, 'CXX/Extensions.hxx'):
return 'Using system CXX (version unknown, no pkg-config info)'
else:
self.__class__.found_external = False
return str(e) + ' Using local copy.'

def add_flags(self, ext):
if self.found_external:
Expand Down