Skip to content

Commit eaf30bb

Browse files
author
Pan
committed
Added manylinux binary wheel builds on travis-ci.
Added manylinux dockerfile, dependencies and scripts. Updated travis cfg, libssh build script. Added changelog.
1 parent 94a7dc1 commit eaf30bb

12 files changed

+126
-30
lines changed

.travis.yml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,27 @@ script:
2727
- python setup.py sdist
2828
- cd dist; pip install *; cd ..
2929
- cd doc; make html; cd ..
30-
# jobs:
31-
# include:
32-
# - stage: build wheels
33-
# os: linux
34-
# python: 3.6
35-
# install:
36-
# - pip install twine
37-
# script:
38-
# - docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
39-
# - ./ci/travis/build-manylinux.sh
40-
# after_success:
41-
# - if [[ ! -z "$TRAVIS_TAG" ]]; then
42-
# twine upload --skip-existing -u $PYPI_U -p $PYPI_P wheelhouse/*.whl;
43-
# fi
44-
# deploy:
45-
# - provider: pypi
46-
# skip_cleanup: true
47-
# on:
48-
# repo: ParallelSSH/ssh-python
49-
# tags: true
50-
# distributions: sdist
51-
# user: pkittenis
52-
# password:
53-
# secure: ""
30+
jobs:
31+
include:
32+
- stage: build wheels
33+
os: linux
34+
python: 3.6
35+
install:
36+
- pip install twine
37+
script:
38+
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
39+
- ./ci/travis/build-manylinux.sh
40+
after_success:
41+
- if [[ ! -z "$TRAVIS_TAG" ]]; then
42+
twine upload --skip-existing -u $PYPI_U -p $PYPI_P wheelhouse/*.whl;
43+
fi
44+
deploy:
45+
- provider: pypi
46+
skip_cleanup: true
47+
on:
48+
repo: ParallelSSH/ssh-python
49+
tags: true
50+
distributions: sdist
51+
user: pkittenis
52+
password:
53+
secure: "RIG3Q+TI42oO9C8X0psryqp4IiZS9aWjhDav1WmvEM1BjmyvJDdxoM+Q29XA7POkmfpPHx165bzMCbJo6/366lmAjS2IaBU1EHmO8uwx4FwUgDmSy0IswnRcSnWbzv793Qpituu9mkXRUmgjIlz7qZxYi55Zry1nOCpZxg2UREk8ILVBjszxN77UlmySztF9IZETeKvaPyuCVMEi/0804hNfMMsigshlqz0roEiXONdzRxCWk0zN8XqIBr7Oro03CYse6dha7evZ1K9cBq5wVmLvxtBcWYuQMt8NwH9QmdgeDjrLkE7L3E0DOcKkmGwSaRCZheRIIox64/4LWmHVhu3ntxu+UoSicBRXDVCECcNZHzlfLOkGH+e4pISL0J2dm9M+gyllxTRDi6lIDLRumPhfVpFNJ5BKAuwGUNYSe0qKCBdpSNlN1AXqtjBjtfAN/WdGfsBmp54NhWQDbHMLtnoBlNrFG19aKk2UvgES4XHxcmKYC45KW3HE0oK+Ep7yUweBtrtaneTV9bi6smBrJfaxn6UNnY6L2OowbAwlcZBbRDaIoh160j9j62ezY6Ry+UGL8Z1eNUnafd5dBxbZhFVTQbxC9g/Yy6uHmOdlyAM5QlFlnj7ib0HcCKr4DEq4Uy+xyrSlHibU8vPsxBt/OPx0vN+5alXnX1asFpuO0ro="

Changelog.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Change Log
2+
=============
3+
4+
0.3.0
5+
++++++++
6+
7+
Changes
8+
-------
9+
10+
* Added SCP support - #3
11+
12+
Packaging
13+
-----------
14+
* Added Linux binary wheels builds.

_setup_libssh.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
from subprocess import check_call
21
import os
2+
3+
from sys import stderr
4+
from subprocess import check_call
35
from glob import glob
46
from shutil import copy2
57
from multiprocessing import cpu_count
68

79

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

ci/appveyor/fix_version.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import os
2+
from datetime import datetime
3+
import subprocess
4+
import json
5+
import sys
6+
7+
def get_describe_tag():
8+
return subprocess.check_output(['git', 'describe', '--tags']).strip().decode('utf-8')
9+
10+
def make_version_file(basedir):
11+
rev = os.environ.get('APPVEYOR_REPO_COMMIT',
12+
subprocess.check_output(['git', 'rev-list', '--max-count=1', 'HEAD']).strip().decode('utf-8'))
13+
basedir = os.path.abspath(basedir)
14+
git_desc = get_describe_tag()
15+
version_json = {'date': datetime.now().isoformat(),
16+
'dirty': False,
17+
'error': None,
18+
'full-revisionid': rev,
19+
'version': git_desc}
20+
data = """
21+
import json
22+
23+
version_json = '''
24+
%s''' # END VERSION_JSON
25+
26+
27+
def get_versions():
28+
return json.loads(version_json)
29+
30+
""" % (json.dumps(version_json))
31+
with open(os.path.join(basedir, 'ssh', '_version.py'), 'w') as fh:
32+
fh.write(data)
33+
34+
35+
if __name__ == "__main__":
36+
if not len(sys.argv) > 1:
37+
sys.stderr.write("Need basedir of repo" + os.linesep)
38+
sys.exit(1)
39+
make_version_file(sys.argv[1])

ci/docker/manylinux/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM quay.io/pypa/manylinux1_x86_64
2+
3+
ENV CMAKE cmake-2.8.11.1-5.4.x86_64
4+
ENV OPENSSL openssl-1.0.2p
5+
ENV LIBSSH 0.7.9
6+
ENV SYSTEM_LIBSSH 1
7+
8+
RUN yum install zlib-devel -y
9+
10+
ADD ${CMAKE}.rpm cmake.rpm
11+
RUN rpm -i cmake.rpm
12+
13+
ADD libssh-${LIBSSH}.tar.gz libssh.tar.gz
14+
ADD ${OPENSSL}.tar.gz ${OPENSSL}.tar.gz
15+
16+
17+
# Openssl
18+
RUN cd ${OPENSSL}.tar.gz/${OPENSSL} && \
19+
./config --prefix=/usr --openssldir=/usr/openssl threads shared && \
20+
make -j6 && make install
21+
22+
23+
# Libssh
24+
RUN mkdir -p build_libssh && cd build_libssh && \
25+
cmake ../libssh.tar.gz/libssh -DCMAKE_BUILD_TYPE=Release && \
26+
make -j6 install
27+
28+
29+
RUN rm -rf ${OPENSSL}* libssh build_libssh
30+
31+
32+
VOLUME /var/cache
Binary file not shown.
552 KB
Binary file not shown.
5.09 MB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
50a98e07b1a89eb8f6a99477f262df71c6fa7bef77df4dc83025a2845c827d00

ci/travis/build-manylinux.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ docker_tag="parallelssh/ssh-manylinux"
55
rm -rf build dist
66

77
docker pull $docker_tag || echo
8-
docker build --cache-from $docker_tag ci/docker/manylinux -t $docker_tag
9-
docker push $docker_tag
8+
docker build --pull --cache-from $docker_tag ci/docker/manylinux -t $docker_tag
9+
# docker push $docker_tag
1010
docker run --rm -v `pwd`:/io $docker_tag /io/ci/travis/build-wheels.sh
1111
ls wheelhouse/

ci/travis/build-wheels.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash -xe
22

33
# Compile wheels
4+
rm -rf /io/build
45
for PYBIN in `ls -1d /opt/python/*/bin | grep -v cpython`; do
56
"${PYBIN}/pip" wheel /io/ -w wheelhouse/
67
done

setup.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
build_ssh()
3030

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

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

5960

60-
_lib_dir = os.path.abspath("./src/src")
61+
runtime_library_dirs = ["$ORIGIN/."] if not SYSTEM_LIBSSH else None
62+
_lib_dir = os.path.abspath("./src/src") if not SYSTEM_LIBSSH else "/usr/local/lib"
63+
include_dirs = ["libssh/include"] if not SYSTEM_LIBSSH else ["/usr/local/include"]
64+
6165
extensions = [
6266
Extension(
6367
sources[i].split('.')[0].replace(os.path.sep, '.'),
6468
sources=[sources[i]],
65-
include_dirs=["libssh/include"],
69+
include_dirs=include_dirs,
6670
libraries=_libs,
6771
library_dirs=[_lib_dir],
68-
runtime_library_dirs=["$ORIGIN/."],
72+
runtime_library_dirs=runtime_library_dirs,
6973
extra_compile_args=_comp_args,
7074
**cython_args
7175
)

0 commit comments

Comments
 (0)