Skip to content

Commit

Permalink
Increased M2Crypto to 0.30.0 and used in Appveyor
Browse files Browse the repository at this point in the history
M2Crypto 0.29.0 introduced support for Windows again, so it is no longer
necessary to use the very outdated M2CryptoWin32/64 packages.

This change uses the M2Crypto package now also on Windows, and eliminates
using M2CryptoWin32/64.

To enable that, it increases the minimum version of M2Crypto to 0.30.0
(which has a minor fix for the Windows support introduced with 0.29.0).
It also installs OS-level dependencies because the new M2Crypto version
does not have binary packages but needs to build which requires swig,
Win32/64OpenSSL, etc.

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
  • Loading branch information
andy-maier committed May 13, 2018
1 parent e612d22 commit 3c08754
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 86 deletions.
108 changes: 57 additions & 51 deletions appveyor.yml
Expand Up @@ -2,29 +2,15 @@
environment:
matrix:
#------------------------
# Notes on disabled environments:
# * Python 2.6 is disabled because on Windows, pywbem uses M2Crypto via the
# M2CryptoWin32 package. That package is not supported for Python 2.6, and
# its __m2crypto.pyd file depends on python27.dll. As a result, importing
# M2Crypto on Python 2.6 fails with:
# ImportError: Module use of python27.dll conflicts with this version of
# Python.
# To support Python 2.6, M2Crypto would need to be built upon install from
# the M2Crypto package. See https://github.com/dsoprea/M2CryptoWindows for
# details on how to build it.
# Python 2.6 is not supported by M2Crypto on Windows (nor by the earlier used
# M2CryptoWin32/Win64; its __m2crypto.pyd file depends on python27.dll).
#------------------------
# - PYTHON_VERSION: 2.6
# PYTHON_ARCH: 32
# PYTHON_HOME: C:\Python26
# - PYTHON_VERSION: 2.6
# PYTHON_ARCH: 64
# PYTHON_HOME: C:\Python26-x64
- PYTHON_VERSION: 2.7
PYTHON_ARCH: 32
PYTHON_HOME: C:\Python27
# - PYTHON_VERSION: 2.7
# PYTHON_ARCH: 64
# PYTHON_HOME: C:\Python27-x64
- PYTHON_VERSION: 2.7
PYTHON_ARCH: 64
PYTHON_HOME: C:\Python27-x64
# - PYTHON_VERSION: 3.4
# PYTHON_ARCH: 32
# PYTHON_HOME: C:\Python34
Expand All @@ -40,9 +26,9 @@ environment:
# - PYTHON_VERSION: 3.6
# PYTHON_ARCH: 32
# PYTHON_HOME: C:\Python36
- PYTHON_VERSION: 3.6
PYTHON_ARCH: 64
PYTHON_HOME: C:\Python36-x64
# - PYTHON_VERSION: 3.6
# PYTHON_ARCH: 64
# PYTHON_HOME: C:\Python36-x64

configuration:
# These values will become the values of the PACKAGE_LEVEL env.var.
Expand All @@ -51,6 +37,13 @@ configuration:

install:

# Examine Windows version and current directory
- ver
- cd

# Examine the initial environment
- set

- git --version
- if %APPVEYOR_REPO_BRANCH%.==manual-ci-run. set _NEED_REBASE=true
# This Git version requires user configuration in rebase step
Expand All @@ -64,24 +57,48 @@ install:
- if %APPVEYOR_REPO_BRANCH%.==manual-ci-run. set _MANUAL_CI_RUN=true
- if %APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH%.==manual-ci-run. set _MANUAL_CI_RUN=true

# Verify that the commands used in this file are available
- where where
# Verify that Chocolatey is available
- where choco
- choco --version

# Set PACKAGE_LEVEL for make
- set PACKAGE_LEVEL=%configuration%
# Install Swig (used by M2Crypto)
- choco install -y --allow-empty-checksums swig

