Skip to content

Commit 1e60779

Browse files
author
Pan
committed
Added static bundled libssh2 source code.
Updated setup.py to build bundled libssh2 automatically. Added libssh2 python build script for use in sdist builds. Removed libssh2 submodule. Updated manylinux docker file. Updated sdist manifest. Updated setup.py Updated travis and appveyor cfgs. Re-generated C sources with cython 0.29 Added session.sock public attribute for socket session. Updated CI OSX scripts. Updated changelog. Resolves #43. Resolves #37.
1 parent 2d62505 commit 1e60779

File tree

430 files changed

+76796
-3627
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

430 files changed

+76796
-3627
lines changed

.appveyor.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ environment:
66
CMD_IN_ENV: "cmd /E:ON /V:ON /C %APPVEYOR_BUILD_FOLDER%\\ci\\appveyor\\run_with_env.cmd"
77
PYTHONUNBUFFERED: 1
88
EMBEDDED_LIB: 1
9-
OPENSSL_VER: 1.0.2l
9+
OPENSSL_VER: 1.0.2p
1010
PYPI_USER:
1111
secure: 2m0jy6JD/R9RExIosOT6YA==
1212
PYPI_PASS:
@@ -17,60 +17,70 @@ environment:
1717
PYTHON_ARCH: "32"
1818
MSVC: "Visual Studio 9"
1919
ARCH: i386
20+
SYSTEM_LIBSSH2: 1
2021

2122
- PYTHON: "C:\\Python27-x64"
2223
PYTHON_VERSION: "2.7"
2324
PYTHON_ARCH: "64"
2425
MSVC: "Visual Studio 9"
2526
ARCH: x64_86
27+
SYSTEM_LIBSSH2: 1
2628

2729
- PYTHON: "C:\\Python34"
2830
PYTHON_VERSION: "3.4"
2931
PYTHON_ARCH: "32"
3032
MSVC: "Visual Studio 10"
3133
ARCH: i386
34+
SYSTEM_LIBSSH2: 1
3235

3336
- PYTHON: "C:\\Python34-x64"
3437
PYTHON_VERSION: "3.4"
3538
PYTHON_ARCH: "64"
3639
MSVC: "Visual Studio 10 Win64"
3740
ARCH: x64_86
41+
SYSTEM_LIBSSH2: 1
3842

3943
- PYTHON: "C:\\Python35"
4044
PYTHON_VERSION: "3.5"
4145
PYTHON_ARCH: "32"
4246
MSVC: "Visual Studio 14"
4347
ARCH: i386
48+
SYSTEM_LIBSSH2: 1
4449

4550
- PYTHON: "C:\\Python35-x64"
4651
PYTHON_VERSION: "3.5"
4752
PYTHON_ARCH: "64"
4853
MSVC: "Visual Studio 14 Win64"
4954
ARCH: x64_86
55+
SYSTEM_LIBSSH2: 1
5056

5157
- PYTHON: "C:\\Python36"
5258
PYTHON_VERSION: "3.6"
5359
PYTHON_ARCH: "32"
5460
MSVC: "Visual Studio 14"
5561
ARCH: i386
62+
SYSTEM_LIBSSH2: 1
5663

5764
- PYTHON: "C:\\Python36-x64"
5865
PYTHON_VERSION: "3.6"
5966
PYTHON_ARCH: "64"
6067
MSVC: "Visual Studio 14 Win64"
6168
ARCH: x64_86
69+
SYSTEM_LIBSSH2: 1
6270

6371
- PYTHON: "C:\\Python37"
6472
PYTHON_VERSION: "3.7"
6573
PYTHON_ARCH: "32"
6674
MSVC: "Visual Studio 14"
6775
ARCH: i386
76+
SYSTEM_LIBSSH2: 1
6877

6978
- PYTHON: "C:\\Python37-x64"
7079
PYTHON_VERSION: "3.7"
7180
PYTHON_ARCH: "64"
7281
MSVC: "Visual Studio 14 Win64"
7382
ARCH: x64_86
83+
SYSTEM_LIBSSH2: 1
7484

