Skip to content

Commit

Permalink
Increased M2Crypto to 0.30.1; Used M2Crypto on Windows
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.1
(which has a fix for the Windows support introduced with 0.29.0).

It also adds a pywbem_os_setup.bat script which installs OS-level dependencie
for installing M2Crypto (e.g. its build requires swig, Win32/64OpenSSL).

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
  • Loading branch information
andy-maier committed May 18, 2018
1 parent 24995eb commit c95e7bf
Show file tree
Hide file tree
Showing 11 changed files with 249 additions and 109 deletions.
91 changes: 40 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 @@ -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,25 +57,9 @@ 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
- where choco
- choco --version

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

# Examine the initial environment
- ver
- 'echo "%PATH%"'
- 'echo "%PYTHONPATH%"'
- 'echo "%INCLUDE%"'
- 'echo "%LIB%"'
- choco source list
- dir C:\
- dir
- set

# Remove Python 2.7 from PATH.
# Note that YAML interprets some characters in a special way (including '!' and '#')
# so we have to use single quotes to protect some CMD commands from YAML.
Expand All @@ -99,20 +76,16 @@ install:
- 'set PATH=%$newpath%'

# Add CygWin
# This must be after removal of Python 2.7 (because CygWin has the Unix find) and
# before adding Python (because CygWin also has a python).
- 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%
- where python
- python --version

## Install InnoSetup - disabled because it is not needed
#- choco install -y InnoSetup
Expand All @@ -121,29 +94,41 @@ install:
## 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
- where pip
- pip --version

# Verify that Chocolatey is available
- where choco
- choco --version

# Circumvention:
# The installation in pywbem_os_setup.bat installs swig but without generating
# the swig.exe shim file (using GenShim).
# See GenShim issue https://github.com/chocolatey/shimgen/issues/43
# Therefore, we install swig ihere in order to create the swig.exe shim file.
# TODO: Remove the circumvention once it works in pywbem_os_setup.bat.
- choco install -r -y swig
- where swig

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

# Install tox
- where pip
- pip --version
- pip install tox==2.0.0

# Verify that the commands used in tox.ini are available
- where tox
- tox --version

# Verify that the commands used in tox.ini are available
# Already verified further up: tox, pip, python.
- where make
- make --version
- where pip
- pip --version
- where python
- python --version

# Verify that the commands used in makefile are available
# Already verified further up: pip, python.
- where sh
- sh --version
- where bash
Expand All @@ -163,6 +148,10 @@ install:
- where find
- find --version

# Verify that the commands used in pywbem_os_setup.bat are available
- where curl
- curl --version