# Examine the initial environment
- ver
- 'echo "%PATH%"'
- 'echo "%PYTHONPATH%"'
- 'echo "%INCLUDE%"'
- 'echo "%LIB%"'
- choco source list
- dir C:\
- dir
- set
## Install InnoSetup - disabled because it is not needed
#- choco install -y InnoSetup
#- set PATH="C:\Program Files (x86)\Inno Setup 5";%PATH%

# Resets environment variables of current shell to those from registry
# This is how environment variable changes done by chocolatey are picked up,
# at the price of undoing any local environment variable changes in the shell.
# Therefore, this needs to happen before any env vars are set in this file.
- refreshenv

# Add CygWin
- set PATH=C:\cygwin\bin;%PATH%

# Verify that the commands used in this file are available
- where curl
- curl --version
- "cmd /c where dumpbin & true"
- "cmd /c where corflags & true"

# Install Win32/64OpenSSL (used by M2Crypto)
# The bit size of Win32/64OpenSSL must match the bit size of Windows (not of
# the Python environment).
- curl -o Win32OpenSSL-1_1_0h.exe -sSL https://slproweb.com/download/Win32OpenSSL-1_1_0h.exe
- Win32OpenSSL-1_1_0h.exe /silent /verysilent /DIR=C:\OpenSSL-1-1-Win32
- set _WINOPENSSL_BITSIZE=64 # TODO: Determine Windows bit size
- set _WINOPENSSL_BASENAME=Win%_WINOPENSSL_BITSIZE%OpenSSL-1_1_0h
- set _WINOPENSSL_INSTALL_DIR=C:\\OpenSSL-1-1-0h-Win%_WINOPENSSL_BITSIZE%
- curl -o %_WINOPENSSL_BASENAME%.exe -sSL https://slproweb.com/download/%_WINOPENSSL_BASENAME%.exe
- echo "%_WINOPENSSL_INSTALL_DIR%"
# The installer has a GUI which is suppressed by /silent /verysilent
- 'cmd /c %_WINOPENSSL_BASENAME%.exe /silent /verysilent /dir="%_WINOPENSSL_INSTALL_DIR%" /log="openssl.log" & true'
- cat openssl.log
- dir "%_WINOPENSSL_INSTALL_DIR%"
- dir "%_WINOPENSSL_INSTALL_DIR%\include"
- set SWIG_FEATURES="-I%_WINOPENSSL_INSTALL_DIR%\include" %SWIG_FEATURES%

# Remove Python 2.7 from PATH.
# Note that YAML interprets some characters in a special way (including '!' and '#')
Expand All @@ -98,35 +115,24 @@ install:
- 'set $newpath=%$newpath:^^=%'
- 'set PATH=%$newpath%'

# Add CygWin
- set PATH=C:\cygwin\bin;%PATH%

# Verify that the commands provided by CygWin and used in this file are available
- where wget
- wget --version
- where unzip
- unzip --help
- where 7z
- 7z --help

# Add Python
- reg ADD HKCU\Software\Python\PythonCore\%PYTHON_VERSION%\InstallPath /ve /d "%PYTHON_HOME%" /t REG_SZ /f
- reg ADD HKLM\Software\Python\PythonCore\%PYTHON_VERSION%\InstallPath /ve /d "%PYTHON_HOME%" /t REG_SZ /f
- set PATH=%PYTHON_HOME%;%PYTHON_HOME%\Scripts;%PATH%

## Install InnoSetup - disabled because it is not needed
#- choco install -y InnoSetup
#- set PATH="C:\Program Files (x86)\Inno Setup 5";%PATH%

## Install pip - disabled because pip is already installed
#- ps: (new-object System.Net.WebClient).Downloadfile('https://bootstrap.pypa.io/get-pip.py', 'C:\Users\appveyor\get-pip.py')
#- ps: Start-Process -FilePath "C:\Python27\python.exe" -ArgumentList "C:\Users\appveyor\get-pip.py" -Wait -Passthru

# Set PACKAGE_LEVEL for make
- set PACKAGE_LEVEL=%configuration%

