Make plpythonu language use plpython2 shared library directly.
authorTom Lane
Sat, 5 Mar 2011 20:13:15 +0000 (15:13 -0500)
committerTom Lane
Sat, 5 Mar 2011 20:13:15 +0000 (15:13 -0500)
The original scheme for this was to symlink plpython.$DLSUFFIX to
plpython2.$DLSUFFIX, but that doesn't work on Windows, and only
accidentally failed to fail because of the way that CREATE LANGUAGE created
or didn't create new C functions.  My changes of yesterday exposed the
weakness of that approach.  To fix, get rid of the symlink and make
pg_pltemplate show what's really going on.

doc/src/sgml/plpython.sgml
src/include/catalog/catversion.h
src/include/catalog/pg_pltemplate.h
src/pl/plpython/Makefile
src/tools/msvc/Mkvcbuild.pm

index 0aa5159e2b78d3933a013f37cf0bbf99495b5b25..ba785e9a531044b5e5c55009b577b14f23eefb13 100644 (file)
     
      
       Daredevils, who want to build a Python-3-only operating system
-      environment, can change the build scripts to
-      make plpythonu be equivalent
+      environment, can change the contents of
+      pg_pltemplate
+      to make plpythonu be equivalent
       to plpython3u, keeping in mind that this
       would make their installation incompatible with most of the rest
       of the world.
index 56fb4931ba7c56884d31b9457499c6d51555e182..5131d02732d0e21c9f56a2d0b397ef2d679a11e0 100644 (file)
@@ -53,6 +53,6 @@
  */
 
 /*                         yyyymmddN */
-#define CATALOG_VERSION_NO 201103042
+#define CATALOG_VERSION_NO 201103051
 
 #endif
index fa086525e7ffe4488a7c66af2eb6c62b63d2c99a..0d5c2314d18d95fad9840fb23c72440ffbbef22b 100644 (file)
@@ -72,7 +72,7 @@ DATA(insert ( "pltcl"     t t "pltcl_call_handler" _null_ _null_ "$libdir/pltcl" _n
 DATA(insert ( "pltclu"     f f "pltclu_call_handler" _null_ _null_ "$libdir/pltcl" _null_ ));
 DATA(insert ( "plperl"     t t "plperl_call_handler" "plperl_inline_handler" "plperl_validator" "$libdir/plperl" _null_ ));
 DATA(insert ( "plperlu"        f f "plperlu_call_handler" "plperlu_inline_handler" "plperlu_validator" "$libdir/plperl" _null_ ));
-DATA(insert ( "plpythonu"  f f "plpython_call_handler" "plpython_inline_handler" "plpython_validator" "$libdir/plpython" _null_ ));
+DATA(insert ( "plpythonu"  f f "plpython_call_handler" "plpython_inline_handler" "plpython_validator" "$libdir/plpython2" _null_ ));
 DATA(insert ( "plpython2u" f f "plpython2_call_handler" "plpython2_inline_handler" "plpython2_validator" "$libdir/plpython2" _null_ ));
 DATA(insert ( "plpython3u" f f "plpython3_call_handler" "plpython3_inline_handler" "plpython3_validator" "$libdir/plpython3" _null_ ));
 
index 46e0195142424a8ec594c5202ee46aa6c60941ec..baf22f386f059472f3fe2d3375bc6992a07e9f57 100644 (file)
@@ -67,6 +67,7 @@ REGRESS_OPTS = --dbname=$(PL_TESTDB)
 ifeq ($(python_majorversion),2)
 REGRESS_OPTS += --load-extension=plpythonu
 endif
+
 REGRESS = \
    plpython_schema \
    plpython_populate \
@@ -88,6 +89,7 @@ REGRESS = \
    plpython_composite \
    plpython_subtransaction \
    plpython_drop
+
 # where to find psql for running the tests
 PSQLDIR = $(bindir)
 
@@ -105,17 +107,11 @@ distprep: spiexceptions.h
 
 
 install: all installdirs install-lib install-data
-ifeq ($(python_majorversion),2)
-   cd '$(DESTDIR)$(pkglibdir)' && rm -f plpython$(DLSUFFIX) && $(LN_S) $(shlib) plpython$(DLSUFFIX)
-endif
 
 installdirs: installdirs-lib
    $(MKDIR_P) '$(DESTDIR)$(datadir)/extension'
 
 uninstall: uninstall-lib uninstall-data
-ifeq ($(python_majorversion),2)
-   rm -f '$(DESTDIR)$(pkglibdir)/plpython$(DLSUFFIX)'
-endif
 
 install-data:
    @for file in $(addprefix $(srcdir)/, $(DATA)); do \
index 21c11dffd765f1c2d1026eb512b425eb9fc6ff8f..1231f643d6a544b126aa888026416d9b69fc3fe7 100644 (file)
@@ -172,8 +172,8 @@ sub mkvcbuild
 
     if ($solution->{options}->{python})
     {
-
-        # Attempt to get python version and location. Assume python.exe in specified dir.
+        # Attempt to get python version and location.
+        # Assume python.exe in specified dir.
         open(P,
             $solution->{options}->{python}
               . "\\python -c \"import sys;print(sys.prefix);print(str(sys.version_info[0])+str(sys.version_info[1]))\" |"
@@ -184,11 +184,14 @@ sub mkvcbuild
         chomp($pyver);
         close(P);
 
-  # Sometimes (always?) if python is not present, the execution actually works, but gives no data...
+        # Sometimes (always?) if python is not present, the execution
+        # appears to work, but gives no data...
         die "Failed to query python for version information\n"
           if (!(defined($pyprefix) && defined($pyver)));
 
-        my $plpython = $solution->AddProject('plpython','dll','PLs','src\pl\plpython');
+        my $pymajorver = substr($pyver, 0, 1);
+        my $plpython = $solution->AddProject('plpython' . $pymajorver, 'dll',
+                                             'PLs', 'src\pl\plpython');
         $plpython->AddIncludeDir($pyprefix . '\include');
         $plpython->AddLibrary($pyprefix . "\\Libs\\python$pyver.lib");
         $plpython->AddReference($postgres);