SOURCES: python-config - replaced with version from https://source...

glen glen at pld-linux.org
Fri Sep 15 16:08:26 CEST 2006


Author: glen                         Date: Fri Sep 15 14:08:26 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- replaced with version from https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1161914&group_id=5470

---- Files affected:
SOURCES:
   python-config (1.2 -> 1.3) 

---- Diffs:

================================================================
Index: SOURCES/python-config
diff -u SOURCES/python-config:1.2 SOURCES/python-config:1.3
--- SOURCES/python-config:1.2	Fri Sep 15 15:53:05 2006
+++ SOURCES/python-config	Fri Sep 15 16:08:21 2006
@@ -1,10 +1,50 @@
-#!/usr/bin/python
-import distutils.sysconfig
-import string
+#!/bin/env python
+
 import sys
+import os
+import getopt
+from distutils import sysconfig
+
+valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags', 
+              'ldflags', 'help']
+
+def exit_with_usage(code=1):
+    print >>sys.stderr, "Usage: %s [%s]" % (sys.argv[0], 
+                                            '|'.join('--'+opt for opt in valid_opts))
+    sys.exit(code)
+
+try:
+    opts, args = getopt.getopt(sys.argv[1:], '', valid_opts)
+except getopt.error:
+    exit_with_usage()
+
+if not opts:
+    exit_with_usage()
+
+opt = opts[0][0]
+
+pyver = sysconfig.get_config_var('VERSION')
+getvar = sysconfig.get_config_var
+
+if opt == '--help':
+    exit_with_usage(0)
+
+elif opt == '--prefix':
+    print sysconfig.PREFIX
+
+elif opt == '--exec-prefix':
+    print sysconfig.EXEC_PREFIX
 
-ver = sys.version[:3]
-modlibs = string.join(string.split(distutils.sysconfig.get_config_var("MODLIBS")))
+elif opt in ('--includes', '--cflags'):
+    flags = ['-I'+dir for dir in getvar('INCLDIRSTOMAKE').split()]
+    if opt == '--cflags':
+        flags.extend(getvar('CFLAGS').split())
+    print ' '.join(flags)
 
-print "-lpython%s -lm -L/usr/lib/python%s/config %s" %(ver, ver, modlibs)
+elif opt in ('--libs', '--ldflags'):
+    libs = sysconfig.get_config_var('LIBS').split()
+    libs.append('-lpython'+pyver)
+    if opt == '--ldflags':
+        libs.insert(0, '-L' + getvar('LIBPL'))
+    print ' '.join(libs)
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/python-config?r1=1.2&r2=1.3&f=u



More information about the pld-cvs-commit mailing list