aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2010-02-14 14:10:23 +0000
committerMagnus Hagander <magnus@hagander.net>2010-02-14 14:10:23 +0000
commita05af1d4047349bfff73234227c7663cc05a8165 (patch)
tree81bd34007b0090bf5dfd361071d35eeeb4113028
parentc5d644a867b6fc612b2905b3acfe463104479b66 (diff)
downloadpostgresql-a05af1d4047349bfff73234227c7663cc05a8165.tar.gz
postgresql-a05af1d4047349bfff73234227c7663cc05a8165.zip
Make the msvc build system ask python about details of version and installation
prefix, instead of assuming it will always be following the default layout. All information we need is not available on Windows, but the number of assumptions are at least fewer this way than before. Based on suggestions from James William Pye.
-rw-r--r--src/tools/msvc/Mkvcbuild.pm17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 8d50a9aba30..d119850ab09 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -3,7 +3,7 @@ package Mkvcbuild;
#
# Package that generates build files for msvc build
#
-# $PostgreSQL: pgsql/src/tools/msvc/Mkvcbuild.pm,v 1.51 2010/01/20 09:22:43 heikki Exp $
+# $PostgreSQL: pgsql/src/tools/msvc/Mkvcbuild.pm,v 1.52 2010/02/14 14:10:23 mha Exp $
#
use Carp;
use Win32;
@@ -147,11 +147,18 @@ sub mkvcbuild
if ($solution->{options}->{python})
{
+ # 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]))\" |") || die "Could not query for python versoin!\n";
+ my $pyprefix = <P>;chomp($pyprefix);
+ my $pyver = <P>;chomp($pyver);
+ close(P);
+
+ # Sometimes (always?) if python is not present, the execution actually works, 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');
- $plpython->AddIncludeDir($solution->{options}->{python} . '\include');
- $solution->{options}->{python} =~ /\\Python(\d{2})/i
- || croak "Could not determine python version from path";
- $plpython->AddLibrary($solution->{options}->{python} . "\\Libs\\python$1.lib");
+ $plpython->AddIncludeDir($pyprefix . '\include');
+ $plpython->AddLibrary($pyprefix . "\\Libs\\python$pyver.lib");
$plpython->AddReference($postgres);
}