7585
install:
7686
# If there is a newer build queued for the same PR, cancel this one.
@@ -119,20 +129,22 @@ install:
119129
- cp ssleay32.dll ssh2\
120130
- cp libeay32.dll ssh2\
121131
- ps: ls ssh2
122-
123132
build_script:
124133
- "%CMD_IN_ENV% ci\\appveyor\\build_zlib.bat"
125134
- "%CMD_IN_ENV% ci\\appveyor\\build_ssh2.bat"
126135
- rm -f ssh2/*.c
136+
- "%CMD_IN_ENV% python setup.py build_ext -I libssh2/include"
127137
- "%CMD_IN_ENV% python setup.py build"
128-
- "%CMD_IN_ENV% python setup.py build_ext -i"
138+
- "%CMD_IN_ENV% python setup.py install"
129139

130140
test_script:
141+
- cd dist
131142
- python -c "from ssh2.session import Session; Session()"
143+
- cd ..
132144

133145
after_test:
134146
# If tests are successful, create binary packages for the project.
135-
- "%CMD_IN_ENV% python setup.py bdist_wheel"
147+
- "%CMD_IN_ENV% python setup.py bdist_wheel "
136148
- mv dist/* .
137149

138150
artifacts:

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

.travis.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ python:
1010
- 3.4
1111
- 3.5
1212
- 3.6
13-
- pypy
1413
addons:
1514
apt:
1615
packages:
@@ -20,15 +19,14 @@ addons:
2019
- cmake
2120
install:
2221
- pip install flake8 jinja2 sphinx sphinx_rtd_theme
23-
- sudo ci/install-ssh2.sh
2422
- python setup.py build_ext --inplace
2523
- eval "$(ssh-agent -s)"
2624
script:
2725
- export LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu
2826
- nosetests
2927
- flake8 ssh2
3028
- python setup.py sdist
31-
- cd dist; pip install *; cd ..
29+
- cd dist && pip install * && cd ..
3230
- cd doc; make html; cd ..
3331
jobs:
3432
include:
@@ -39,9 +37,10 @@ jobs:
3937
osx_image: xcode8.3
4038
env:
4139
- PYENV: 3.6.4
40+
- SYSTEM_LIBSSH2: 1
4241
before_install:
4342
- brew update
44-
- brew outdated openssl || brew upgrade openssl
43+
- brew outdated openssl || brew upgrade openssl || echo "y"
4544
- brew link --overwrite python@2 || brew install python@2 || brew link --overwrite python@2
4645
- which python2
4746
- python2 -c "from __future__ import print_function; import ssl; from platform import python_version; print(ssl.OPENSSL_VERSION); print(python_version())"
@@ -65,7 +64,7 @@ jobs:
6564
- python -c "from ssh2.session import Session; Session()"
6665
- cd ..; pwd
6766
- mv -f *.whl wheels/
68-
- ./ci/travis/pyenv-wheel.sh
67+
- travis_wait ./ci/travis/pyenv-wheel.sh
6968
after_success:
7069
- if [[ ! -z "$TRAVIS_TAG" ]]; then
7170
twine upload --skip-existing -u $PYPI_U -p $PYPI_P wheels/*.whl;
@@ -80,9 +79,10 @@ jobs:
8079
osx_image: xcode6.4
8180
env:
8281
- PYENV: 3.7.0
82+
- SYSTEM_LIBSSH2: 1
8383
install: skip
8484
script:
85-
- ./ci/travis/pyenv-wheel.sh
85+
- travis_wait ./ci/travis/pyenv-wheel.sh
8686

8787
- <<: *osx-wheels
8888
osx_image: xcode8
@@ -94,25 +94,28 @@ jobs:
9494
osx_image: xcode8
9595
env:
9696
- PYENV: 3.7.0
97+
- SYSTEM_LIBSSH2: 1
9798
install: skip
9899
script:
99-
- ./ci/travis/pyenv-wheel.sh
100+
- travis_wait ./ci/travis/pyenv-wheel.sh
100101

101102
- <<: *osx-wheels
102103
osx_image: xcode8.3
103104
env:
104105
- PYENV: 3.7.0
106+
- SYSTEM_LIBSSH2: 1
105107
install: skip
106108
script:
107-
- ./ci/travis/pyenv-wheel.sh
109+
- travis_wait ./ci/travis/pyenv-wheel.sh
108110

109111
- <<: *osx-wheels
110112
osx_image: xcode9.3
111113
env:
112114
- PYENV: 3.7.0
115+
- SYSTEM_LIBSSH2: 1
113116
install: skip
114117
script:
115-
- ./ci/travis/pyenv-wheel.sh
118+
- travis_wait ./ci/travis/pyenv-wheel.sh
116119

117120
- stage: build packages
118121
env:

Changelog.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
Change Log
22
=============
33

4+
0.16.0
5+
+++++++
6+
7+
Changes
8+
--------
9+
10+
* Added ``Session.sock`` public attribute for getting socket used by ``Session``.
11+
* Source distribution default ``libssh2`` build target updated to upstream ``libssh2`` master branch.
12+
* Added bundled libssh2 source code for current master branch to repository and source distribution.
13+
* Added automatic build of bundled libssh2 code for source builds and ``SYSTEM_LIBSSH2`` environment variable to control building and linking against system provided libssh2. This will require additional steps for Windows platforms and older libssh2 versions - see documentation.
14+
* Updated binary wheels for all platforms to latest libssh2.
15+
16+
417
0.15.0
518
+++++++
619

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
recursive-include libssh2 *
12
recursive-exclude docker *
3+
include _setup_libssh2.py
24
include versioneer.py
35
include ssh2/_version.py
46
exclude .travis.yml

_setup_libssh2.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import os
2+
3+
from sys import stderr
4+
from subprocess import check_call
5+
from glob import glob
6+
from shutil import copy2
7+
from multiprocessing import cpu_count
8+
9+
10+
def build_ssh2():
11+
if bool(os.environ.get('SYSTEM_LIBSSH', False)):
12+
stderr.write("Using system libssh2..%s" % (os.sep))
13+
return
14+
if os.path.exists('/usr/local/opt/openssl'):
15+
os.environ['OPENSSL_ROOT_DIR'] = '/usr/local/opt/openssl'
16+
17+
if not os.path.exists('src'):
18+
os.mkdir('src')
19+
20+
os.chdir('src')
21+
check_call('cmake ../libssh2 -DBUILD_SHARED_LIBS=ON \
22+
-DENABLE_ZLIB_COMPRESSION=ON -DENABLE_CRYPT_NONE=ON \
23+
-DENABLE_MAC_NONE=ON -DCRYPTO_BACKEND=OpenSSL',
24+
shell=True, env=os.environ)
25+
check_call('cmake --build . --config Release', shell=True, env=os.environ)
26+
os.chdir('..')
27+
28+
for src in glob('src/src/libssh2.so*'):
29+
copy2(src, 'ssh2/')

ci/docker/build-packages.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ for x in `ls -1d ci/docker/{fedora,centos}*`; do
1010
dist="el${dist_num}"
1111
fi
1212
docker pull $docker_tag || echo
13-
docker build --cache-from $docker_tag $x -t $name
13+
docker build --pull --cache-from $docker_tag $x -t $name
1414
docker tag $name $docker_tag
1515
# docker push $docker_tag
1616
sudo rm -rf build dist
@@ -26,7 +26,7 @@ for x in `ls -1d ci/docker/{debian,ubuntu}*`; do
2626
name=`echo "$x" | awk -F/ '{print $3}' | awk -F. '{print $1}'`
2727
docker_tag="parallelssh/ssh2-python:$name"
2828
docker pull $docker_tag || echo
29-
docker build --cache-from $docker_tag $x -t $name
29+
docker build --pull --cache-from $docker_tag $x -t $name
3030
docker tag $name $docker_tag
3131
# docker push $docker_tag
3232
sudo rm -rf build dist

ci/docker/centos7/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ RUN curl -sLO https://bootstrap.pypa.io/get-pip.py && python get-pip.py && rm -f
55

66
ENV EMBEDDED_LIB 0
77
ENV HAVE_AGENT_FWD 0
8+
ENV SYSTEM_LIBSSH2 1

ci/docker/debian8/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ RUN pip install -U setuptools
55
RUN pip install -U pip wheel
66
RUN pip install cython
77

8-
ENV EMBEDDED_LIB 1
8+
ENV EMBEDDED_LIB 0
99
ENV HAVE_AGENT_FWD 0
10+
ENV SYSTEM_LIBSSH2 1

ci/docker/fedora22/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
FROM cdrx/fpm-fedora:22
22

3-
RUN yum -y install libssh2-devel python-devel python-setuptools git
3+
RUN dnf -y install libssh2-devel python-devel python-setuptools git
44
RUN curl -sLO https://bootstrap.pypa.io/get-pip.py && python get-pip.py && rm -f get-pip.py && pip install -U setuptools wheel && pip install cython
55

66
ENV EMBEDDED_LIB 0
77
ENV HAVE_AGENT_FWD 0
8+
ENV SYSTEM_LIBSSH2 1

ci/docker/fedora23/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
FROM cdrx/fpm-fedora:23
22

3-
RUN yum -y install libssh2-devel python-devel python-setuptools git
3+
RUN dnf -y install libssh2-devel python-devel python-setuptools git
44
RUN curl -sLO https://bootstrap.pypa.io/get-pip.py && python get-pip.py && rm -f get-pip.py && pip install -U setuptools wheel && pip install cython
55

66
ENV EMBEDDED_LIB 0
77
ENV HAVE_AGENT_FWD 0
8+
ENV SYSTEM_LIBSSH2 1

ci/docker/fedora24/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
FROM cdrx/fpm-fedora:24
22

3-
RUN yum -y install libssh2-devel python-devel python-setuptools git
3+
RUN dnf -y install libssh2-devel python-devel python-setuptools git
44
RUN curl -sLO https://bootstrap.pypa.io/get-pip.py && python get-pip.py && rm -f get-pip.py && pip install -U setuptools wheel && pip install cython
55

66
ENV EMBEDDED_LIB 1
77
ENV HAVE_AGENT_FWD 0
8+
ENV SYSTEM_LIBSSH2 1

ci/docker/manylinux/Dockerfile

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
FROM quay.io/pypa/manylinux1_x86_64
22

33
ENV CMAKE cmake-2.8.11.1-5.4.x86_64
4-
ENV OPENSSL openssl-1.0.2l
5-
ENV LIBSSH2_VER agent_fwd
4+
ENV OPENSSL openssl-1.0.2p
5+
ENV SYSTEM_LIBSSH2 1
66

77
RUN yum install zlib-devel -y
88

9-
ADD https://github.com/ParallelSSH/libssh2/archive/${LIBSSH2_VER}.tar.gz libssh2.tar.gz
9+
ADD libssh2.tar.gz libssh2.tar.gz
1010
ADD ${CMAKE}.rpm cmake.rpm
1111
ADD http://www.openssl.org/source/${OPENSSL}.tar.gz ${OPENSSL}.tar.gz
1212

@@ -19,12 +19,11 @@ RUN tar -xzf ${OPENSSL}.tar.gz && \
1919
make -j4 && make install
2020

2121
# Libssh2
22-
RUN tar -xzf libssh2.tar.gz && \
23-
mkdir -p build_libssh2 && cd build_libssh2 && \
24-
cmake ../libssh2-${LIBSSH2_VER} -DBUILD_SHARED_LIBS=ON -DENABLE_ZLIB_COMPRESSION=ON \
22+
RUN mkdir -p build_libssh2 && cd build_libssh2 && \
23+
cmake ../libssh2.tar.gz -DBUILD_SHARED_LIBS=ON -DENABLE_ZLIB_COMPRESSION=ON \
2524
-DENABLE_CRYPT_NONE=ON -DENABLE_MAC_NONE=ON -DCMAKE_INSTALL_PREFIX=/usr && \
2625
cmake --build . --config Release --target install
2726

28-
RUN rm -rf ${OPENSSL}* libssh2-agent_fwd build_libssh2
27+
RUN rm -rf ${OPENSSL}* build_libssh2
2928

3029
VOLUME /var/cache

ci/docker/manylinux/libssh2.tar.gz

453 KB
Binary file not shown.

ci/docker/ubuntu14.04/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ RUN pip install cython
77

88
ENV EMBEDDED_LIB 0
99
ENV HAVE_AGENT_FWD 0
10+
ENV SYSTEM_LIBSSH2 1

ci/docker/ubuntu16.04/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ RUN pip install cython
77

88
ENV EMBEDDED_LIB 0
99
ENV HAVE_AGENT_FWD 0
10+
ENV SYSTEM_LIBSSH2 1

ci/docker/ubuntu18.04/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ RUN pip install cython
77

88
ENV EMBEDDED_LIB 1
99
ENV HAVE_AGENT_FWD 0
10+
ENV SYSTEM_LIBSSH2 1

0 commit comments

Comments
 (0)