Commit 21bdd244 authored by Patrik Dufresne's avatar Patrik Dufresne

Merge branch 'develop/patrik/appveyor' into 'master'

First appveyor

See merge request !3
parents 5c3caf5c 5317a977
Pipeline #1173 passed with stages
in 19 minutes and 25 seconds
......@@ -7,12 +7,23 @@ stages:
variables:
CBC_VERSION: 2.10.3
CBC_FILE: Cbc-$CBC_VERSION.tgz
#
# Build Stages
#
.build: &build
.buildlinux: &buildlinux
stage: build
dependencies:
- build_cbc_x86_64_linux
before_script:
# Install SWIG
- yum install -y wget pcre-devel
- wget https://sourceforge.net/projects/swig/files/swig/swig-4.0.0/swig-4.0.0.tar.gz
- tar -zxvf swig-4.0.0.tar.gz
- cd swig-4.0.0
- ./configure && make && make install
- cd .. && pwd
script:
# Compile python module
- $PYTHON_ENV/bin/python setup.py build_ext --swig="${SWIG:-swig-4.0.0/swig}"
......@@ -28,33 +39,6 @@ variables:
paths:
- wheelhouse
.buildlinux: &buildlinux
<<: *build
dependencies:
- build_cbc_x86_64_linux
before_script:
# Install SWIG
- yum install -y wget pcre-devel
- wget https://sourceforge.net/projects/swig/files/swig/swig-4.0.0/swig-4.0.0.tar.gz
- tar -zxvf swig-4.0.0.tar.gz
- cd swig-4.0.0
- ./configure && make && make install
- cd .. && pwd
.buildwin: &buildwin
<<: *build
before_script:
# Install CBC
- export CBC_FILE=Cbc-$CBC_VERSION-win32-msvc9.zip
- mkdir Cbc && cd Cbc
- wget https://bintray.com/coin-or/download/download_file?file_path=$CBC_FILE -O $CBC_FILE
- unzip $CBC_FILE
- cd .. && pwd
# Install SWIG
- wget https://sourceforge.net/projects/swig/files/swigwin/swigwin-4.0.0/swigwin-4.0.0.zip
- unzip swigwin-4.0.0.zip
dependencies: []
#
# Build CBC & SWIG
#
......@@ -64,8 +48,8 @@ build_cbc_x86_64_linux:
script:
- yum install -y wget
- mkdir Cbc && cd Cbc
- wget https://www.coin-or.org/download/source/Cbc/Cbc-$CBC_VERSION.tgz
- tar -zxvf Cbc-$CBC_VERSION.tgz --strip 1
- wget https://www.coin-or.org/download/source/Cbc/$CBC_FILE
- tar -zxvf $CBC_FILE --strip 1
- ./configure --disable-shared -with-pic
- make
- make install
......@@ -87,11 +71,6 @@ build_cp27-cp27mu_x86_64_linux:
variables:
PYTHON_ENV: /opt/python/cp27-cp27mu
build_cp34-cp34m_x86_64_linux:
<<: *buildlinux
variables:
PYTHON_ENV: /opt/python/cp34-cp34m
build_cp35-cp35m_x86_64_linux:
<<: *buildlinux
variables:
......@@ -107,14 +86,6 @@ build_cp37-cp37m_x86_64_linux:
variables:
PYTHON_ENV: /opt/python/cp37-cp37m
build_py27_win32_msvc9:
<<: *buildwin
image: ikus060/manywindows
allow_failure: true
variables:
SWIG: swigwin-4.0.0/swig.exe
PYTHON_ENV: /opt/python/cp27-cp27m-win32
#
# Publish manylinux packages
#
......@@ -125,6 +96,7 @@ publish_nexus:
script:
- pip install twine --upgrade
- python setup.py sdist
- twine check wheelhouse/*
- twine upload wheelhouse/* -u $NEXUS_USR -p $NEXUS_PWD --repository-url $NEXUS_PYPI_URL
publish_pypi:
......@@ -135,5 +107,6 @@ publish_pypi:
script:
- pip3 install twine --upgrade
- python setup.py sdist
- twine check wheelhouse/*
- twine upload wheelhouse/* -u $PYPI_USR -p $PYPI_PWD
\ No newline at end of file
[![Build Status](https://git.patrikdufresne.com/pdsl/cbcpy/badges/master/pipeline.svg)](https://git.patrikdufresne.com/pdsl/cbcpy/pipelines)
[![Linux Build Status](https://git.patrikdufresne.com/pdsl/cbcpy/badges/master/pipeline.svg)](https://git.patrikdufresne.com/pdsl/cbcpy/pipelines)
[![Windows Build status](https://ci.appveyor.com/api/projects/status/whyjc5s9vpulkno6?svg=true)](https://ci.appveyor.com/project/ikus060/cbcpy)
# cbcpy
......@@ -6,20 +8,24 @@ Native Python interface for Coin-or Branch and Cut Solver ([Cbc](https://github.
# Description
This project provide the build mechanism to automatically generate the wrapper code between Cbc c++ code and python using [SWIG](http://www.swig.org/).
This project provide the build mechanism to automatically generate the wrapper code between Cbc C++ code and Python using [SWIG](http://www.swig.org/).
This project was develop as part of the CBC Coin-or Sprint Aug 2019.
Binaries for the following platform are pre-compiled:
Binaries for the following platform are pre-compiled and available on [pypi](https://pypi.org/project/cbcpy/).
* linux x86_64 / python 2.7
* linux x86_64 / python 3.5
* linux x86_64 / python 3.6
* linux x86_64 / python 3.7
* win32 / python 2.7
**Linux i386 is not supported.**
* win x86 / python 2.7
* win x86 / python 3.5
* win x86 / python 3.6
* win x86 / python 3.7
* win x86_64 / python 3.5
* win x86_64 / python 3.6
* win x86_64 / python 3.7
NOTICE Adding more platform is in progress.
Linux x86 is not supported.
# Installation
......@@ -30,6 +36,7 @@ To install `cbcpy` you should make use of `pip` command line:
The packages include pre-compiled version of Cbc.
**For Windows: You must install [Visual C++ Redistributable for VS2015](https://www.microsoft.com/en-us/download/details.aspx?id=52685)**
# Usage
......@@ -60,3 +67,24 @@ Original documentation from Cbc project is available in python using the `help()
>>> import cbcpy
>>> help(cbcpy)
Help on module cbcpy:
# Troubleshooting
## The specified module could not be found.
```
>>> import cbcpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python37-32\lib\site-packages\cbcpy.py", line 15, in <module>
import _cbcpy
ImportError: DLL load failed: The specified module could not be found.
```
This error might occur on Windows platform when the file `msvcp140.dll` cannot
be found. You must install [Visual C++ Redistributable for VS2015](https://www.microsoft.com/en-us/download/details.aspx?id=52685).
For 32-bit download "vc_redist.x86.exe" file and for 64-bit download "vc_redist.x64.exe" file.
# Support
To get community help for cbcpy, you may send email to the [Cbc mailing list](https://list.coin-or.org/mailman/listinfo/cbc).
You may also get paid support by contacting [Patrik Dufresne Service Logiciel](http://www.patrikdufresne.com/en/support/#form).
environment:
CBC_VERSION: 2.10.3
CBC_FILE: Cbc-2.10.3.zip
NEXUS_PYPI_URL: https://nexus.patrikdufresne.com/repository/pypi/
NEXUS_USR: deployment
NEXUS_PWD:
secure: QoqYIve6cLFpB3lcuZaaFw==
PYPI_USR: ikus060
PYPI_PWD:
secure: gV+oYBIb4h27bncJCZGAtihXwxsMYL67N94yIVFxLKo=
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ARCH: x86
PYTHON: "C:\\Python35"
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ARCH: x86
PYTHON: "C:\\Python36"
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ARCH: x86
PYTHON: "C:\\Python37"
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ARCH: amd64
PYTHON: "C:\\Python35-x64"
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ARCH: amd64
PYTHON: "C:\\Python36-x64"
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ARCH: amd64
PYTHON: "C:\\Python37-x64"
artifacts:
- path: dist\*
install:
# Install SWIG
- curl -LfsS -o swigwin-4.0.0.zip https://sourceforge.net/projects/swig/files/swigwin/swigwin-4.0.0/swigwin-4.0.0.zip
- 7z x swigwin-4.0.0.zip
# We need wheel installed to build wheels
- "%PYTHON%\\Scripts\\pip.exe install setuptools>=41.0.1 wheel>=0.31.1 twine>=1.13.0"
build_script:
# Compile CBC
- curl -LfsS -o %CBC_FILE% https://www.coin-or.org/download/source/Cbc/%CBC_FILE%
- 7z x %CBC_FILE%
- mv Cbc-%CBC_VERSION% Cbc
- CALL C:\"Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %ARCH%
- C:\msys64\usr\bin\bash -lc "cd "$APPVEYOR_BUILD_FOLDER/Cbc"; ./configure --build=x86_64-w64-mingw32 --enable-msvc=MD --prefix=`pwd`"
- C:\msys64\usr\bin\bash -lc "cd "$APPVEYOR_BUILD_FOLDER/Cbc"; make"
- C:\msys64\usr\bin\bash -lc "cd "$APPVEYOR_BUILD_FOLDER/Cbc"; make install"
# Build cbcpy
- "%PYTHON%\\python.exe setup.py build_ext --swig=swigwin-4.0.0\\swig.exe"
- "%PYTHON%\\python.exe setup.py bdist_wheel"
# Deploy everything to Nexus
# Deploy tag to pypi
deploy_script:
- "%PYTHON%\\Scripts\\twine.exe check dist/*.whl"
- "%PYTHON%\\Scripts\\twine.exe upload dist/*.whl -u %NEXUS_USR% -p %NEXUS_PWD% --repository-url %NEXUS_PYPI_URL%"
- "if %APPVEYOR_REPO_TAG% == true ( %PYTHON%\\Scripts\\twine.exe upload dist/*.whl -u %PYPI_USR% -p %PYPI_PWD% )"
......@@ -17,6 +17,7 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import os
import sys
try:
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext as _build_ext
......@@ -27,11 +28,11 @@ except ImportError:
from setuptools.command.build_ext import build_ext as _build_ext
# Configure the SWIG build
CBC_DIR = os.environ.get('CBC_DIR', './Cbc')
CBC_DIR = os.environ.get('CBC_DIR', os.path.join('.', 'Cbc'))
if not os.path.isdir(CBC_DIR):
print('CBC_DIR environment variable must be a directory: ' + CBC_DIR)
include_dirs = [os.path.join(CBC_DIR, 'include/coin')]
include_dirs = [os.path.join(CBC_DIR, 'include', 'coin')]
library_dirs = [os.path.join(CBC_DIR, 'lib')]
libraries = ['CbcSolver', 'Cbc', 'Cgl', 'OsiClp', 'OsiCbc', 'Osi', 'Clp', 'CoinUtils']
if os.name == 'nt':
......@@ -60,18 +61,22 @@ class cbc_build_ext(_build_ext):
self._patch_headers()
_build_ext.run(self)
# Define project description from README.md
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as f:
long_description = f.read()
# Define project description from README.md
# With python 3.5 we are running into trouble, so let disable this.
long_description_content_type = long_description = None
PY35 = sys.version_info[0:2] == (3, 5)
if not (os.name == 'nt' and PY35):
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as f:
long_description = f.read()
long_description_content_type = 'text/markdown'
setup(
name='cbcpy',
version="2.10.3-2",
use_scm_version=True,
description='Coin-or CBC native interface for Python',
long_description=long_description,
long_description_content_type='text/markdown',
long_description_content_type=long_description_content_type,
author='Patrik Dufresne',
author_email='info@patrikdufresne.com',
url='https://git.patrikdufresne.com/pdsl/cbcpy',
......@@ -86,5 +91,18 @@ setup(
libraries=libraries,
extra_objects=extra_objects)],
py_modules=['cbcpy'],
setup_requires=['patch'],
setup_requires=['patch', 'setuptools_scm'],
keywords='coin-or cbc',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4',
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment