Merge branch 'libpq-10'

Fix #604
This commit is contained in:
Daniele Varrazzo 2017-10-24 11:31:26 +01:00
commit c6e90766e1
4 changed files with 51 additions and 18 deletions

View File

@ -73,10 +73,13 @@ matrix:
fast_finish: false
services:
# Note: if you change this service also change the paths to match
# (see where Program Files\Postgres\9.6 is used)
- postgresql96
cache:
# Rebuild cache if following file changes
# (See the file to zap the cache manually)
- C:\Others -> scripts\appveyor.cache_rebuild
# Script called before repo cloning
@ -113,6 +116,11 @@ init:
- IF "%PYTHON_ARCH%"=="32" (CALL "C:\\Program Files (x86)\\Microsoft Visual Studio %VS_VER%\\VC\\vcvarsall.bat" x86)
- IF "%PYTHON_ARCH%"=="64" (CALL "C:\\Program Files (x86)\\Microsoft Visual Studio %VS_VER%\\VC\\vcvarsall.bat" amd64)
# The program rc.exe on 64bit with some versions look in the wrong path
# location when building postgresql. This cheats by copying the x64 bit
# files to that location.
- IF "%PYTHON_ARCH%"=="64" (COPY /Y "C:\\Program Files\\Microsoft SDKs\\Windows\\v7.0\\Bin\\x64\\rc*" "C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Bin")
# Change PostgreSQL config before service starts to allow > 1 prepared
# transactions for test cases
- ECHO max_prepared_transactions = 10 >> "C:\\Program Files\\PostgreSQL\\9.6\\data\\postgresql.conf"
@ -185,32 +193,45 @@ install:
- SET PGTOP=%BASE_DIR%\postgresql
- IF NOT EXIST %PGTOP%\include MKDIR %PGTOP%\include
- IF NOT EXIST %PGTOP%\lib MKDIR %PGTOP%\lib
- IF NOT EXIST %PGTOP%\bin MKDIR %PGTOP%\bin
# Download PostgreSQL source
- CD C:\Others
- IF NOT EXIST postgres-REL9_6_3.zip (
curl -fsSL -o postgres-REL9_6_3.zip https://github.com/postgres/postgres/archive/REL9_6_3.zip
- IF NOT EXIST postgres-REL_10_0.zip (
curl -fsSL -o postgres-REL_10_0.zip https://github.com/postgres/postgres/archive/REL_10_0.zip
)
# Setup build config file (config.pl)
# Build libpgport first
# Build libpq
# Hack the Mkvcbuild.pm file so we build the lib version of libpq
# Build libpgport, libpgcommon, libpq
# Install includes
# Copy over built libraries
# Prepare local include directory for building from
# Build pg_config in place
# NOTE: Cannot set and use the same variable inside an IF
- SET PGBUILD=%BUILD_DIR%\postgres-REL9_6_3
- SET PGBUILD=%BUILD_DIR%\postgres-REL_10_0
- IF NOT EXIST %PGTOP%\lib\libpq.lib (
CD %BUILD_DIR% &&
7z x C:\Others\postgres-REL9_6_3.zip &&
CD postgres-REL9_6_3\src\tools\msvc &&
7z x C:\Others\postgres-REL_10_0.zip &&
CD postgres-REL_10_0\src\tools\msvc &&
ECHO $config-^>{ldap} = 0; > config.pl &&
ECHO $config-^>{openssl} = "%OPENSSLTOP:\=\\%"; >> config.pl &&
ECHO.>> config.pl &&
ECHO 1;>> config.pl &&
perl -pi.bak -e "s/'libpq', 'dll'/'libpq', 'lib'/g" Mkvcbuild.pm &&
build libpgport &&
XCOPY /E ..\..\include %PGTOP%\include &&
build libpgcommon &&
build libpq &&
ECHO "" > %PGBUILD%\src\backend\parser\gram.h &&
perl -pi.bak -e "s/qw\(Install\)/qw\(Install CopyIncludeFiles\)/g" Install.pm &&
perl -MInstall=CopyIncludeFiles -e"chdir('../../..'); CopyIncludeFiles('%PGTOP%')" &&
COPY %PGBUILD%\Release\libpgport\libpgport.lib %PGTOP%\lib &&
CD ..\..\interfaces\libpq &&
nmake -f win32.mak USE_OPENSSL=1 ENABLE_THREAD_SAFETY=1 SSL_INC=%OPENSSLTOP%\include SSL_LIB_PATH=%OPENSSLTOP%\lib config .\Release\libpq.lib &&
COPY *.h %PGTOP%\include &&
COPY Release\libpq.lib %PGTOP%\lib &&
COPY %PGBUILD%\Release\libpgcommon\libpgcommon.lib %PGTOP%\lib &&
COPY %PGBUILD%\Release\libpq\libpq.lib %PGTOP%\lib &&
XCOPY /Y /S %PGBUILD%\src\include\port\win32\* %PGBUILD%\src\include &&
XCOPY /Y /S %PGBUILD%\src\include\port\win32_msvc\* %PGBUILD%\src\include &&
CD %PGBUILD%\src\bin\pg_config &&
cl pg_config.c /MT /nologo /I%PGBUILD%\src\include /link /LIBPATH:%PGTOP%\lib libpgcommon.lib libpgport.lib advapi32.lib /NODEFAULTLIB:libcmt.lib /OUT:%PGTOP%\bin\pg_config.exe &&
CD %BASE_DIR% &&
RMDIR /S /Q %PGBUILD%
)
@ -223,7 +244,7 @@ build_script:
# Add PostgreSQL binaries to the path
- PATH=C:\Program Files\PostgreSQL\9.6\bin\;%PATH%
- CD C:\Project
- "%PYTHON%\\python.exe setup.py build_ext --have-ssl -l libpgcommon -L %OPENSSLTOP%\\lib;%PGTOP%\\lib -I %OPENSSLTOP%\\include;%PGTOP%\\include"
- "%PYTHON%\\python.exe setup.py build_ext --have-ssl --pg-config %PGTOP%\\bin\\pg_config.exe -l libpgcommon -l libpgport -L %OPENSSLTOP%\\lib -I %OPENSSLTOP%\\include"
- "%PYTHON%\\python.exe setup.py build"
- "%PYTHON%\\python.exe setup.py install"
@ -235,5 +256,8 @@ before_test:
- psql -d %PSYCOPG2_TESTDB% -c "CREATE EXTENSION HSTORE;"
test_script:
# Print psycopg and libpq versions
- "%PYTHON%\\python.exe -c \"import psycopg2; print(psycopg2.__version__)\""
- "%PYTHON%\\python.exe -c \"import psycopg2; print(psycopg2.__libpq_version__)\""
- "%PYTHON%\\python.exe -c \"import psycopg2; print(psycopg2.extensions.libpq_version())\""
- "%PYTHON%\\python.exe -c \"from psycopg2 import tests; tests.unittest.main(defaultTest='tests.test_suite')\" --verbose"

View File

@ -12,4 +12,11 @@ OpenSSL
Version: 1.0.2l
PostgreSQL
Version: 9.6.3
Version: 10.0
NOTE: to zap the cache manually you can also use:
curl -X DELETE -H "Authorization: Bearer $APPVEYOR_TOKEN" -H "Content-Type: application/json" https://ci.appveyor.com/api/projects/psycopg/psycopg2/buildcache
with the token from https://ci.appveyor.com/api-token

View File

@ -105,11 +105,11 @@ cd /
# Postgres versions supported by Travis CI
if [[ -z "$DONT_TEST_PRESENT" ]]; then
create 10
create 9.6
create 9.5
create 9.4
create 9.3
create 9.2
fi
# Unsupported postgres versions that we still support
@ -123,9 +123,10 @@ if [[ -n "$TEST_PAST" ]]; then
create 8.4
create 9.0
create 9.1
create 9.2
fi
# Postgres built from master
if [[ -n "$TEST_FUTURE" ]]; then
create 10 10beta1
create 11 11-master
fi

View File

@ -46,11 +46,11 @@ run_test () {
# Postgres versions supported by Travis CI
if [[ -z "$DONT_TEST_PRESENT" ]]; then
run_test 10
run_test 9.6
run_test 9.5
run_test 9.4
run_test 9.3
run_test 9.2
fi
# Unsupported postgres versions that we still support
@ -64,9 +64,10 @@ if [[ -n "$TEST_PAST" ]]; then
run_test 8.4
run_test 9.0
run_test 9.1
run_test 9.2
fi
# Postgres built from master
if [[ -n "$TEST_FUTURE" ]]; then
run_test 10
run_test 11
fi