# Examine the final environment
- 'echo "%PATH%"'
- 'echo "%PYTHONPATH%"'
- 'echo "%INCLUDE%"'
- 'echo "%LIB%"'
- 'echo "%SWIG_FEATURES%"'

# Install tox
- where pip
Expand Down
8 changes: 1 addition & 7 deletions makefile
Expand Up @@ -266,17 +266,11 @@ _show_bitsize:
$(PYTHON_CMD) -c "import platform; print(int(platform.architecture()[0].rstrip('bit')))"
@echo "makefile: Done determining bit size of Python executable"

install_pywbem.done: requirements.txt win32-requirements.txt win64-requirements.txt setup.py setup.cfg
install_pywbem.done: requirements.txt setup.py setup.cfg
@echo "makefile: Installing pywbem (editable) and its Python runtime prerequisites (with PACKAGE_LEVEL=$(PACKAGE_LEVEL))"
rm -Rf build $(package_name).egg-info .eggs
rm -f PKG-INFO
$(PIP_CMD) install $(pip_level_opts) -r requirements.txt
ifeq ($(PYTHON_ARCH),32)
$(PIP_CMD) install $(pip_level_opts) -r win32-requirements.txt
endif
ifeq ($(PYTHON_ARCH),64)
$(PIP_CMD) install $(pip_level_opts) -r win64-requirements.txt
endif
$(PIP_CMD) install $(pip_level_opts) -e .
cp -r $(package_name).egg-info/PKG-INFO .
touch install_pywbem.done
Expand Down
6 changes: 1 addition & 5 deletions minimum-constraints.txt
Expand Up @@ -48,11 +48,7 @@ pbr===1.10.0
six===1.10.0
ply===3.10
PyYAML===3.12

M2Crypto===0.24.0
M2CryptoWin32===0.21.1.post3
M2CryptoWin64===0.21.1.post3

M2Crypto===0.30.0
ordereddict===1.1

# Indirect dependencies for runtime (must be consistent with requirements.txt)
Expand Down
6 changes: 4 additions & 2 deletions pywbem_os_setup.sh
Expand Up @@ -213,8 +213,10 @@ elif [[ "$distro_family" == "osx" ]]; then

elif [[ "$distro_family" == "windows" ]]; then

# Nothing needed for "install" because the M2CryptoWin32/64 packages are
# binary packages and don't invoke Swig during their installation.
if [[ "$purpose" == "install" ]]; then
echo "$myname: Warning: Installation of OS-level packages for runtime must be performned manually on platform ${platform}." >&2
echo ". See the 'Development' chapter of the documentation for instructions." >&2
fi

if [[ "$purpose" == "develop" ]]; then
echo "$myname: Warning: Installation of OS-level packages for development must be performned manually on platform ${platform}." >&2
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Expand Up @@ -13,7 +13,6 @@ pbr>=1.10.0
six>=1.10.0
ply>=3.10
PyYAML>=3.12 # yaml package
M2Crypto>=0.24.0,!=0.27.0; (python_version == '2.6' or python_version == '2.7') and sys_platform != 'win32'
# M2CryptoWin32/64 are specified in win32/64-requirements.txt
M2Crypto>=0.30.0; python_version < '3.0'
ordereddict>=1.1; python_version == '2.6'
mock>=2.0.0
2 changes: 1 addition & 1 deletion rtd-requirements.txt
Expand Up @@ -7,6 +7,6 @@ pbr>=1.10.0
six>=1.10.0
ply>=3.8
PyYAML>=3.12
# M2Crypto>=0.24 # we cannot install M2Crypto because RTD does not have Swig
# M2Crypto>=0.30.0 # we cannot install M2Crypto because RTD does not have Swig
Sphinx>=1.4.9
sphinx-git>=10.0.0
9 changes: 0 additions & 9 deletions win32-requirements.txt

This file was deleted.

9 changes: 0 additions & 9 deletions win64-requirements.txt

This file was deleted.

0 comments on commit 3c08754

Please sign in to comment.