Skip to content

Commit 94a7dc1

Browse files
author
Pan
committed
Added SCP implementation.
Added SFTP, scp tests. Updated channel, session tests. Updated sdist manifest. Added libssh python build script, added to setup.py for embedded build. Updated travis cfg. Added cython static C source files.
1 parent 6c6f1e7 commit 94a7dc1

Some content is hidden

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

48 files changed

+121564
-404
lines changed

.travis.yml

Lines changed: 25 additions & 139 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,148 +19,35 @@ 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:
27-
- export LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu
2825
- nosetests
29-
- flake8 ssh2
26+
- flake8 ssh
3027
- python setup.py sdist
3128
- cd dist; pip install *; cd ..
3229
- cd doc; make html; cd ..
33-
jobs:
34-
include:
35-
- stage: OSX wheel build
36-
os: osx
37-
if: tag IS present
38-
before_install:
39-
- brew update
40-
install:
41-
- brew upgrade openssl
42-
- sudo ci/install-ssh2.sh
43-
- sudo -H pip2 install -U delocate twine wheel pip setuptools
44-
- cp /usr/local/lib/libssh2* .
45-
- ls -lh
46-
- pip2 wheel .
47-
script:
48-
- delocate-listdeps --all *.whl
49-
- delocate-wheel -v *.whl
50-
- delocate-listdeps --all *.whl
51-
- ls -l *.whl
52-
- rm -f *.dylib
53-
- pip2 install --user -v *.whl
54-
- pwd; mkdir temp; cd temp; pwd
55-
- python -c "from ssh2.session import Session; Session()"
56-
- cd ..; pwd
57-
after_success:
58-
- if [[ ! -z "$TRAVIS_TAG" ]]; then
59-
twine upload -u $PYPI_U -p $PYPI_P *.whl;
60-
fi
61-
language: generic
62-
python: skip
63-
- stage: OSX wheel build
64-
os: osx
65-
osx_image: xcode8
66-
if: tag IS present
67-
before_install:
68-
- brew update
69-
install:
70-
- brew upgrade openssl
71-
- sudo ci/install-ssh2.sh
72-
- sudo rm -f libssh2.1.dylib
73-
- sudo -H pip2 install -U delocate twine wheel pip setuptools
74-
- cp /usr/local/lib/libssh2* .
75-
- ls -lh
76-
- pip2 wheel .
77-
script:
78-
- delocate-listdeps --all *.whl
79-
- delocate-wheel -v *.whl
80-
- delocate-listdeps --all *.whl
81-
- ls -l *.whl
82-
- rm -f *.dylib
83-
- pip2 install --user -v *.whl
84-
- pwd; mkdir temp; cd temp; pwd
85-
- python -c "from ssh2.session import Session; Session()"
86-
- cd ..; pwd
87-
after_success:
88-
- if [[ ! -z "$TRAVIS_TAG" ]]; then
89-
twine upload -u $PYPI_U -p $PYPI_P *.whl;
90-
fi
91-
language: generic
92-
python: skip
93-
- stage: OSX wheel build
94-
os: osx
95-
osx_image: xcode6.4
96-
if: tag IS present
97-
before_install:
98-
- brew update
99-
install:
100-
- brew upgrade openssl
101-
- sudo ci/install-ssh2.sh
102-
- ls -lh
103-
- python --version
104-
- wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py
105-
- sudo python get-pip.py
106-
- sudo -H pip install -U pip
107-
- sudo -H pip install -U delocate twine wheel setuptools
108-
- cp /usr/local/lib/libssh2* .
109-
- pip wheel .
110-
script:
111-
- delocate-listdeps --all *.whl
112-
- delocate-wheel -v *.whl
113-
- delocate-listdeps --all *.whl
114-
- ls -l *.whl
115-
- rm -f *.dylib
116-
- pip install --user -v *.whl
117-
- pwd; mkdir temp; cd temp; pwd
118-
- python -c "from ssh2.session import Session; Session()"
119-
- cd ..; pwd
120-
after_success:
121-
- if [[ ! -z "$TRAVIS_TAG" ]]; then
122-
twine upload -u $PYPI_U -p $PYPI_P *.whl;
123-
fi
124-
language: generic
125-
python: skip
126-
# - stage: build_packages
127-
# if: tag IS present
128-
# os: linux
129-
# python: 3.6
130-
# install: skip
131-
# script: skip
132-
# before_deploy:
133-
# - docker --version
134-
# - docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
135-
# - ./ci/docker/build-packages.sh
136-
# deploy:
137-
# - provider: releases
138-
# skip_cleanup: true
139-
# api_key:
140-
# secure: i1Dr0k393wXBsCKST5ckeTPdZT+hjkikHCGgMSEkJxw+Q8m/Sgq9bbBalkJZDZDc8t0a/nE4ioEXoYO+PT9wRSpjLbjDVwRoWde5PVHaR3JviiwxULEynFLbvdJ1S2O/zRM37YMVgIIXN/2SWSXvQcQznrrvjtBoV+nZfYHX2WZQruq1nQXcPvTJPeZtCBsWaA3TwbVobnOJdb3TFxnHybN3N4gCTOkurek0V7OSMpjd1qgSzNMDIhjXKf/ZB9bcuusXo2QSnzUDJo3S6QE4FBxKohVom7z4AQ8+iRVPkkrWezBo089vzPzfZN/C5+8xQAUfZ6bVNdS6DfI80+55s6Xj7BFEKQW9Kh3Em0GpipHxdxiBf176xktY9EROkDkwDHlsbE7JRRQUmfmJe+0yCo+gg9uAsz5XHNrQgU5BxKhVzggMA/VU+clJ51WfbYGJAvVs/NjHQb/A9CzYKdBamUvy3YY2dxLbdohR7TZMM0JWYmZcmSiaOiZxrCT3ThlQ/J9o9r6TFWvkVjvt+ozABsx0OvtNrdkp7VvFbSQGvmTzGnPM2O5xqzWrM73Z7g8Ahw1g08FDN0JAO8n/Y0tb/xpVAFBmkQTJpQk7f4kQAHWlZKEYN2wEnX+hptjXfDjMYGX9Tc5vdDQJ3oTxnCt+y7Vl9IplT0a5GTTE0l8Pyc4=
141-
# file_glob: true
142-
# file: '*.{deb,rpm}'
143-
# on:
144-
# repo: ParallelSSH/ssh2-python
145-
# tags: true
146-
- stage: build wheels
147-
os: linux
148-
python: 3.6
149-
install:
150-
- pip install twine
151-
script:
152-
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
153-
- ./ci/travis/build-manylinux.sh
154-
after_success:
155-
- if [[ ! -z "$TRAVIS_TAG" ]]; then
156-
twine upload -u $PYPI_U -p $PYPI_P wheelhouse/*.whl;
157-
fi
158-
deploy:
159-
- provider: pypi
160-
skip_cleanup: true
161-
on:
162-
repo: ParallelSSH/ssh2-python
163-
tags: true
164-
distributions: sdist
165-
user: pkittenis
166-
password:
167-
secure: "eEBo76bmNWArLOzLNkv8whYO81HqkYpwUu3RqBHv6PNW/sI70VSIVfPTWo8ThlNkYSBy1Sxci6eU+Vd8qYH/vaCbl4068BkzroGUqGMLHXLRLEPQjO2pxTvnQ7Nbj/Mi9enoslLJKflx2USy2iPz1yGCWZrPzjLWmEMcx6j5e3fEUGF2p6p01w/zWxmiSoyJgBsby9P8Fl5nflsNMVR/or8frK4K1T6Y2oTuEx9aYymmBPFOO5DHaedDxnhZ04KKaACIECvKrT5V3PMM1jrE3qu6hJ1LS0/mSivEdCwCszHanjIQy/enkNtLgxVm4jIRUjuAwL1MmxPtkAUcKrQor1YokMqm5fExdwvnp+qjtyejfA3IvT93nYvCj4IEYNMDtUGFUBjsYLqg7Ked/jvO53Ek5WEAE/Mx8F/OAtuvkpEeUKTIWxfd+V0b7pgShVuU5zFyi3y97vpRtdwqzOFr8QT3Hq+g/RIdghPQ9pGQ3GOomTMO1B7mAyOG6SYyQM/wra2h2dQTHCbgzAtsPzZLiZhWIGcU7/mGLm0kZBT6McnH2//hsIPXG8S94u2MWE0KRH5YhJ/2ATWneYyFHWQfwqDeR/1CZe66gFcPJ9cOIG+8pcmXueLhnueDbh2EWa8jmumtrAz+z+rcokih0c7catT7pByDv24Ouuw2Yf3my60="
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: ""

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ include ssh/*.pyx
77
include ssh/*.pxd
88
recursive-include libssh *
99
include ci/build_ssh.sh
10+
include _setup_libssh.py

_setup_libssh.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from subprocess import check_call
2+
import os
3+
from glob import glob
4+
from shutil import copy2
5+
from multiprocessing import cpu_count
6+
7+
8+
def build_ssh():
9+
if os.path.exists('/usr/local/opt/openssl'):
10+
os.environ['OPENSSL_ROOT_DIR'] = '/usr/local/opt/openssl'
11+
12+
if not os.path.exists('src'):
13+
os.mkdir('src')
14+
15+
os.chdir('src')
16+
check_call('cmake -DCMAKE_BUILD_TYPE=Release ../libssh',
17+
shell=True, env=os.environ)
18+
check_call(['make', '-j%s' % (cpu_count(),)])
19+
os.chdir('..')
20+
21+
for src in glob('src/src/libssh.so*'):
22+
copy2(src, 'ssh/')

ci/travis/build-manylinux.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash -xe
2+
3+
docker_tag="parallelssh/ssh-manylinux"
4+
5+
rm -rf build dist
6+
7+
docker pull $docker_tag || echo
8+
docker build --cache-from $docker_tag ci/docker/manylinux -t $docker_tag
9+
docker push $docker_tag
10+
docker run --rm -v `pwd`:/io $docker_tag /io/ci/travis/build-wheels.sh
11+
ls wheelhouse/

ci/travis/build-wheels.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash -xe
2+
3+
# Compile wheels
4+
for PYBIN in `ls -1d /opt/python/*/bin | grep -v cpython`; do
5+
"${PYBIN}/pip" wheel /io/ -w wheelhouse/
6+
done
7+
8+
# Bundle external shared libraries into the wheels
9+
for whl in wheelhouse/*.whl; do
10+
auditwheel repair "$whl" -w /io/wheelhouse/
11+
done
12+
13+
# Install packages and test
14+
for PYBIN in `ls -1d /opt/python/*/bin | grep -v cpython`; do
15+
"${PYBIN}/pip" install ssh-python --no-index -f /io/wheelhouse
16+
(cd "$HOME"; "${PYBIN}/python" -c 'from ssh.session import Session; Session()')
17+
done

ci/travis/pyenv-wheel.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash -xe
2+
3+
brew install pyenv || brew outdated pyenv || brew upgrade pyenv
4+
5+
export PYENV_VERSION=${PYENV:-3.6.4}
6+
if [[ ! -d "$HOME/.pyenv/versions/$PYENV_VERSION" ]]; then
7+
pyenv install $PYENV_VERSION
8+
fi
9+
pyenv global $PYENV_VERSION
10+
pyenv versions
11+
12+
set +x
13+
eval "$(pyenv init -)"
14+
set -x
15+
16+
which python
17+
python -m pip install -U virtualenv
18+
python -m virtualenv -p "$(which python)" venv
19+
20+
set +x
21+
source venv/bin/activate
22+
set -x
23+
24+
python -V
25+
python -m pip install -U setuptools pip
26+
pip install -U delocate wheel
27+
pip wheel .
28+
delocate-listdeps --all *.whl
29+
delocate-wheel -v *.whl
30+
delocate-listdeps --all *.whl
31+
32+
ls -l *.whl
33+
rm -f *.dylib
34+
pip install -v *.whl
35+
pwd; mkdir -p temp; cd temp; pwd
36+
python -c "from ssh.session import Session; Session()"
37+
cd ..; pwd
38+
set +x
39+
deactivate
40+
set -x
41+
42+
mv -f *.whl wheels/
43+
ls -lh wheels

setup.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
from __future__ import print_function
2-
31
import platform
42
import os
53
import sys
64
from glob import glob
7-
# from multiprocessing import cpu_count
8-
from subprocess import check_call
5+
from _setup_libssh import build_ssh
96

107
import versioneer
118
from setuptools import setup, find_packages
@@ -22,11 +19,6 @@
2219
USING_CYTHON = True
2320

2421

25-
def build_ssh():
26-
cmd = './ci/build_ssh.sh'
27-
return check_call(cmd, env=os.environ, shell=True)
28-
29-
3022
# Only build libssh if running a build
3123
if (len(sys.argv) >= 2 and not (
3224
'--help' in sys.argv[1:] or

0 commit comments

Comments
 (0)