[Pythonmac-SIG] Re: python & postgresql: libpython?

Jerry LeVan jerry.levan at eku.edu
Thu Sep 30 15:00:38 CEST 2004


Scott,
The Makefile that comes with Postgresql v 7.4.5 is a bit screwed up 
with respect
to building the python shared lib.

I posted a query on the postgresql general news group about the problem
and a patch was posted by one of the developers.

I googled around and also found a recipe for building the python shared 
library
that also seems to work ( albeit a bit clumsy)

Here are the instructions:
  If everything goes right, you should be able to make. Here you will 
get some problems with Python,
but these can't be solved until a first (failing) make has been done.
  To fix these problems, open the src/Makefile.global and fix the line 
defining python_libspec by rep
lacing it with:

python_libspec          = -framework Python
  Now go to the src/pl/plpython/ directory and open the Makefile with 
your favorite text editor, comm
ent out the lines testing for a shared Python library (since on Mac OS 
X, this one is in a Framework
, the test fails as written).
#ifneq (,$(wildcard $(python_configdir)/libpython*$(DLSUFFIX)*))
#shared_libpython = yes
#endif

  and

#ifneq (,$(findstring yes, $(shared_libpython)$(allow_nonpic_in_shlib)))

  and don't forget the else part of it at the end of the file:

#else # can't build

#all:
#       @echo "";
#        echo "*** Cannot build PL/Python because libpython is not a 
shared #library." ;
#        echo "*** You might have to rebuild your Python installation.  
Refer to";
#        echo "*** the documentation for details.";
#        echo ""

#endif # can't build

  Now you are ready to make again. It should work.
  Of course, if you run the configuration process again, you would also 
have to redo these changes ag
ain.
*********
Basically you have to change the value of the python-libspec to   = 
-framework Python
and then comment out the test for shared libs in the python make file.

Anyway the shared library will be build and I was able to easily build 
the PyGreSQL module.

I am a python newby but was able to get all of the python demo programs 
in
the Douglas and Douglas book "Postgresql" to easily work (even the ones 
that
used the Tk interfaces).

Postgresql has interfaces to many programming systems Perl, Java, Tcl, 
Python,C, C++ and
more.

Hope this helps

Jerry

On Sep 30, 2004, at 6:00 AM, pythonmac-sig-request at python.org wrote:

> From: Scott Frankel <leknarf at pacbell.net>
> Date: September 29, 2004 8:22:29 PM EDT
> To: pythonmac-sig at python.org
> Subject: [Pythonmac-SIG] python & postgresql:  libpython?
>
>
>
> New to databases, I'm doing some leg-work to see which open source db 
> to
> use:  postgresql or mysql.  Without trying to start a flame war, I 
> have questions
> regarding postgresql installation & python, which is the scripting 
> language I'd like
> to use to interface with it.
>
> The installation docs warn that I might have to rebuild part of my 
> python install
> to create a python shared library.
>
>
> Questions:
>
> - Does the standard 2.3 MacPython install build a shared library?  If 
> so, it doesn't
>   appear to be called "libpython," as the postgresql docs suggest.
>
> - How would one rebuild part of the python install to create a shared 
> library?
>
> [and on thinner ice ...]
> - All things being equal (which they're not!), which db has more 
> robust/mature
>   python interfaces to choose from?
>
>
> Thanks in advance!
> Scott
>



More information about the Pythonmac-SIG mailing list