From 009e170d2838346461ff0b31b0afa44f3d6278f3 Mon Sep 17 00:00:00 2001
From: zanee <zanee>
Date: Fri, 23 Apr 2010 16:06:41 +0000
Subject: [PATCH 2/5] Fixes https://sourceforge.net/tracker/?func=detail&aid=2812016&group_id=28236&atid=392777 with applied patch from sourceforge user dbprice1.
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
setup.py | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/setup.py b/setup.py
index 0ffd9d2..76b9d58 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
-# $Id: setup.py,v 1.150 2008/09/09 17:40:34 kjetilja Exp $
+# $Id: setup.py,v 1.151 2010/04/23 16:06:41 zanee Exp $
"""Setup script for the PycURL module distribution."""
@@ -9,7 +9,7 @@ PACKAGE = "pycurl"
PY_PACKAGE = "curl"
VERSION = "7.19.0"
-import glob, os, re, sys, string
+import glob, os, re, sys, string, subprocess
import distutils
from distutils.core import setup
from distutils.extension import Extension
@@ -96,9 +96,22 @@ else:
include_dirs.append(e[2:])
else:
extra_compile_args.append(e)
- libs = split_quoted(
- os.popen("'%s' --libs" % CURL_CONFIG).read()+\
- os.popen("'%s' --static-libs" % CURL_CONFIG).read())
+
+ # Run curl-config --libs and --static-libs. Some platforms may not
+ # support one or the other of these curl-config options, so gracefully
+ # tolerate failure of either, but not both.
+ optbuf = ""
+ for option in ["--libs", "--static-libs"]:
+ p = subprocess.Popen("'%s' %s" % (CURL_CONFIG, option), shell=True,
+ stdout=subprocess.PIPE)
+ (stdout, stderr) = p.communicate()
+ if p.wait() == 0:
+ optbuf += stdout
+ if optbuf == "":
+ raise Exception, ("Neither of curl-config --libs or --static-libs" +
+ "produced output")
+ libs = split_quoted(optbuf)
+
for e in libs:
if e[:2] == "-l":
libraries.append(e[2:])
--
1.7.1