Skip to content

Commit 23d686a

Browse files
author
Pan
committed
Initial libssh wrapper definitions and minimal implementation file.
0 parents  commit 23d686a

19 files changed

+4374
-0
lines changed

.appveyor.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
environment:
2+
global:
3+
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
4+
# /E:ON and /V:ON options are not enabled in the batch script intepreter
5+
# See: http://stackoverflow.com/a/13751649/163740
6+
CMD_IN_ENV: "cmd /E:ON /V:ON /C %APPVEYOR_BUILD_FOLDER%\\ci\\appveyor\\run_with_env.cmd"
7+
PYTHONUNBUFFERED: 1
8+
EMBEDDED_LIB: 1
9+
OPENSSL_VER: 1.0.2l
10+
PYPI_USER:
11+
secure: 2m0jy6JD/R9RExIosOT6YA==
12+
PYPI_PASS:
13+
secure: x+dF0A8BZUf2IrPNRN1O0w==
14+
matrix:
15+
- PYTHON: "C:\\Python27"
16+
PYTHON_VERSION: "2.7"
17+
PYTHON_ARCH: "32"
18+
MSVC: "Visual Studio 9"
19+
ARCH: i386
20+
21+
- PYTHON: "C:\\Python27-x64"
22+
PYTHON_VERSION: "2.7"
23+
PYTHON_ARCH: "64"
24+
MSVC: "Visual Studio 9"
25+
ARCH: x64_86
26+
27+
- PYTHON: "C:\\Python34"
28+
PYTHON_VERSION: "3.4"
29+
PYTHON_ARCH: "32"
30+
MSVC: "Visual Studio 10"
31+
ARCH: i386
32+
33+
- PYTHON: "C:\\Python34-x64"
34+
PYTHON_VERSION: "3.4"
35+
PYTHON_ARCH: "64"
36+
MSVC: "Visual Studio 10 Win64"
37+
ARCH: x64_86
38+
39+
- PYTHON: "C:\\Python35"
40+
PYTHON_VERSION: "3.5"
41+
PYTHON_ARCH: "32"
42+
MSVC: "Visual Studio 14"
43+
ARCH: i386
44+
45+
- PYTHON: "C:\\Python35-x64"
46+
PYTHON_VERSION: "3.5"
47+
PYTHON_ARCH: "64"
48+
MSVC: "Visual Studio 14 Win64"
49+
ARCH: x64_86
50+
51+
- PYTHON: "C:\\Python36"
52+
PYTHON_VERSION: "3.6"
53+
PYTHON_ARCH: "32"
54+
MSVC: "Visual Studio 14"
55+
ARCH: i386
56+
57+
- PYTHON: "C:\\Python36-x64"
58+
PYTHON_VERSION: "3.6"
59+
PYTHON_ARCH: "64"
60+
MSVC: "Visual Studio 14 Win64"
61+
ARCH: x64_86
62+
63+
install:
64+
# If there is a newer build queued for the same PR, cancel this one.
65+
# The AppVeyor 'rollout builds' option is supposed to serve the same
66+
# purpose but it is problematic because it tends to cancel builds pushed
67+
# directly to master instead of just PR builds (or the converse).
68+
# credits: JuliaLang developers.
69+
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
70+
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
71+
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
72+
throw "There are newer queued builds for this pull request, failing early." }
73+
- ECHO "Installed SDKs:"
74+
- ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""
75+
76+
# Prepend newly installed Python to the PATH of this build (this cannot be
77+
# done from inside the powershell script as it would require to restart
78+
# the parent CMD process).
79+
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
80+
81+
# Check that we have the expected version and architecture for Python
82+
- "python --version"
83+
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
84+
85+
# Upgrade to the latest version of pip to avoid it displaying warnings
86+
# about it being out of date.
87+
# - "pip install --disable-pip-version-check --user --upgrade pip"
88+
89+
# Install the build dependencies of the project. If some dependencies contain
90+
# compiled extensions and are not provided as pre-built wheel packages,
91+
# pip will build them from source using the MSVC compiler matching the
92+
# target Python version and architecture
93+
- "%CMD_IN_ENV% pip install -r requirements_dev.txt"
94+
- "%CMD_IN_ENV% pip install -U wheel setuptools twine"
95+
- git submodule update --init --recursive
96+
97+
# .c files need to be generated on Windows to handle platform
98+
# specific code.
99+
# Fix version used by versioneer to current git tag so the generated .c files
100+
# do not cause a version change.
101+
- python ci/appveyor/fix_version.py .
102+
- mv -f .git .git.bak
103+
- appveyor DownloadFile http://zlib.net/zlib1211.zip
104+
- 7z x zlib1211.zip
105+
- appveyor DownloadFile https://indy.fulgan.com/SSL/openssl-%OPENSSL_VER%-%ARCH%-win%PYTHON_ARCH%.zip
106+
- 7z x openssl-%OPENSSL_VER%-%ARCH%-win%PYTHON_ARCH%.zip
107+
- cp ssleay32.dll ssh2\
108+
- cp libeay32.dll ssh2\
109+
- ps: ls ssh2
110+
111+
build_script:
112+
- "%CMD_IN_ENV% ci\\appveyor\\build_zlib.bat"
113+
- "%CMD_IN_ENV% ci\\appveyor\\build_ssh2.bat"
114+
- rm -f ssh2/*.c
115+
- "%CMD_IN_ENV% python setup.py build"
116+
- "%CMD_IN_ENV% python setup.py build_ext -i"
117+
118+
test_script:
119+
- python -c "from ssh2.session import Session; Session()"
120+
121+
after_test:
122+
# If tests are successful, create binary packages for the project.
123+
- "%CMD_IN_ENV% python setup.py bdist_wheel"
124+
- mv dist/* .
125+
126+
artifacts:
127+
# Archive the generated packages in the ci.appveyor.com build report.
128+
- path: "*.whl"
129+
130+
deploy_script:
131+
- python ci/appveyor/pypi_upload.py *.whl

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.egg-info
2+
*.pyc
3+
dist
4+
build
5+
*~
6+
*.so

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "libssh"]
2+
path = libssh
3+
url = https://git.libssh.org/projects/libssh.git

.travis.yml

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
language: python
2+
cache: pip
3+
notifications:
4+
email: false
5+
sudo: required
6+
services:
7+
- docker
8+
python:
9+
- 2.7
10+
- 3.4
11+
- 3.5
12+
- 3.6
13+
- pypy
14+
addons:
15+
apt:
16+
packages:
17+
- openssh-server
18+
- rpm
19+
- dpkg
20+
- cmake
21+
install:
22+
- pip install flake8 jinja2 sphinx sphinx_rtd_theme
23+
- sudo ci/install-ssh2.sh
24+
- python setup.py build_ext --inplace
25+
- eval "$(ssh-agent -s)"
26+
script:
27+
- export LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu
28+
- nosetests
29+
- flake8 ssh2
30+
- python setup.py sdist
31+
- cd dist; pip install *; cd ..
32+
- 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="

0 commit comments

Comments
 (0)