X Tutup
Skip to content

Commit bf19907

Browse files
committed
Merged revisions 79082,79084 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r79082 | collin.winter | 2010-03-18 17:00:30 -0700 (Thu, 18 Mar 2010) | 1 line Add a separate python-config make target, useful for testing changes to Misc/python-config.in. ........ r79084 | collin.winter | 2010-03-18 17:08:44 -0700 (Thu, 18 Mar 2010) | 1 line Make python-config support multiple option flags on the same command line, rather than requiring one invocation per flag. ........
1 parent 0dbc667 commit bf19907

File tree

3 files changed

+37
-30
lines changed

3 files changed

+37
-30
lines changed

Makefile.pre.in

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,11 @@ $(srcdir)/Lib/$(PLATDIR):
941941
export EXE; EXE="$(BUILDEXE)"; \
942942
cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
943943

944+
python-config: $(srcdir)/Misc/python-config.in
945+
# Substitution happens here, as the completely-expanded BINDIR
946+
# is not available in configure
947+
sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
948+
944949
# Install the include files
945950
INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
946951
inclinstall:
@@ -966,7 +971,7 @@ LIBPL= $(LIBP)/config
966971
# pkgconfig directory
967972
LIBPC= $(LIBDIR)/pkgconfig
968973

969-
libainstall: all
974+
libainstall: all python-config
970975
@for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \
971976
do \
972977
if test ! -d $(DESTDIR)$$i; then \
@@ -997,9 +1002,6 @@ libainstall: all
9971002
$(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc
9981003
$(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
9991004
$(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
1000-
# Substitution happens here, as the completely-expanded BINDIR
1001-
# is not available in configure
1002-
sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
10031005
$(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
10041006
rm python-config
10051007
@if [ -s Modules/python.exp -a \

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,8 @@ Build
889889
- Issue #7541: when using ``python-config`` with a framework install the
890890
compiler might use the wrong library.
891891

892+
- python-config now supports multiple options on the same command line.
893+
892894
Documentation
893895
------------
894896

Misc/python-config.in

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,36 @@ except getopt.error:
2121
if not opts:
2222
exit_with_usage()
2323

24-
opt = opts[0][0]
25-
2624
pyver = sysconfig.get_config_var('VERSION')
2725
getvar = sysconfig.get_config_var
2826

29-
if opt == '--help':
30-
exit_with_usage(0)
31-
32-
elif opt == '--prefix':
33-
print(sysconfig.PREFIX)
34-
35-
elif opt == '--exec-prefix':
36-
print(sysconfig.EXEC_PREFIX)
37-
38-
elif opt in ('--includes', '--cflags'):
39-
flags = ['-I' + sysconfig.get_python_inc(),
40-
'-I' + sysconfig.get_python_inc(plat_specific=True)]
41-
if opt == '--cflags':
42-
flags.extend(getvar('CFLAGS').split())
43-
print(' '.join(flags))
44-
45-
elif opt in ('--libs', '--ldflags'):
46-
libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
47-
libs.append('-lpython'+pyver)
48-
# add the prefix/lib/pythonX.Y/config dir, but only if there is no
49-
# shared library in prefix/lib/.
50-
if opt == '--ldflags' and not getvar('Py_ENABLE_SHARED'):
51-
libs.insert(0, '-L' + getvar('LIBPL'))
52-
print(' '.join(libs))
27+
opt_flags = [flag for (flag, val) in opts]
28+
29+
if '--help' in opt_flags:
30+
exit_with_usage(code=0)
31+
32+
for opt in opt_flags:
33+
if opt == '--prefix':
34+
print(sysconfig.PREFIX)
35+
36+
elif opt == '--exec-prefix':
37+
print(sysconfig.EXEC_PREFIX)
38+
39+
elif opt in ('--includes', '--cflags'):
40+
flags = ['-I' + sysconfig.get_python_inc(),
41+
'-I' + sysconfig.get_python_inc(plat_specific=True)]
42+
if opt == '--cflags':
43+
flags.extend(getvar('CFLAGS').split())
44+
print(' '.join(flags))
45+
46+
elif opt in ('--libs', '--ldflags'):
47+
libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
48+
libs.append('-lpython'+pyver)
49+
# add the prefix/lib/pythonX.Y/config dir, but only if there is no
50+
# shared library in prefix/lib/.
51+
if opt == '--ldflags':
52+
if not getvar('Py_ENABLE_SHARED'):
53+
libs.insert(0, '-L' + getvar('LIBPL'))
54+
libs.extend(getvar('LINKFORSHARED').split())
55+
print(' '.join(libs))
5356

0 commit comments

Comments
 (0)
X Tutup