# Verify that the commands used in the pywbem testsuite are available
- where xmllint
- xmllint --version
Expand Down
6 changes: 6 additions & 0 deletions docs/changes.rst
Expand Up @@ -119,6 +119,12 @@ Released: not yet
objects that states that `copy.copy()` and `copy.deepcopy()` can be used
to create completely shallow or completely deep copies (Issue #1251).

* Installation on Windows is now more automated by means of a new
`pywbem_os_setup.bat` script. As part of that, the latest `M2Crypto` version
0.30.1 is now used on Windows, and no longer the somewhat aged versions in
the `M2CryptoWin32/64` packages. For details, see the installation section
in the documentation.

**Cleanup**

* Moved class `NocaseDict` into its own module (Issue #848).
Expand Down
37 changes: 17 additions & 20 deletions docs/intro.rst
Expand Up @@ -108,7 +108,7 @@ Pywbem is supported in these environments:
Limitations:

* On Windows (native), pywbem is not supported on Python 2.6, because the
M2CryptoWin32/64 packages do not support Python 2.6.
M2Crypto package does not support Python 2.6.


.. _`Installing to Linux`:
Expand Down Expand Up @@ -205,7 +205,7 @@ Installing to OS-X
* Only on Python 2 on newer OS-X releases:

The ``pywbem_os_setup.sh`` script installs the ``openssl`` package needed by
the M2Crypto Python package. On newer OS-X releases, you may see a notice
the ``M2Crypto`` Python package. On newer OS-X releases, you may see a notice
that the ``openssl`` package is "not linked" because the TLS implementation
provided with OS-X is available. In that case, you need to set up the
following environment variables for use by the pywbem package installation
Expand Down Expand Up @@ -235,31 +235,26 @@ This section describes the installation of pywbem into a native Windows
environment (i.e. without using a UNIX-like environment; for that, see
:ref:`Installing to a UNIX-like environment under Windows`):

* Determine the bit size of the active Python environment, for example as
follows:
* Download the ``pywbem_os_setup.bat`` script from one of these sources:

.. code-block:: bash
- :download:`pywbem_os_setup.bat <../pywbem_os_setup.bat>` on this site

> python -c "import ctypes; print(ctypes.sizeof(ctypes.c_void_p)*8)"
64
- `pywbem_os_setup.bat <https://raw.githubusercontent.com/pywbem/pywbem/master/pywbem_os_setup.bat>`_
on the `master` branch of the pywbem Git repository

* Install the Windows build of M2Crypto into the active Python environment:
That script installs OS-level prerequisite packages needed by pywbem.

For a 32-bit Python environment:
* Execute the ``pywbem_os_setup.bat`` script:

.. code-block:: bash
> pip install M2CryptoWin32
> pywbem_os_setup.bat
For a 64-bit Python environment:
The script uses the `Chocolatey package manager`_ to install packages to
Windows, and it is assumed that Chocolatey is installed.

.. code-block:: bash
> pip install M2CryptoWin64
Note that these Python packages are binary builds and therefore do not invoke
Swig at their installation time. Therefore, there are no prerequisite
OS-level packages to install.
This script will also install the ``M2Crypto`` Python package into the active
Python environment.

* Install pywbem (and its other prerequisite Python packages) into the active
Python environment:
Expand All @@ -268,6 +263,8 @@ environment (i.e. without using a UNIX-like environment; for that, see
> pip install pywbem
.. _`Chocolatey package manager`: https://chocolatey.org/


.. _`Installing to a UNIX-like environment under Windows`:

Expand All @@ -288,8 +285,8 @@ Windows.
> pip install pywbem
If the Swig compilation during installation of M2Crypto fails, there may be
components of the UNIX-like environment missing. When using CygWin, these
If the Swig compilation during installation of ``M2Crypto`` fails, there may
be components of the UNIX-like environment missing. When using CygWin, these
may be installed using the CygWin setup program, and the packages are listed
in :ref:`Prerequisite operating system packages for install`. For other
UNIX-like environments, there should be similar packages (please tell us by
Expand Down
16 changes: 9 additions & 7 deletions makefile
Expand Up @@ -254,7 +254,11 @@ install_os: install_os.done

install_os.done: pywbem_os_setup.sh
@echo "makefile: Installing OS-level installation and runtime requirements"
ifeq ($(PLATFORM),Windows)
cmd /c pywbem_os_setup.bat install
else
./pywbem_os_setup.sh install
endif
touch install_os.done
@echo "makefile: Done installing OS-level installation and runtime requirements"

Expand All @@ -266,17 +270,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 All @@ -297,7 +295,11 @@ develop_os: develop_os.done

develop_os.done: pywbem_os_setup.sh
@echo "makefile: Installing OS-level development requirements"
ifeq ($(PLATFORM),Windows)
cmd /c pywbem_os_setup.bat develop
else
./pywbem_os_setup.sh develop
endif
touch develop_os.done
@echo "makefile: Done installing OS-level development requirements"

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.1
ordereddict===1.1

# Indirect dependencies for runtime (must be consistent with requirements.txt)
Expand Down

0 comments on commit c95e7bf

Please sign in to comment.