classification
Title: python-config
Type: Stage:
Components: Distutils Versions:
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, loewis, mdehoon, tatsujin
Priority: normal Keywords: patch

Created on 2005-03-12 10:44 by tatsujin, last changed 2006-04-15 08:14 by loewis. This issue is now closed.

Files
File name Uploaded Description Edit
python-config tatsujin, 2005-03-12 10:44 python-config script for building embedding application.
python-config georg.brandl, 2006-03-31 14:26 new version, python only
Messages (9)
msg47936 - (view) Author: Andre Jonsson (tatsujin) Date: 2005-03-12 10:44
I'm not sure this is the correct place to do this, but I found the need 
for a python-config (similar to sdl-config, etc.) when building an 
C++ application that embeds python.

It accepts two arguments --cflags and --static-libs:

# ./python-config --cflags --static-libs 
-I/usr/include/python2.4
/usr/lib/python2.4/config/libpython2.4.a

I guess it could be expanded to do more, but it was all I needed.
msg47937 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-03-13 22:47
Logged In: YES 
user_id=21627

This is the right place if you want this to be included in
the standard Python distribution. If you just want to share
it with others, the Python cookbook is a better place:

http://aspn.activestate.com/ASPN/Python/Cookbook/

In the current form, this is not acceptable, as it is
incomplete (e.g. there is no integration into the Python
build process, and we need to know what specific options are
expected from a *-config program, and implement them). Are
you willing to complete this?
msg47938 - (view) Author: Andre Jonsson (tatsujin) Date: 2005-03-14 08:43
Logged In: YES 
user_id=195710

Ok. I'll make an attempt. What do you mean by "what 
specific options are expected from a *-config program" 
?
msg47939 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-03-14 19:14
Logged In: YES 
user_id=21627

It appears that the *-config programs (e.g. gtk-config, ...)
share command line options; this seems to be part of the
"pkg-config" system. I think we need to understand what
precisely the standard for these utilities is, and conform
to it.
msg47940 - (view) Author: Michiel de Hoon (mdehoon) * Date: 2005-06-10 15:03
Logged In: YES 
user_id=488897

Three comments:

1) When running this script, I got the following error on
Unix and Cygwin:

$ python-config.php --cflags --static-libs
-I/usr/local/include/python2.4
Traceback (most recent call last):
  File "<string>", line 1, in ?
AttributeError: 'module' object has no attribute 'lib'

2) Since we are Pythoneers, why write this script as a
shell-script instead of a Python script? (sh may not even be
available on Windows).

3) Isn't it easier / more reliable to get this information
via distutils? See section 5.6 of "Extending and Embedding
the Python Interpreter".
msg47941 - (view) Author: Andre Jonsson (tatsujin) Date: 2005-06-11 13:15
Logged In: YES 
user_id=195710

1. php? Anyway, I see that the 'lib' attribute actually isn't an official one. Bad 
call from my part.
2. Yes, I'm ashamed to have commited such atrocities. :-)
3. Ah, I see. Didn't know about that one.

That said, as loewis stated previously this script should probably follow the 
pkg-config standard anyhow. I haven't gotten around to do anything further in 
this matter, unfortunately.
msg47942 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-03-31 14:26
Logged In: YES 
user_id=849994

Uploading a python-only version. This should conform more
with pkg-config, though every *-config program on my box has
other options.
msg47943 - (view) Author: Andre Jonsson (tatsujin) Date: 2006-03-31 14:49
Logged In: YES 
user_id=195710

Excellent work! Looks nice.
msg47944 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-04-15 08:14
Logged In: YES 
user_id=21627

I took gbrandl's python-config, added a build process, and
committed this patch as #45417. Thanks to all contributors!
History
Date User Action Args
2005-03-12 10:44:15tatsujincreate