2017-02-16 18:43:11 +03:00
|
|
|
version : 2.x.{build}
|
|
|
|
|
|
|
|
clone_folder: C:\Project
|
|
|
|
|
|
|
|
environment:
|
|
|
|
global:
|
|
|
|
# MSVC Express 2008's setenv.cmd failes if /E:ON and /V:ON are not
|
|
|
|
# enabled in the batch script interpreter
|
|
|
|
#
|
|
|
|
# WITH_COMPILER: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_compiler.cmd"
|
|
|
|
CMD_IN_ENV: cmd /E:ON /V:ON /C .\appveyor\run_with_env.cmd
|
|
|
|
|
|
|
|
matrix:
|
|
|
|
# For Python versions available on Appveyor, see
|
|
|
|
# http://www.appveyor.com/docs/installed-software#python
|
|
|
|
|
2017-02-16 18:59:37 +03:00
|
|
|
# Py 2.7 = VS Ver. 9.0 (VS 2008)
|
2017-11-28 12:13:38 +03:00
|
|
|
# Py 3.4 = VS Ver. 10.0 (VS 2010)
|
2017-02-16 18:59:37 +03:00
|
|
|
# Py 3.5, 3.6 = VS Ver. 14.0 (VS 2015)
|
|
|
|
|
|
|
|
- PYTHON: C:\Python27-x64
|
|
|
|
PYTHON_ARCH: 64
|
|
|
|
VS_VER: 9.0
|
|
|
|
|
2017-02-16 18:43:11 +03:00
|
|
|
- PYTHON: C:\Python27
|
|
|
|
PYTHON_ARCH: 32
|
|
|
|
VS_VER: 9.0
|
2017-02-16 18:59:37 +03:00
|
|
|
|
|
|
|
- PYTHON: C:\Python36-x64
|
|
|
|
PYTHON_ARCH: 64
|
2017-02-16 18:43:11 +03:00
|
|
|
VS_VER: 14.0
|
2017-02-16 18:59:37 +03:00
|
|
|
|
2017-02-16 18:43:11 +03:00
|
|
|
- PYTHON: C:\Python36
|
|
|
|
PYTHON_ARCH: 32
|
|
|
|
VS_VER: 14.0
|
2017-02-16 18:59:37 +03:00
|
|
|
|
|
|
|
- PYTHON: C:\Python35-x64
|
2017-02-16 18:43:11 +03:00
|
|
|
PYTHON_ARCH: 64
|
2017-02-16 18:59:37 +03:00
|
|
|
VS_VER: 14.0
|
|
|
|
|
|
|
|
- PYTHON: C:\Python35
|
|
|
|
PYTHON_ARCH: 32
|
|
|
|
VS_VER: 14.0
|
|
|
|
|
|
|
|
- PYTHON: C:\Python34-x64
|
2017-02-16 18:43:11 +03:00
|
|
|
DISTUTILS_USE_SDK: '1'
|
|
|
|
PYTHON_ARCH: 64
|
|
|
|
VS_VER: 10.0
|
2017-02-16 18:59:37 +03:00
|
|
|
|
|
|
|
- PYTHON: C:\Python34
|
|
|
|
PYTHON_ARCH: 32
|
|
|
|
VS_VER: 10.0
|
|
|
|
|
2017-02-16 18:43:11 +03:00
|
|
|
PSYCOPG2_TESTDB: psycopg2_test
|
|
|
|
PSYCOPG2_TESTDB_USER: postgres
|
|
|
|
PSYCOPG2_TESTDB_PASSWORD: Password12!
|
|
|
|
PSYCOPG2_TESTDB_HOST: localhost
|
|
|
|
PSYCOPG2_TESTDB_PORT: 5432
|
|
|
|
|
|
|
|
PGUSER: postgres
|
|
|
|
PGPASSWORD: Password12!
|
|
|
|
|
|
|
|
matrix:
|
|
|
|
fast_finish: false
|
|
|
|
|
|
|
|
services:
|
2017-10-24 13:03:14 +03:00
|
|
|
# Note: if you change this service also change the paths to match
|
|
|
|
# (see where Program Files\Postgres\9.6 is used)
|
2017-06-08 23:21:30 +03:00
|
|
|
- postgresql96
|
2017-02-16 18:43:11 +03:00
|
|
|
|
|
|
|
cache:
|
|
|
|
# Rebuild cache if following file changes
|
2017-10-24 13:03:14 +03:00
|
|
|
# (See the file to zap the cache manually)
|
2017-02-16 18:43:11 +03:00
|
|
|
- C:\Others -> scripts\appveyor.cache_rebuild
|
|
|
|
|
|
|
|
# Script called before repo cloning
|
|
|
|
init:
|
|
|
|
# Uncomment next line to get RDP access during the build.
|
|
|
|
#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
|
|
|
#
|
|
|
|
# Set Python to the path
|
2017-03-22 06:50:04 +03:00
|
|
|
- SET PATH=%PYTHON%;%PYTHON%\Scripts;C:\Program Files\Git\mingw64\bin;%PATH%
|
2017-02-16 18:43:11 +03:00
|
|
|
|
|
|
|
# Verify Python version and architecture
|
|
|
|
- ECHO *******************************************************************
|
|
|
|
- ECHO Python Information
|
|
|
|
- ECHO *******************************************************************
|
|
|
|
- "%PYTHON%\\python --version"
|
|
|
|
- "%PYTHON%\\python -c \"import sys; print('64bit: ' + str(sys.maxsize > 2**32))\""
|
|
|
|
|
|
|
|
# Get & Install NASM
|
|
|
|
#- curl -L -o nasminst.exe http://www.nasm.us/pub/nasm/releasebuilds/2.12.02/win64/nasm-2.12.02-installer-x64.exe && start /wait nasminst.exe /S
|
|
|
|
#- SET PATH="C:\Program Files (x86)\nasm;%PATH%"
|
|
|
|
|
|
|
|
# Fix problem with VS2008 Express and 64bit builds
|
|
|
|
- ECHO Fixing VS2008 Express and 64bit builds
|
|
|
|
- COPY "C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\bin\\vcvars64.bat" "C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\bin\\amd64\\vcvarsamd64.bat"
|
|
|
|
|
|
|
|
# Fix problem with VS2010 Express 64bit missing vcvars64.bat
|
|
|
|
# Note: repository not cloned at this point, so need to fetch
|
|
|
|
# file another way
|
|
|
|
- ECHO Fixing VS2010 Express and 64bit builds
|
2017-02-16 21:31:49 +03:00
|
|
|
- curl -fsSL -o "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\bin\\amd64\\vcvars64.bat" https://raw.githubusercontent.com/psycopg/psycopg2/master/scripts/vcvars64-vs2010.bat
|
2017-02-16 18:43:11 +03:00
|
|
|
|
|
|
|
# Setup the compiler based upon version and architecture
|
|
|
|
- ECHO Configuring Compiler
|
|
|
|
- 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)
|
|
|
|
|
2017-10-24 13:03:14 +03:00
|
|
|
# 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")
|
|
|
|
|
2017-02-16 18:43:11 +03:00
|
|
|
# Change PostgreSQL config before service starts to allow > 1 prepared
|
|
|
|
# transactions for test cases
|
2017-06-08 23:21:30 +03:00
|
|
|
- ECHO max_prepared_transactions = 10 >> "C:\\Program Files\\PostgreSQL\\9.6\\data\\postgresql.conf"
|
2017-02-16 18:43:11 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Repository gets cloned, Cache is restored
|
|
|
|
install:
|
|
|
|
# We start off CD'ed to cloned folder
|
|
|
|
- SET BASE_DIR=C:\Others\%PYTHON_ARCH%\%VS_VER%
|
|
|
|
- SET BUILD_DIR=%BASE_DIR%\Builds
|
|
|
|
- IF NOT EXIST %BUILD_DIR% MKDIR %BUILD_DIR%
|
|
|
|
|
|
|
|
- ECHO *******************************************************************
|
|
|
|
- ECHO Initialized variables specific for this build
|
|
|
|
- ECHO *******************************************************************
|
|
|
|
- ECHO %BASE_DIR%
|
|
|
|
- ECHO %BUILD_DIR%
|
|
|
|
- ECHO *******************************************************************
|
|
|
|
|
|
|
|
# Setup directories for building OpenSSL libraries
|
|
|
|
- ECHO *******************************************************************
|
|
|
|
- ECHO Preparing for building OpenSSL
|
|
|
|
- ECHO *******************************************************************
|
|
|
|
- SET OPENSSLTOP=%BASE_DIR%\openssl
|
|
|
|
- IF NOT EXIST %OPENSSLTOP%\include\openssl MKDIR %OPENSSLTOP%\include\openssl
|
|
|
|
- IF NOT EXIST %OPENSSLTOP%\lib MKDIR %OPENSSLTOP%\lib
|
|
|
|
|
|
|
|
# Setup OpenSSL Environment Variables based on processor architecture
|
|
|
|
- ps: >-
|
|
|
|
If ($env:PYTHON_ARCH -Match "32" ) {
|
|
|
|
$env:VCVARS_PLATFORM="x86"
|
|
|
|
$env:TARGET="VC-WIN32"
|
|
|
|
$env:DO="do_ms"
|
|
|
|
} Else {
|
|
|
|
$env:VCVARS_PLATFORM="amd64"
|
|
|
|
$env:TARGET="VC-WIN64A"
|
|
|
|
$env:DO="do_win64a"
|
|
|
|
$env:CPU="AMD64"
|
|
|
|
}
|
|
|
|
# Download OpenSSL source
|
|
|
|
- CD C:\Others
|
2017-11-28 06:40:47 +03:00
|
|
|
- IF NOT EXIST OpenSSL_1_0_2m.zip (
|
|
|
|
curl -fsSL -o OpenSSL_1_0_2m.zip https://github.com/openssl/openssl/archive/OpenSSL_1_0_2m.zip
|
2017-02-16 18:43:11 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
# To use OpenSSL >= 1.1.0, both libpq and psycopg build environments have
|
|
|
|
# to support the new library names. Below are commands to build OpenSSL
|
|
|
|
# 1.1.0:
|
|
|
|
# - mkdir _build
|
|
|
|
# - cd _build
|
|
|
|
# - perl ..\Configure %TARGET% no-asm no-shared --prefix=%BASE_DIR%\openssl --openssldir=%BASE_DIR%\openssl
|
|
|
|
# - nmake build_libs install_dev
|
|
|
|
- IF NOT EXIST %OPENSSLTOP%\lib\ssleay32.lib (
|
|
|
|
CD %BUILD_DIR% &&
|
2017-11-28 06:40:47 +03:00
|
|
|
7z x C:\Others\OpenSSL_1_0_2m.zip &&
|
|
|
|
CD openssl-OpenSSL_1_0_2m &&
|
2017-02-16 18:43:11 +03:00
|
|
|
perl Configure %TARGET% no-asm no-shared no-zlib --prefix=%OPENSSLTOP% --openssldir=%OPENSSLTOP% &&
|
|
|
|
CALL ms\%DO% &&
|
|
|
|
nmake -f ms\nt.mak init headers lib &&
|
|
|
|
COPY inc32\openssl\*.h %OPENSSLTOP%\include\openssl &&
|
|
|
|
COPY out32\*.lib %OPENSSLTOP%\lib &&
|
|
|
|
CD %BASE_DIR% &&
|
2017-11-28 06:40:47 +03:00
|
|
|
RMDIR /S /Q %BUILD_DIR%\openssl-OpenSSL_1_0_2m
|
2017-02-16 18:43:11 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
# Setup directories for building PostgreSQL librarires
|
|
|
|
- ECHO *******************************************************************
|
|
|
|
- ECHO Preparing for building PostgreSQL libraries
|
|
|
|
- ECHO *******************************************************************
|
|
|
|
- SET PGTOP=%BASE_DIR%\postgresql
|
|
|
|
- IF NOT EXIST %PGTOP%\include MKDIR %PGTOP%\include
|
|
|
|
- IF NOT EXIST %PGTOP%\lib MKDIR %PGTOP%\lib
|
2017-10-24 13:03:14 +03:00
|
|
|
- IF NOT EXIST %PGTOP%\bin MKDIR %PGTOP%\bin
|
|
|
|
|
2017-02-16 18:43:11 +03:00
|
|
|
# Download PostgreSQL source
|
|
|
|
- CD C:\Others
|
2017-11-28 06:40:47 +03:00
|
|
|
- IF NOT EXIST postgres-REL_10_1.zip (
|
|
|
|
curl -fsSL -o postgres-REL_10_1.zip https://github.com/postgres/postgres/archive/REL_10_1.zip
|
2017-02-16 18:43:11 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
# Setup build config file (config.pl)
|
2017-10-19 00:37:14 +03:00
|
|
|
# Hack the Mkvcbuild.pm file so we build the lib version of libpq
|
|
|
|
# Build libpgport, libpgcommon, libpq
|
2017-10-24 13:03:14 +03:00
|
|
|
# Install includes
|
2017-10-19 00:37:14 +03:00
|
|
|
# Copy over built libraries
|
2017-10-24 13:03:14 +03:00
|
|
|
# Prepare local include directory for building from
|
|
|
|
# Build pg_config in place
|
2017-02-16 18:43:11 +03:00
|
|
|
# NOTE: Cannot set and use the same variable inside an IF
|
2017-11-28 06:40:47 +03:00
|
|
|
- SET PGBUILD=%BUILD_DIR%\postgres-REL_10_1
|
2017-02-16 18:43:11 +03:00
|
|
|
- IF NOT EXIST %PGTOP%\lib\libpq.lib (
|
|
|
|
CD %BUILD_DIR% &&
|
2017-11-28 06:40:47 +03:00
|
|
|
7z x C:\Others\postgres-REL_10_1.zip &&
|
|
|
|
CD postgres-REL_10_1\src\tools\msvc &&
|
2017-02-16 18:43:11 +03:00
|
|
|
ECHO $config-^>{ldap} = 0; > config.pl &&
|
|
|
|
ECHO $config-^>{openssl} = "%OPENSSLTOP:\=\\%"; >> config.pl &&
|
|
|
|
ECHO.>> config.pl &&
|
|
|
|
ECHO 1;>> config.pl &&
|
2017-10-19 00:37:14 +03:00
|
|
|
perl -pi.bak -e "s/'libpq', 'dll'/'libpq', 'lib'/g" Mkvcbuild.pm &&
|
2017-02-16 18:43:11 +03:00
|
|
|
build libpgport &&
|
2017-10-19 00:37:14 +03:00
|
|
|
build libpgcommon &&
|
|
|
|
build libpq &&
|
2017-10-24 13:03:14 +03:00
|
|
|
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%')" &&
|
2017-02-16 18:43:11 +03:00
|
|
|
COPY %PGBUILD%\Release\libpgport\libpgport.lib %PGTOP%\lib &&
|
2017-10-19 00:37:14 +03:00
|
|
|
COPY %PGBUILD%\Release\libpgcommon\libpgcommon.lib %PGTOP%\lib &&
|
|
|
|
COPY %PGBUILD%\Release\libpq\libpq.lib %PGTOP%\lib &&
|
2017-10-24 13:03:14 +03:00
|
|
|
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 &&
|
2017-02-16 18:43:11 +03:00
|
|
|
CD %BASE_DIR% &&
|
|
|
|
RMDIR /S /Q %PGBUILD%
|
|
|
|
)
|
|
|
|
|
|
|
|
build: off
|
|
|
|
|
|
|
|
#before_build:
|
|
|
|
|
|
|
|
build_script:
|
|
|
|
# Add PostgreSQL binaries to the path
|
2017-06-08 23:21:30 +03:00
|
|
|
- PATH=C:\Program Files\PostgreSQL\9.6\bin\;%PATH%
|
2017-02-16 18:59:37 +03:00
|
|
|
- CD C:\Project
|
2017-10-24 13:03:14 +03:00
|
|
|
- "%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"
|
2017-02-16 18:43:11 +03:00
|
|
|
- "%PYTHON%\\python.exe setup.py build"
|
|
|
|
- "%PYTHON%\\python.exe setup.py install"
|
|
|
|
|
|
|
|
#after_build:
|
|
|
|
|
|
|
|
before_test:
|
|
|
|
# Create and setup PostgreSQL database for the tests
|
|
|
|
- createdb %PSYCOPG2_TESTDB%
|
2017-02-16 18:59:37 +03:00
|
|
|
- psql -d %PSYCOPG2_TESTDB% -c "CREATE EXTENSION HSTORE;"
|
2017-02-16 18:43:11 +03:00
|
|
|
|
|
|
|
test_script:
|
2017-10-24 13:03:14 +03:00
|
|
|
# Print psycopg and libpq versions
|
2017-02-16 18:43:11 +03:00
|
|
|
- "%PYTHON%\\python.exe -c \"import psycopg2; print(psycopg2.__version__)\""
|
2017-10-24 13:03:14 +03:00
|
|
|
- "%PYTHON%\\python.exe -c \"import psycopg2; print(psycopg2.__libpq_version__)\""
|
|
|
|
- "%PYTHON%\\python.exe -c \"import psycopg2; print(psycopg2.extensions.libpq_version())\""
|
2017-02-16 18:43:11 +03:00
|
|
|
- "%PYTHON%\\python.exe -c \"from psycopg2 import tests; tests.unittest.main(defaultTest='tests.test_suite')\" --verbose"
|