Skip to content

Commit

Permalink
Merge pull request #183 from OpenPTV/alex_master
Browse files Browse the repository at this point in the history
merging CI build
  • Loading branch information
alexlib authored May 26, 2019
2 parents 0e75f36 + fd3f591 commit 16d4f52
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 31 deletions.
51 changes: 29 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
language: python

before_install:
- if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh; else wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; fi
- chmod +x miniconda.sh
- ./miniconda.sh -b -p /home/travis/mc
- export PATH=/home/travis/mc/bin:$PATH

install:
- conda update --yes conda
- conda create -n testenv --yes $DEPS numpy cython pyyaml nose six python=$TRAVIS_PYTHON_VERSION
- source activate testenv

# for debugging...
- echo $PATH
- which python
- conda info
- conda list
matrix:
include:
- sudo: required
services:
- docker
env:
- CIBW_SKIP="*manylinux1_i686* cp34-*"
- CIBW_BEFORE_BUILD="pip install -r requirements.txt && python setup.py prepare
--liboptv-dir liboptv-src"
- PIP=pip
- os: osx
language: generic
env:
- PIP=pip2
- CIBW_BEFORE_BUILD="cd py_bind && pip install -r requirements.txt && python setup.py
prepare --liboptv-dir liboptv-src"
- CIBW_SKIP=cp34-*

script:
- cd py_bind
- python setup.py prepare
- python setup.py install
- cd test
- nosetests --verbose
- "$PIP install cibuildwheel==0.10.2"
- cp -R liboptv py_bind/liboptv-src
- cibuildwheel py_bind --output-dir wheelhouse

deploy:
provider: releases
skip_cleanup: true
api_key: "$GITHUB_TOKEN"
file_glob: true
file: wheelhouse/*
on:
tags: true
branch: master
19 changes: 19 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
environment:
CIBW_SKIP: "*manylinux1_i686* cp34-*"
CIBW_BEFORE_BUILD: "cd py_bind && pip install -r requirements.txt && python setup.py prepare"

build_script:
- pip install cibuildwheel==0.10.2
- cibuildwheel py_bind --output-dir wheelhouse

artifacts:
- path: wheelhouse\*.whl
name: Wheels

deploy:
provider: GitHub
auth_token: ${GITHUB_TOKEN}
artifact: Wheels
on:
branch: master
APPVEYOR_REPO_TAG: true
21 changes: 12 additions & 9 deletions py_bind/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,33 @@ class PrepareCommand(setuptools.Command):
# First, we should copy the liboptv sources to a subdirectory, so they can be included with the sdist package.
# Second, we convert the pyx files to c files, so the package can be installed from source without requiring Cython
description = "Copy the liboptv sources and convert pyx files to C before building"
user_options = []

# We allow specifying the liboptv dir, for cibuildwheel, which must have everything under py_bind
user_options = [('liboptv-dir=', None, 'Path for liboptv, default is "../liboptv"')]

def initialize_options(self):
pass
self.liboptv_dir = False

def finalize_options(self):
pass
if not self.liboptv_dir:
self.liboptv_dir = '../liboptv'

def run(self):
self.copy_source_files()
self.convert_to_c()

def copy_source_files(self):
if not os.path.exists('../liboptv'):
print('../liboptv does not exist. You must run setup.py prepare from with the full liboptv repository',
if not os.path.exists(self.liboptv_dir):
print('liboptv does not exist at %s. You must run setup.py prepare from with the full liboptv repository' % self.liboptv_dir,
file=sys.stderr)
raise Exception('.//liboptv does not exist')
raise Exception('liboptv does not exist at %s' % self.liboptv_dir)

print('Copying the liboptv source files...')
print('Copying the liboptv source files from %s...' % self.liboptv_dir)
if os.path.exists('./liboptv'):
shutil.rmtree('./liboptv')
os.makedirs('./liboptv')
shutil.copytree('../liboptv/include', 'liboptv/include/optv')
shutil.copytree('../liboptv/src', 'liboptv/src')
shutil.copytree(os.path.join(self.liboptv_dir, 'include'), 'liboptv/include/optv')
shutil.copytree(os.path.join(self.liboptv_dir, 'src'), 'liboptv/src')

def convert_to_c(self):
print('Converting pyx files to C sources...')
Expand Down

0 comments on commit 16d4f52

Please sign in to comment.