diff --git a/.travis/run_with_env.cmd b/.travis/run_with_env.cmd new file mode 100644 index 00000000..5da547c4 --- /dev/null +++ b/.travis/run_with_env.cmd @@ -0,0 +1,88 @@ +:: To build extensions for 64 bit Python 3, we need to configure environment +:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of: +:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1) +:: +:: To build extensions for 64 bit Python 2, we need to configure environment +:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of: +:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0) +:: +:: 32 bit builds, and 64-bit builds for 3.5 and beyond, do not require specific +:: environment configurations. +:: +:: Note: this script needs to be run with the /E:ON and /V:ON flags for the +:: cmd interpreter, at least for (SDK v7.0) +:: +:: More details at: +:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows +:: http://stackoverflow.com/a/13751649/163740 +:: +:: Author: Olivier Grisel +:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ +:: +:: Notes about batch files for Python people: +:: +:: Quotes in values are literally part of the values: +:: SET FOO="bar" +:: FOO is now five characters long: " b a r " +:: If you don't want quotes, don't include them on the right-hand side. +:: +:: The CALL lines at the end of this file look redundant, but if you move them +:: outside of the IF clauses, they do not run properly in the SET_SDK_64==Y +:: case, I don't know why. +@ECHO OFF + +SET COMMAND_TO_RUN=%* +SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows +SET WIN_WDK=c:\Program Files (x86)\Windows Kits\10\Include\wdf + +:: Extract the major and minor versions, and allow for the minor version to be +:: more than 9. This requires the version number to have two dots in it. +SET MAJOR_PYTHON_VERSION=%PYTHON_VERSION:~0,1% +IF "%PYTHON_VERSION:~3,1%" == "." ( + SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,1% +) ELSE ( + SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,2% +) + +:: Based on the Python version, determine what SDK version to use, and whether +:: to set the SDK for 64-bit. +IF %MAJOR_PYTHON_VERSION% == 2 ( + SET WINDOWS_SDK_VERSION="v7.0" + SET SET_SDK_64=Y +) ELSE ( + IF %MAJOR_PYTHON_VERSION% == 3 ( + SET WINDOWS_SDK_VERSION="v7.1" + IF %MINOR_PYTHON_VERSION% LEQ 4 ( + SET SET_SDK_64=Y + ) ELSE ( + SET SET_SDK_64=N + IF EXIST "%WIN_WDK%" ( + :: See: https://connect.microsoft.com/VisualStudio/feedback/details/1610302/ + REN "%WIN_WDK%" 0wdf + ) + ) + ) ELSE ( + ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%" + EXIT 1 + ) +) + +IF %PYTHON_ARCH% == 64 ( + IF %SET_SDK_64% == Y ( + ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture + SET DISTUTILS_USE_SDK=1 + SET MSSdk=1 + "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION% + "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release + ECHO Executing: %COMMAND_TO_RUN% + call %COMMAND_TO_RUN% || EXIT 1 + ) ELSE ( + ECHO Using default MSVC build environment for 64 bit architecture + ECHO Executing: %COMMAND_TO_RUN% + call %COMMAND_TO_RUN% || EXIT 1 + ) +) ELSE ( + ECHO Using default MSVC build environment for 32 bit architecture + ECHO Executing: %COMMAND_TO_RUN% + call %COMMAND_TO_RUN% || EXIT 1 +) diff --git a/appveyor.yml b/appveyor.yml index 0729fcdf..dbea392e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,42 +1,106 @@ environment: - # TODO: Simplify this, only test each version once. There's no need - # to run the tests for all 32 and 64-bit versions. See gevent for an example. + global: + # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the + # /E:ON and /V:ON options are not enabled in the batch script interpreter + # See: http://stackoverflow.com/a/13751649/163740 + CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\.travis\\run_with_env.cmd" + # Use a fixed hash seed for reproducability + PYTHONHASHSEED: 8675309 + MYSQL_PWD: "Password12!" + PGPASSWORD: "Password12!" + PGUSER: "postgres" + matrix: - - python : 37 - - python : 36 - - python : 27 - - python : 35 - - python : 37-x64 - - python : 36-x64 - - python : 27-x64 - - python : 35-x64 + + # Pre-installed Python versions, which Appveyor may upgrade to + # a later point release. + + # 64-bit + + - PYTHON: "C:\\Python37-x64" + PYTHON_VERSION: "3.7.x" + PYTHON_ARCH: "64" + PYTHON_EXE: python + + - PYTHON: "C:\\Python27-x64" + PYTHON_VERSION: "2.7.x" # currently 2.7.13 + PYTHON_ARCH: "64" + PYTHON_EXE: python + + - PYTHON: "C:\\Python36-x64" + PYTHON_VERSION: "3.6.x" # currently 3.6.0 + PYTHON_ARCH: "64" + PYTHON_EXE: python + + - PYTHON: "C:\\Python35-x64" + PYTHON_VERSION: "3.5.x" # currently 3.5.2 + PYTHON_ARCH: "64" + PYTHON_EXE: python + + # 32-bit, wheel only (no testing) + + - PYTHON: "C:\\Python37" + PYTHON_VERSION: "3.7.x" + PYTHON_ARCH: "32" + PYTHON_EXE: python + GWHEEL_ONLY: true + + - PYTHON: "C:\\Python36" + PYTHON_VERSION: "3.6.x" # currently 3.6.3 + PYTHON_ARCH: "32" + PYTHON_EXE: python + GWHEEL_ONLY: true + + - PYTHON: "C:\\Python35" + PYTHON_VERSION: "3.5.x" # currently 3.5.2 + PYTHON_ARCH: "32" + PYTHON_EXE: python + GWHEEL_ONLY: true + + - PYTHON: "C:\\Python27" + PYTHON_VERSION: "2.7.x" # currently 2.7.13 + PYTHON_ARCH: "32" + PYTHON_EXE: python + GWHEEL_ONLY: true services: - mysql - postgresql install: - - "SET PATH=C:\\Program Files\\PostgreSQL\\9.4\\bin;C:\\Program Files\\MySql\\MySQL Server 5.7\\bin;C:\\Python%PYTHON%;c:\\Python%PYTHON%\\scripts;%PATH%" - - "SET MYSQL_PWD=Password12!" - - "SET PGPASSWORD=Password12!" - - "SET PGUSER=postgres" - - echo "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 > "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvars64.bat" - - python -m pip install -U pip setuptools - - pip install -U wheel cffi - - pip install -U -e .[test,postgresql,mysql] + - "SET PATH=C:\\Program Files\\PostgreSQL\\9.4\\bin;C:\\Program Files\\MySql\\MySQL Server 5.7\\bin;%PATH%" + - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PYTHON%\\bin;%PATH%" + - "SET PYEXE=%PYTHON%\\%PYTHON_EXE%.exe" + + # Check that we have the expected version and architecture for Python + - "%PYEXE% --version" + - "%PYEXE% -c \"import struct; print(struct.calcsize('P') * 8)\"" + + - "%CMD_IN_ENV% %PYEXE% -m pip install --disable-pip-version-check -U pip" + # pycparser can't be built correctly in an isolated environment. + # See + # https://ci.appveyor.com/project/denik/gevent/builds/23810605/job/83aw4u67artt002b#L602 + # So we violate DRY and repeate some requirements in order to use + # --no-build-isolation + - "%CMD_IN_ENV% %PYEXE% -m pip install -U pycparser wheel cython setuptools cffi" + -build: false +build_script: + # Build the compiled extension + # pip 19.1 (exactly) won't work; but 19.1.1 should with --no-use-pep517 + - "%CMD_IN_ENV% %PYEXE% -m pip install -U -e .[test,postgresql,mysql]" test_script: - - cmd /c .travis\mysql.cmd - - cmd /c .travis\postgres.cmd - - python -m relstorage.tests.alltests + - if not "%GWHEEL_ONLY%"=="true" cmd /c .travis\mysql.cmd + - if not "%GWHEEL_ONLY%"=="true" cmd /c .travis\postgres.cmd + - if not "%GWHEEL_ONLY%"=="true" %PYEXE% -m relstorage.tests.alltests after_test: - - python setup.py bdist_wheel + - "%CMD_IN_ENV% %PYEXE% -m pip wheel --no-build-isolation . -w dist" + - ps: "ls dist" artifacts: - - path: dist\* + - path: dist\RelStorage* cache: - "%TMP%\\py\\" diff --git a/doc/developing/running.rst b/doc/developing/running.rst index a2d4842c..671ccdd1 100644 --- a/doc/developing/running.rst +++ b/doc/developing/running.rst @@ -48,6 +48,10 @@ to create the databases. (You can also see example scripts that are used to set up the continuous integration test environment in the `.travis `_ directory.) +If the environment variable ``RS_SMALL_BLOB`` is set when running +the tests, certain blob tests will use a much smaller size, making the +test run much faster. + .. highlight:: sql PostgreSQL @@ -73,10 +77,6 @@ PostgreSQL specific tests can be run by the testposgresql module:: python -m relstorage.tests.testpostgresql -If the environment variable ``RS_PG_SMALL_BLOB`` is set when running -the tests, certain blob tests will use a much smaller size, making the -test run much faster. - MySQL -----