Skip to content

Commit

Permalink
Added manylinux binary wheel builds on travis-ci.
Browse files Browse the repository at this point in the history
Added manylinux dockerfile, dependencies and scripts.
Updated travis cfg, libssh build script.
Added changelog.
  • Loading branch information
pkittenis committed Sep 23, 2018
1 parent 94a7dc1 commit eaf30bb
Show file tree
Hide file tree
Showing 12 changed files with 126 additions and 30 deletions.
48 changes: 24 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,27 @@ script:
- python setup.py sdist
- cd dist; pip install *; cd ..
- cd doc; make html; cd ..
# jobs:
# include:
# - stage: build wheels
# os: linux
# python: 3.6
# install:
# - pip install twine
# script:
# - docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
# - ./ci/travis/build-manylinux.sh
# after_success:
# - if [[ ! -z "$TRAVIS_TAG" ]]; then
# twine upload --skip-existing -u $PYPI_U -p $PYPI_P wheelhouse/*.whl;
# fi
# deploy:
# - provider: pypi
# skip_cleanup: true
# on:
# repo: ParallelSSH/ssh-python
# tags: true
# distributions: sdist
# user: pkittenis
# password:
# secure: ""
jobs:
include:
- stage: build wheels
os: linux
python: 3.6
install:
- pip install twine
script:
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
- ./ci/travis/build-manylinux.sh
after_success:
- if [[ ! -z "$TRAVIS_TAG" ]]; then
twine upload --skip-existing -u $PYPI_U -p $PYPI_P wheelhouse/*.whl;
fi
deploy:
- provider: pypi
skip_cleanup: true
on:
repo: ParallelSSH/ssh-python
tags: true
distributions: sdist
user: pkittenis
password:
secure: "RIG3Q+TI42oO9C8X0psryqp4IiZS9aWjhDav1WmvEM1BjmyvJDdxoM+Q29XA7POkmfpPHx165bzMCbJo6/366lmAjS2IaBU1EHmO8uwx4FwUgDmSy0IswnRcSnWbzv793Qpituu9mkXRUmgjIlz7qZxYi55Zry1nOCpZxg2UREk8ILVBjszxN77UlmySztF9IZETeKvaPyuCVMEi/0804hNfMMsigshlqz0roEiXONdzRxCWk0zN8XqIBr7Oro03CYse6dha7evZ1K9cBq5wVmLvxtBcWYuQMt8NwH9QmdgeDjrLkE7L3E0DOcKkmGwSaRCZheRIIox64/4LWmHVhu3ntxu+UoSicBRXDVCECcNZHzlfLOkGH+e4pISL0J2dm9M+gyllxTRDi6lIDLRumPhfVpFNJ5BKAuwGUNYSe0qKCBdpSNlN1AXqtjBjtfAN/WdGfsBmp54NhWQDbHMLtnoBlNrFG19aKk2UvgES4XHxcmKYC45KW3HE0oK+Ep7yUweBtrtaneTV9bi6smBrJfaxn6UNnY6L2OowbAwlcZBbRDaIoh160j9j62ezY6Ry+UGL8Z1eNUnafd5dBxbZhFVTQbxC9g/Yy6uHmOdlyAM5QlFlnj7ib0HcCKr4DEq4Uy+xyrSlHibU8vPsxBt/OPx0vN+5alXnX1asFpuO0ro="
14 changes: 14 additions & 0 deletions Changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Change Log
=============

0.3.0
++++++++

Changes
-------

* Added SCP support - #3

Packaging
-----------
* Added Linux binary wheels builds.
7 changes: 6 additions & 1 deletion _setup_libssh.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
from subprocess import check_call
import os

from sys import stderr
from subprocess import check_call
from glob import glob
from shutil import copy2
from multiprocessing import cpu_count


def build_ssh():
if bool(os.environ.get('SYSTEM_LIBSSH', False)):
stderr.write("Using system libssh..%s" % (os.sep))
return
if os.path.exists('/usr/local/opt/openssl'):
os.environ['OPENSSL_ROOT_DIR'] = '/usr/local/opt/openssl'

Expand Down
39 changes: 39 additions & 0 deletions ci/appveyor/fix_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import os
from datetime import datetime
import subprocess
import json
import sys

def get_describe_tag():
return subprocess.check_output(['git', 'describe', '--tags']).strip().decode('utf-8')

def make_version_file(basedir):
rev = os.environ.get('APPVEYOR_REPO_COMMIT',
subprocess.check_output(['git', 'rev-list', '--max-count=1', 'HEAD']).strip().decode('utf-8'))
basedir = os.path.abspath(basedir)
git_desc = get_describe_tag()
version_json = {'date': datetime.now().isoformat(),
'dirty': False,
'error': None,
'full-revisionid': rev,
'version': git_desc}
data = """
import json
version_json = '''
%s''' # END VERSION_JSON
def get_versions():
return json.loads(version_json)
""" % (json.dumps(version_json))
with open(os.path.join(basedir, 'ssh', '_version.py'), 'w') as fh:
fh.write(data)


if __name__ == "__main__":
if not len(sys.argv) > 1:
sys.stderr.write("Need basedir of repo" + os.linesep)
sys.exit(1)
make_version_file(sys.argv[1])
32 changes: 32 additions & 0 deletions ci/docker/manylinux/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM quay.io/pypa/manylinux1_x86_64

ENV CMAKE cmake-2.8.11.1-5.4.x86_64
ENV OPENSSL openssl-1.0.2p
ENV LIBSSH 0.7.9
ENV SYSTEM_LIBSSH 1

RUN yum install zlib-devel -y

ADD ${CMAKE}.rpm cmake.rpm
RUN rpm -i cmake.rpm

ADD libssh-${LIBSSH}.tar.gz libssh.tar.gz
ADD ${OPENSSL}.tar.gz ${OPENSSL}.tar.gz


# Openssl
RUN cd ${OPENSSL}.tar.gz/${OPENSSL} && \
./config --prefix=/usr --openssldir=/usr/openssl threads shared && \
make -j6 && make install


# Libssh
RUN mkdir -p build_libssh && cd build_libssh && \
cmake ../libssh.tar.gz/libssh -DCMAKE_BUILD_TYPE=Release && \
make -j6 install


RUN rm -rf ${OPENSSL}* libssh build_libssh


VOLUME /var/cache
Binary file added ci/docker/manylinux/cmake-2.8.11.1-5.4.x86_64.rpm
Binary file not shown.
Binary file added ci/docker/manylinux/libssh-0.7.9.tar.gz
Binary file not shown.
Binary file added ci/docker/manylinux/openssl-1.0.2p.tar.gz
Binary file not shown.
1 change: 1 addition & 0 deletions ci/docker/manylinux/openssl-1.0.2p.tar.gz.sha256
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
50a98e07b1a89eb8f6a99477f262df71c6fa7bef77df4dc83025a2845c827d00
4 changes: 2 additions & 2 deletions ci/travis/build-manylinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ docker_tag="parallelssh/ssh-manylinux"
rm -rf build dist

docker pull $docker_tag || echo
docker build --cache-from $docker_tag ci/docker/manylinux -t $docker_tag
docker push $docker_tag
docker build --pull --cache-from $docker_tag ci/docker/manylinux -t $docker_tag
# docker push $docker_tag
docker run --rm -v `pwd`:/io $docker_tag /io/ci/travis/build-wheels.sh
ls wheelhouse/
1 change: 1 addition & 0 deletions ci/travis/build-wheels.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash -xe

# Compile wheels
rm -rf /io/build
for PYBIN in `ls -1d /opt/python/*/bin | grep -v cpython`; do
"${PYBIN}/pip" wheel /io/ -w wheelhouse/
done
Expand Down
10 changes: 7 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
build_ssh()

ON_WINDOWS = platform.system() == 'Windows'
SYSTEM_LIBSSH = bool(os.environ.get('SYSTEM_LIBSSH', 0))

ext = 'pyx' if USING_CYTHON else 'c'
sources = glob('ssh/*.%s' % (ext,))
Expand Down Expand Up @@ -57,15 +58,18 @@
sys.stdout.write("Cython arguments: %s%s" % (cython_args, os.linesep))


_lib_dir = os.path.abspath("./src/src")
runtime_library_dirs = ["$ORIGIN/."] if not SYSTEM_LIBSSH else None
_lib_dir = os.path.abspath("./src/src") if not SYSTEM_LIBSSH else "/usr/local/lib"
include_dirs = ["libssh/include"] if not SYSTEM_LIBSSH else ["/usr/local/include"]

extensions = [
Extension(
sources[i].split('.')[0].replace(os.path.sep, '.'),
sources=[sources[i]],
include_dirs=["libssh/include"],
include_dirs=include_dirs,
libraries=_libs,
library_dirs=[_lib_dir],
runtime_library_dirs=["$ORIGIN/."],
runtime_library_dirs=runtime_library_dirs,
extra_compile_args=_comp_args,
**cython_args
)
Expand Down

0 comments on commit eaf30bb

Please sign in to comment.