Commit bfd7f8cb authored by Tom Lane's avatar Tom Lane

Make plpythonu language use plpython2 shared library directly.

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.
parent ba0c93a0
...@@ -148,8 +148,9 @@ ...@@ -148,8 +148,9 @@
<listitem> <listitem>
<para> <para>
Daredevils, who want to build a Python-3-only operating system Daredevils, who want to build a Python-3-only operating system
environment, can change the build scripts to environment, can change the contents of
make <literal>plpythonu</literal> be equivalent <link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link>
to make <literal>plpythonu</literal> be equivalent
to <literal>plpython3u</literal>, keeping in mind that this to <literal>plpython3u</literal>, keeping in mind that this
would make their installation incompatible with most of the rest would make their installation incompatible with most of the rest
of the world. of the world.
......
...@@ -53,6 +53,6 @@ ...@@ -53,6 +53,6 @@
*/ */
/* yyyymmddN */ /* yyyymmddN */
#define CATALOG_VERSION_NO 201103042 #define CATALOG_VERSION_NO 201103051
#endif #endif
...@@ -72,7 +72,7 @@ DATA(insert ( "pltcl" t t "pltcl_call_handler" _null_ _null_ "$libdir/pltcl" _n ...@@ -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 ( "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 ( "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 ( "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 ( "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_ )); DATA(insert ( "plpython3u" f f "plpython3_call_handler" "plpython3_inline_handler" "plpython3_validator" "$libdir/plpython3" _null_ ));
......
...@@ -67,6 +67,7 @@ REGRESS_OPTS = --dbname=$(PL_TESTDB) ...@@ -67,6 +67,7 @@ REGRESS_OPTS = --dbname=$(PL_TESTDB)
ifeq ($(python_majorversion),2) ifeq ($(python_majorversion),2)
REGRESS_OPTS += --load-extension=plpythonu REGRESS_OPTS += --load-extension=plpythonu
endif endif
REGRESS = \ REGRESS = \
plpython_schema \ plpython_schema \
plpython_populate \ plpython_populate \
...@@ -88,6 +89,7 @@ REGRESS = \ ...@@ -88,6 +89,7 @@ REGRESS = \
plpython_composite \ plpython_composite \
plpython_subtransaction \ plpython_subtransaction \
plpython_drop plpython_drop
# where to find psql for running the tests # where to find psql for running the tests
PSQLDIR = $(bindir) PSQLDIR = $(bindir)
...@@ -105,17 +107,11 @@ distprep: spiexceptions.h ...@@ -105,17 +107,11 @@ distprep: spiexceptions.h
install: all installdirs install-lib install-data 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 installdirs: installdirs-lib
$(MKDIR_P) '$(DESTDIR)$(datadir)/extension' $(MKDIR_P) '$(DESTDIR)$(datadir)/extension'
uninstall: uninstall-lib uninstall-data uninstall: uninstall-lib uninstall-data
ifeq ($(python_majorversion),2)
rm -f '$(DESTDIR)$(pkglibdir)/plpython$(DLSUFFIX)'
endif
install-data: install-data:
@for file in $(addprefix $(srcdir)/, $(DATA)); do \ @for file in $(addprefix $(srcdir)/, $(DATA)); do \
......
...@@ -172,8 +172,8 @@ sub mkvcbuild ...@@ -172,8 +172,8 @@ sub mkvcbuild
if ($solution->{options}->{python}) if ($solution->{options}->{python})
{ {
# Attempt to get python version and location.
# Attempt to get python version and location. Assume python.exe in specified dir. # Assume python.exe in specified dir.
open(P, open(P,
$solution->{options}->{python} $solution->{options}->{python}
. "\\python -c \"import sys;print(sys.prefix);print(str(sys.version_info[0])+str(sys.version_info[1]))\" |" . "\\python -c \"import sys;print(sys.prefix);print(str(sys.version_info[0])+str(sys.version_info[1]))\" |"
...@@ -184,11 +184,14 @@ sub mkvcbuild ...@@ -184,11 +184,14 @@ sub mkvcbuild
chomp($pyver); chomp($pyver);
close(P); 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" die "Failed to query python for version information\n"
if (!(defined($pyprefix) && defined($pyver))); 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->AddIncludeDir($pyprefix . '\include');
$plpython->AddLibrary($pyprefix . "\\Libs\\python$pyver.lib"); $plpython->AddLibrary($pyprefix . "\\Libs\\python$pyver.lib");
$plpython->AddReference($postgres); $plpython->AddReference($postgres);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment