Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit bfd7f8c

Browse files
committed
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.
1 parent ba0c93a commit bfd7f8c

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

doc/src/sgml/plpython.sgml

+3-2
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,9 @@
148148
<listitem>
149149
<para>
150150
Daredevils, who want to build a Python-3-only operating system
151-
environment, can change the build scripts to
152-
make <literal>plpythonu</literal> be equivalent
151+
environment, can change the contents of
152+
<link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link>
153+
to make <literal>plpythonu</literal> be equivalent
153154
to <literal>plpython3u</literal>, keeping in mind that this
154155
would make their installation incompatible with most of the rest
155156
of the world.

src/include/catalog/catversion.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 201103042
56+
#define CATALOG_VERSION_NO 201103051
5757

5858
#endif

src/include/catalog/pg_pltemplate.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ DATA(insert ( "pltcl" t t "pltcl_call_handler" _null_ _null_ "$libdir/pltcl" _n
7272
DATA(insert ( "pltclu" f f "pltclu_call_handler" _null_ _null_ "$libdir/pltcl" _null_ ));
7373
DATA(insert ( "plperl" t t "plperl_call_handler" "plperl_inline_handler" "plperl_validator" "$libdir/plperl" _null_ ));
7474
DATA(insert ( "plperlu" f f "plperlu_call_handler" "plperlu_inline_handler" "plperlu_validator" "$libdir/plperl" _null_ ));
75-
DATA(insert ( "plpythonu" f f "plpython_call_handler" "plpython_inline_handler" "plpython_validator" "$libdir/plpython" _null_ ));
75+
DATA(insert ( "plpythonu" f f "plpython_call_handler" "plpython_inline_handler" "plpython_validator" "$libdir/plpython2" _null_ ));
7676
DATA(insert ( "plpython2u" f f "plpython2_call_handler" "plpython2_inline_handler" "plpython2_validator" "$libdir/plpython2" _null_ ));
7777
DATA(insert ( "plpython3u" f f "plpython3_call_handler" "plpython3_inline_handler" "plpython3_validator" "$libdir/plpython3" _null_ ));
7878

src/pl/plpython/Makefile

+2-6
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ REGRESS_OPTS = --dbname=$(PL_TESTDB)
6767
ifeq ($(python_majorversion),2)
6868
REGRESS_OPTS += --load-extension=plpythonu
6969
endif
70+
7071
REGRESS = \
7172
plpython_schema \
7273
plpython_populate \
@@ -88,6 +89,7 @@ REGRESS = \
8889
plpython_composite \
8990
plpython_subtransaction \
9091
plpython_drop
92+
9193
# where to find psql for running the tests
9294
PSQLDIR = $(bindir)
9395

@@ -105,17 +107,11 @@ distprep: spiexceptions.h
105107

106108

107109
install: all installdirs install-lib install-data
108-
ifeq ($(python_majorversion),2)
109-
cd '$(DESTDIR)$(pkglibdir)' && rm -f plpython$(DLSUFFIX) && $(LN_S) $(shlib) plpython$(DLSUFFIX)
110-
endif
111110

112111
installdirs: installdirs-lib
113112
$(MKDIR_P) '$(DESTDIR)$(datadir)/extension'
114113

115114
uninstall: uninstall-lib uninstall-data
116-
ifeq ($(python_majorversion),2)
117-
rm -f '$(DESTDIR)$(pkglibdir)/plpython$(DLSUFFIX)'
118-
endif
119115

120116
install-data:
121117
@for file in $(addprefix $(srcdir)/, $(DATA)); do \

src/tools/msvc/Mkvcbuild.pm

+7-4
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ sub mkvcbuild
172172

173173
if ($solution->{options}->{python})
174174
{
175-
176-
# Attempt to get python version and location. Assume python.exe in specified dir.
175+
# Attempt to get python version and location.
176+
# Assume python.exe in specified dir.
177177
open(P,
178178
$solution->{options}->{python}
179179
. "\\python -c \"import sys;print(sys.prefix);print(str(sys.version_info[0])+str(sys.version_info[1]))\" |"
@@ -184,11 +184,14 @@ sub mkvcbuild
184184
chomp($pyver);
185185
close(P);
186186

187-
# Sometimes (always?) if python is not present, the execution actually works, but gives no data...
187+
# Sometimes (always?) if python is not present, the execution
188+
# appears to work, but gives no data...
188189
die "Failed to query python for version information\n"
189190
if (!(defined($pyprefix) && defined($pyver)));
190191

191-
my $plpython = $solution->AddProject('plpython','dll','PLs','src\pl\plpython');
192+
my $pymajorver = substr($pyver, 0, 1);
193+
my $plpython = $solution->AddProject('plpython' . $pymajorver, 'dll',
194+
'PLs', 'src\pl\plpython');
192195
$plpython->AddIncludeDir($pyprefix . '\include');
193196
$plpython->AddLibrary($pyprefix . "\\Libs\\python$pyver.lib");
194197
$plpython->AddReference($postgres);

0 commit comments

Comments
 (0)