Skip to content

Commit 44d5617

Browse files
authored
Libssh2 implementation and OSX/Windows packaging changes (#108)
Added get and set agent identity path functions. Added agent tests and agent object initialisation from python. Updated OSX wheel building Updated Windows wheel building
1 parent cf7b015 commit 44d5617

13 files changed

+561
-321
lines changed

.appveyor.yml

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
max_jobs: 5
2+
build:
3+
parallel: true
4+
verbosity: minimal
5+
skip_branch_with_pr: true
16
environment:
27
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"
78
PYTHONUNBUFFERED: 1
89
EMBEDDED_LIB: 1
9-
OPENSSL_VER: 1.1.0h
10+
SYSTEM_LIBSSH2: 1
1011
PYPI_USER:
1112
secure: 2m0jy6JD/R9RExIosOT6YA==
1213
PYPI_PASS:
@@ -17,21 +18,18 @@ environment:
1718
PYTHON_ARCH: "64"
1819
MSVC: "Visual Studio 14 Win64"
1920
ARCH: x64_86
20-
SYSTEM_LIBSSH2: 1
2121

2222
- PYTHON: "C:\\Python37-x64"
2323
PYTHON_VERSION: "3.7"
2424
PYTHON_ARCH: "64"
2525
MSVC: "Visual Studio 14 Win64"
2626
ARCH: x64_86
27-
SYSTEM_LIBSSH2: 1
2827

2928
- PYTHON: "C:\\Python38-x64"
3029
PYTHON_VERSION: "3.8"
3130
PYTHON_ARCH: "64"
3231
MSVC: "Visual Studio 14 Win64"
3332
ARCH: x64_86
34-
SYSTEM_LIBSSH2: 1
3533

3634
install:
3735
# If there is a newer build queued for the same PR, cancel this one.
@@ -43,8 +41,12 @@ install:
4341
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
4442
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
4543
throw "There are newer queued builds for this pull request, failing early." }
46-
- ECHO "Installed SDKs:"
47-
- ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""
44+
- set OPENSSL_DIR="C:\OpenSSL-v11-Win%PYTHON_ARCH%"
45+
- set VCLIBDIR=%WINDIR%\System32
46+
- cp %VCLIBDIR%/vcruntime*.dll ssh2/
47+
- cp %VCLIBDIR%/msvcp*.dll ssh2/
48+
- cp %VCLIBDIR%/msvcr*.dll ssh2/
49+
- cp %OPENSSL_DIR%/bin/*.dll ssh2/
4850

4951
# Prepend newly installed Python to the PATH of this build (this cannot be
5052
# done from inside the powershell script as it would require to restart
@@ -55,17 +57,7 @@ install:
5557
- "python --version"
5658
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
5759

58-
# Upgrade to the latest version of pip to avoid it displaying warnings
59-
# about it being out of date.
60-
# - "pip install --disable-pip-version-check --user --upgrade pip"
61-
62-
# Install the build dependencies of the project. If some dependencies contain
63-
# compiled extensions and are not provided as pre-built wheel packages,
64-
# pip will build them from source using the MSVC compiler matching the
65-
# target Python version and architecture
66-
- "%CMD_IN_ENV% pip install -r requirements_dev.txt"
67-
- "%CMD_IN_ENV% pip install -U wheel setuptools twine"
68-
- git submodule update --init --recursive
60+
- pip install -U wheel setuptools twine cython
6961

7062
# .c files need to be generated on Windows to handle platform
7163
# specific code.
@@ -74,17 +66,17 @@ install:
7466
- python ci/appveyor/fix_version.py .
7567
- mv -f .git .git.bak
7668
- 7z x ci\appveyor\zlib1211.zip
77-
- 7z x ci\appveyor\openssl-%OPENSSL_VER%-x%PYTHON_ARCH%-VC2017.zip
78-
- cp openssl-%OPENSSL_VER%-x%PYTHON_ARCH%-VC2017\libssl-1_1-x%PYTHON_ARCH%.dll ssh2\ || cp openssl-%OPENSSL_VER%-x%PYTHON_ARCH%-VC2017\libssl-1_1.dll ssh2\
79-
- cp openssl-%OPENSSL_VER%-x%PYTHON_ARCH%-VC2017\libcrypto-1_1-x%PYTHON_ARCH%.dll ssh2\ || cp openssl-%OPENSSL_VER%-x%PYTHON_ARCH%-VC2017\libcrypto-1_1.dll ssh2\
8069
- ps: ls ssh2
70+
8171
build_script:
82-
- "%CMD_IN_ENV% ci\\appveyor\\build_zlib.bat"
83-
- "%CMD_IN_ENV% ci\\appveyor\\build_ssh2.bat"
72+
- ci\\appveyor\\build_zlib.bat
73+
- ci\\appveyor\\build_ssh2.bat
8474
- rm -f ssh2/*.c
85-
- "%CMD_IN_ENV% python setup.py build_ext -I libssh2/include"
86-
- "%CMD_IN_ENV% python setup.py build"
87-
- "%CMD_IN_ENV% python setup.py install"
75+
- python -V
76+
- python setup.py build_ext -I libssh2/include
77+
- python setup.py build
78+
- python setup.py install
79+
- ps: ls ssh2
8880

8981
test_script:
9082
- cd dist
@@ -93,7 +85,7 @@ test_script:
9385

9486
after_test:
9587
# If tests are successful, create binary packages for the project.
96-
- "%CMD_IN_ENV% python setup.py bdist_wheel "
88+
- python setup.py bdist_wheel
9789
- mv dist/* .
9890

9991
artifacts:

.travis.yml

Lines changed: 20 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,11 @@ cache:
77
- "$HOME/.git/lfs"
88
notifications:
99
email: false
10-
sudo: required
11-
dist: xenial
12-
services:
13-
- docker
1410
python:
1511
- 2.7
1612
- 3.6
1713
- 3.7
1814
- 3.8
19-
addons:
20-
apt:
21-
packages:
22-
- openssh-server
23-
- rpm
24-
- dpkg
25-
- cmake
2615
install:
2716
- pip install flake8 jinja2 sphinx sphinx_rtd_theme
2817
- python setup.py build_ext --inplace
@@ -39,31 +28,39 @@ script:
3928
- cd doc
4029
- make html
4130
- cd ..
31+
sudo: required
32+
dist: xenial
33+
services:
34+
- docker
35+
addons:
36+
apt:
37+
packages:
38+
- openssh-server
39+
- rpm
40+
- dpkg
41+
- cmake
4242

4343
jobs:
4444
include:
4545

46+
- stage: test
47+
if: type = push OR \
48+
(type = pull_request AND fork = true)
49+
4650
- &osx-wheels
4751
stage: build packages
52+
if: tag IS present
4853
os: osx
4954
osx_image: xcode11.6
5055
env:
51-
- PYENV: 3.6.11
5256
- SYSTEM_LIBSSH2: 1
53-
before_cache:
54-
- brew cleanup
5557
before_install:
56-
- brew update
57-
- brew install ccache
58-
- brew outdated openssl || travis_wait brew upgrade openssl || echo "y"
59-
- sudo -H pip install twine
58+
- brew install libssh2
59+
- pip3 install twine
6060
- which twine
61-
- sudo ci/install-ssh2.sh
62-
- cp /usr/local/lib/libssh2* .
63-
- mkdir -p wheels
6461
install: skip
6562
script:
66-
- travis_wait ./ci/travis/pyenv-wheel.sh
63+
- ./ci/osx-wheel.sh
6764
after_success:
6865
- if [[ ! -z "$TRAVIS_TAG" ]]; then
6966
twine upload --skip-existing -u $PYPI_U -p $PYPI_P wheels/*.whl;
@@ -73,50 +70,9 @@ jobs:
7370

7471
- <<: *osx-wheels
7572
osx_image: xcode11.3
76-
env:
77-
- PYENV: 3.6.11
78-
- SYSTEM_LIBSSH2: 1
79-
install: skip
80-
script:
81-
- travis_wait ./ci/travis/pyenv-wheel.sh
82-
83-
- <<: *osx-wheels
84-
osx_image: xcode11.6
85-
env:
86-
- PYENV: 3.7.8
87-
- SYSTEM_LIBSSH2: 1
88-
install: skip
89-
script:
90-
- travis_wait ./ci/travis/pyenv-wheel.sh
91-
92-
- <<: *osx-wheels
93-
osx_image: xcode11.3
94-
env:
95-
- PYENV: 3.7.8
96-
- SYSTEM_LIBSSH2: 1
97-
install: skip
98-
script:
99-
- travis_wait ./ci/travis/pyenv-wheel.sh
100-
101-
- <<: *osx-wheels
102-
osx_image: xcode11.3
103-
env:
104-
- PYENV: 3.8.5
105-
- SYSTEM_LIBSSH2: 1
106-
install: skip
107-
script:
108-
- travis_wait ./ci/travis/pyenv-wheel.sh
109-
110-
- <<: *osx-wheels
111-
osx_image: xcode11.6
112-
env:
113-
- PYENV: 3.8.5
114-
- SYSTEM_LIBSSH2: 1
115-
install: skip
116-
script:
117-
- travis_wait ./ci/travis/pyenv-wheel.sh
11873

11974
- stage: build packages
75+
if: tag IS present
12076
os: linux
12177
python: 3.6
12278
env:

ci/appveyor/anaconda_upload.py

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

ci/appveyor/build_ssh2.bat

Lines changed: 12 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,23 @@
11
mkdir src
22
cd src
33

4-
IF "%PYTHON_ARCH%" == "32" (
5-
set OPENSSL_DIR="C:\OpenSSL-v11-Win32"
6-
) ELSE (
7-
set OPENSSL_DIR="C:\OpenSSL-v11-Win64"
4+
ECHO "Building with platform %MSVC%"
5+
cmake ..\libssh2 -G "NMake Makefiles" ^
6+
-DCMAKE_BUILD_TYPE=Release ^
7+
-DCRYPTO_BACKEND=OpenSSL ^
8+
-G"%MSVC%" ^
9+
-DBUILD_SHARED_LIBS=OFF ^
10+
-DENABLE_ZLIB_COMPRESSION=ON ^
11+
-DENABLE_CRYPT_NONE=ON ^
12+
-DENABLE_MAC_NONE=ON ^
13+
-DZLIB_LIBRARY=C:/zlib/lib/zlib.lib ^
14+
-DZLIB_INCLUDE_DIR=C:/zlib/include ^
15+
-DOPENSSL_ROOT_DIR=%OPENSSL_DIR%
816
)
917

10-
ls %OPENSSL_DIR%\lib
11-
ls %OPENSSL_DIR%\lib\VC
12-
ls %OPENSSL_DIR%\lib\VC\static
13-
14-
IF "%MSVC%" == "Visual Studio 9" (
15-
ECHO "Building without platform set"
16-
cmake ..\libssh2 -G "NMake Makefiles" ^
17-
-DCMAKE_BUILD_TYPE=Release ^
18-
-DCRYPTO_BACKEND=OpenSSL ^
19-
-DBUILD_SHARED_LIBS=OFF ^
20-
-DENABLE_ZLIB_COMPRESSION=ON ^
21-
-DENABLE_CRYPT_NONE=ON ^
22-
-DENABLE_MAC_NONE=ON ^
23-
-DZLIB_LIBRARY=C:/zlib/lib/zlib.lib ^
24-
-DZLIB_INCLUDE_DIR=C:/zlib/include ^
25-
-DOPENSSL_ROOT_DIR=%OPENSSL_DIR%
26-
REM -DOPENSSL_MSVC_STATIC_RT=TRUE
27-
REM -DOPENSSL_USE_STATIC_LIBS=TRUE
28-
) ELSE (
29-
ECHO "Building with platform %MSVC%"
30-
cmake ..\libssh2 -G "NMake Makefiles" ^
31-
-DCMAKE_BUILD_TYPE=Release ^
32-
-DCRYPTO_BACKEND=OpenSSL ^
33-
-G"%MSVC%" ^
34-
-DBUILD_SHARED_LIBS=OFF ^
35-
-DENABLE_ZLIB_COMPRESSION=ON ^
36-
-DENABLE_CRYPT_NONE=ON ^
37-
-DENABLE_MAC_NONE=ON ^
38-
-DZLIB_LIBRARY=C:/zlib/lib/zlib.lib ^
39-
-DZLIB_INCLUDE_DIR=C:/zlib/include ^
40-
-DOPENSSL_ROOT_DIR=%OPENSSL_DIR%
41-
REM -DOPENSSL_MSVC_STATIC_RT=TRUE
42-
REM -DOPENSSL_USE_STATIC_LIBS=TRUE
43-
)
44-
45-
4618
cp %OPENSSL_DIR%\lib\VC\libcrypto%PYTHON_ARCH%MD.lib %APPVEYOR_BUILD_FOLDER%
4719
cp %OPENSSL_DIR%\lib\VC\libssl%PYTHON_ARCH%MD.lib %APPVEYOR_BUILD_FOLDER%
4820

4921
cmake --build . --config Release
5022
cd ..
51-
ls
52-
ls ssh2
53-
ls src/src
5423
cp src/src/libssh2.lib %PYTHON%/libs/ || cp src/src/Release/libssh2.lib %PYTHON%/libs/
55-
ls %PYTHON%/libs/

ci/appveyor/openssl-1.1.0h-x64-VC2017.zip

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

ci/appveyor/run_with_env.cmd

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

0 commit comments

Comments
 (0)