From 0d90c173fb94cc88f7523cd3c8113da43191e2b3 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Wed, 18 Oct 2017 23:02:08 +0100 Subject: [PATCH 1/3] Test against PG 10.0 on Travis --- scripts/travis_prepare.sh | 5 +++-- scripts/travis_test.sh | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/travis_prepare.sh b/scripts/travis_prepare.sh index 3743eac3..73cbb841 100755 --- a/scripts/travis_prepare.sh +++ b/scripts/travis_prepare.sh @@ -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 diff --git a/scripts/travis_test.sh b/scripts/travis_test.sh index 4a4630b0..033482b8 100755 --- a/scripts/travis_test.sh +++ b/scripts/travis_test.sh @@ -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 From 552e49a11dafaff4e50cdc816023f4d929e52187 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Wed, 18 Oct 2017 22:37:14 +0100 Subject: [PATCH 2/3] Test building PG 10 using the solution provided by Jason Erickson https://github.com/psycopg/psycopg2-wheels/pull/3/ --- .appveyor.yml | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 26109cef..b41e7ef5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -73,6 +73,9 @@ matrix: fast_finish: false services: + # Note: if you change this service also change the path to match in: + # - the postgresql.conf customisation in 'init' + # - the path in 'build_script' - postgresql96 cache: @@ -187,30 +190,33 @@ install: - IF NOT EXIST %PGTOP%\lib MKDIR %PGTOP%\lib # 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 + # Copy over includes + # Copy over built libraries # 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 && + build libpgcommon && + build libpq && XCOPY /E ..\..\include %PGTOP%\include && 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 && CD %BASE_DIR% && RMDIR /S /Q %PGBUILD% ) @@ -223,7 +229,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 -l libpgcommon -l libpgport -L %OPENSSLTOP%\\lib;%PGTOP%\\lib -I %OPENSSLTOP%\\include;%PGTOP%\\include" - "%PYTHON%\\python.exe setup.py build" - "%PYTHON%\\python.exe setup.py install" From f3f394ced900a031d93e4ff1339c5dc5ba522459 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Tue, 24 Oct 2017 11:03:14 +0100 Subject: [PATCH 3/3] Import recipe to build PG 10 libpq on win from wheel repos Also build pg_config so the libpq version is correct at compile time too. --- .appveyor.yml | 30 ++++++++++++++++++++++++------ scripts/appveyor.cache_rebuild | 9 ++++++++- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index b41e7ef5..4f9a40c5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -73,13 +73,13 @@ matrix: fast_finish: false services: - # Note: if you change this service also change the path to match in: - # - the postgresql.conf customisation in 'init' - # - the path in 'build_script' + # 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 @@ -116,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" @@ -188,6 +193,8 @@ 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-REL_10_0.zip ( @@ -197,8 +204,10 @@ install: # Setup build config file (config.pl) # Hack the Mkvcbuild.pm file so we build the lib version of libpq # Build libpgport, libpgcommon, libpq - # Copy over includes + # 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-REL_10_0 - IF NOT EXIST %PGTOP%\lib\libpq.lib ( @@ -213,10 +222,16 @@ install: build libpgport && build libpgcommon && build libpq && - XCOPY /E ..\..\include %PGTOP%\include && + 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 && 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% ) @@ -229,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 libpgport -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" @@ -241,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" diff --git a/scripts/appveyor.cache_rebuild b/scripts/appveyor.cache_rebuild index c9db5073..8ecd97fb 100644 --- a/scripts/appveyor.cache_rebuild +++ b/scripts/appveyor.cache_rebuild @@ -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