Skip to content

Commit

Permalink
Libssh2 implementation and OSX/Windows packaging changes (#108)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
pkittenis committed Aug 19, 2020
1 parent cf7b015 commit 44d5617
Show file tree
Hide file tree
Showing 13 changed files with 561 additions and 321 deletions.
52 changes: 22 additions & 30 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
max_jobs: 5
build:
parallel: true
verbosity: minimal
skip_branch_with_pr: true
environment:
global:
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
# /E:ON and /V:ON options are not enabled in the batch script intepreter
# See: http://stackoverflow.com/a/13751649/163740
CMD_IN_ENV: "cmd /E:ON /V:ON /C %APPVEYOR_BUILD_FOLDER%\\ci\\appveyor\\run_with_env.cmd"
PYTHONUNBUFFERED: 1
EMBEDDED_LIB: 1
OPENSSL_VER: 1.1.0h
SYSTEM_LIBSSH2: 1
PYPI_USER:
secure: 2m0jy6JD/R9RExIosOT6YA==
PYPI_PASS:
Expand All @@ -17,21 +18,18 @@ environment:
PYTHON_ARCH: "64"
MSVC: "Visual Studio 14 Win64"
ARCH: x64_86
SYSTEM_LIBSSH2: 1

- PYTHON: "C:\\Python37-x64"
PYTHON_VERSION: "3.7"
PYTHON_ARCH: "64"
MSVC: "Visual Studio 14 Win64"
ARCH: x64_86
SYSTEM_LIBSSH2: 1

- PYTHON: "C:\\Python38-x64"
PYTHON_VERSION: "3.8"
PYTHON_ARCH: "64"
MSVC: "Visual Studio 14 Win64"
ARCH: x64_86
SYSTEM_LIBSSH2: 1

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

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

# Upgrade to the latest version of pip to avoid it displaying warnings
# about it being out of date.
# - "pip install --disable-pip-version-check --user --upgrade pip"

# Install the build dependencies of the project. If some dependencies contain
# compiled extensions and are not provided as pre-built wheel packages,
# pip will build them from source using the MSVC compiler matching the
# target Python version and architecture
- "%CMD_IN_ENV% pip install -r requirements_dev.txt"
- "%CMD_IN_ENV% pip install -U wheel setuptools twine"
- git submodule update --init --recursive
- pip install -U wheel setuptools twine cython

# .c files need to be generated on Windows to handle platform
# specific code.
Expand All @@ -74,17 +66,17 @@ install:
- python ci/appveyor/fix_version.py .
- mv -f .git .git.bak
- 7z x ci\appveyor\zlib1211.zip
- 7z x ci\appveyor\openssl-%OPENSSL_VER%-x%PYTHON_ARCH%-VC2017.zip
- 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\
- 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\
- ps: ls ssh2

build_script:
- "%CMD_IN_ENV% ci\\appveyor\\build_zlib.bat"
- "%CMD_IN_ENV% ci\\appveyor\\build_ssh2.bat"
- ci\\appveyor\\build_zlib.bat
- ci\\appveyor\\build_ssh2.bat
- rm -f ssh2/*.c
- "%CMD_IN_ENV% python setup.py build_ext -I libssh2/include"
- "%CMD_IN_ENV% python setup.py build"
- "%CMD_IN_ENV% python setup.py install"
- python -V
- python setup.py build_ext -I libssh2/include
- python setup.py build
- python setup.py install
- ps: ls ssh2

test_script:
- cd dist
Expand All @@ -93,7 +85,7 @@ test_script:

after_test:
# If tests are successful, create binary packages for the project.
- "%CMD_IN_ENV% python setup.py bdist_wheel "
- python setup.py bdist_wheel
- mv dist/* .

artifacts:
Expand Down
84 changes: 20 additions & 64 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,11 @@ cache:
- "$HOME/.git/lfs"
notifications:
email: false
sudo: required
dist: xenial
services:
- docker
python:
- 2.7
- 3.6
- 3.7
- 3.8
addons:
apt:
packages:
- openssh-server
- rpm
- dpkg
- cmake
install:
- pip install flake8 jinja2 sphinx sphinx_rtd_theme
- python setup.py build_ext --inplace
Expand All @@ -39,31 +28,39 @@ script:
- cd doc
- make html
- cd ..
sudo: required
dist: xenial
services:
- docker
addons:
apt:
packages:
- openssh-server
- rpm
- dpkg
- cmake

jobs:
include:

- stage: test
if: type = push OR \
(type = pull_request AND fork = true)

- &osx-wheels
stage: build packages
if: tag IS present
os: osx
osx_image: xcode11.6
env:
- PYENV: 3.6.11
- SYSTEM_LIBSSH2: 1
before_cache:
- brew cleanup
before_install:
- brew update
- brew install ccache
- brew outdated openssl || travis_wait brew upgrade openssl || echo "y"
- sudo -H pip install twine
- brew install libssh2
- pip3 install twine
- which twine
- sudo ci/install-ssh2.sh
- cp /usr/local/lib/libssh2* .
- mkdir -p wheels
install: skip
script:
- travis_wait ./ci/travis/pyenv-wheel.sh
- ./ci/osx-wheel.sh
after_success:
- if [[ ! -z "$TRAVIS_TAG" ]]; then
twine upload --skip-existing -u $PYPI_U -p $PYPI_P wheels/*.whl;
Expand All @@ -73,50 +70,9 @@ jobs:

- <<: *osx-wheels
osx_image: xcode11.3
env:
- PYENV: 3.6.11
- SYSTEM_LIBSSH2: 1
install: skip
script:
- travis_wait ./ci/travis/pyenv-wheel.sh

- <<: *osx-wheels
osx_image: xcode11.6
env:
- PYENV: 3.7.8
- SYSTEM_LIBSSH2: 1
install: skip
script:
- travis_wait ./ci/travis/pyenv-wheel.sh

- <<: *osx-wheels
osx_image: xcode11.3
env:
- PYENV: 3.7.8
- SYSTEM_LIBSSH2: 1
install: skip
script:
- travis_wait ./ci/travis/pyenv-wheel.sh

- <<: *osx-wheels
osx_image: xcode11.3
env:
- PYENV: 3.8.5
- SYSTEM_LIBSSH2: 1
install: skip
script:
- travis_wait ./ci/travis/pyenv-wheel.sh

- <<: *osx-wheels
osx_image: xcode11.6
env:
- PYENV: 3.8.5
- SYSTEM_LIBSSH2: 1
install: skip
script:
- travis_wait ./ci/travis/pyenv-wheel.sh

- stage: build packages
if: tag IS present
os: linux
python: 3.6
env:
Expand Down
13 changes: 0 additions & 13 deletions ci/appveyor/anaconda_upload.py

This file was deleted.

56 changes: 12 additions & 44 deletions ci/appveyor/build_ssh2.bat
Original file line number Diff line number Diff line change
@@ -1,55 +1,23 @@
mkdir src
cd src

IF "%PYTHON_ARCH%" == "32" (
set OPENSSL_DIR="C:\OpenSSL-v11-Win32"
) ELSE (
set OPENSSL_DIR="C:\OpenSSL-v11-Win64"
ECHO "Building with platform %MSVC%"
cmake ..\libssh2 -G "NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCRYPTO_BACKEND=OpenSSL ^
-G"%MSVC%" ^
-DBUILD_SHARED_LIBS=OFF ^
-DENABLE_ZLIB_COMPRESSION=ON ^
-DENABLE_CRYPT_NONE=ON ^
-DENABLE_MAC_NONE=ON ^
-DZLIB_LIBRARY=C:/zlib/lib/zlib.lib ^
-DZLIB_INCLUDE_DIR=C:/zlib/include ^
-DOPENSSL_ROOT_DIR=%OPENSSL_DIR%
)

ls %OPENSSL_DIR%\lib
ls %OPENSSL_DIR%\lib\VC
ls %OPENSSL_DIR%\lib\VC\static

IF "%MSVC%" == "Visual Studio 9" (
ECHO "Building without platform set"
cmake ..\libssh2 -G "NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCRYPTO_BACKEND=OpenSSL ^
-DBUILD_SHARED_LIBS=OFF ^
-DENABLE_ZLIB_COMPRESSION=ON ^
-DENABLE_CRYPT_NONE=ON ^
-DENABLE_MAC_NONE=ON ^
-DZLIB_LIBRARY=C:/zlib/lib/zlib.lib ^
-DZLIB_INCLUDE_DIR=C:/zlib/include ^
-DOPENSSL_ROOT_DIR=%OPENSSL_DIR%
REM -DOPENSSL_MSVC_STATIC_RT=TRUE
REM -DOPENSSL_USE_STATIC_LIBS=TRUE
) ELSE (
ECHO "Building with platform %MSVC%"
cmake ..\libssh2 -G "NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCRYPTO_BACKEND=OpenSSL ^
-G"%MSVC%" ^
-DBUILD_SHARED_LIBS=OFF ^
-DENABLE_ZLIB_COMPRESSION=ON ^
-DENABLE_CRYPT_NONE=ON ^
-DENABLE_MAC_NONE=ON ^
-DZLIB_LIBRARY=C:/zlib/lib/zlib.lib ^
-DZLIB_INCLUDE_DIR=C:/zlib/include ^
-DOPENSSL_ROOT_DIR=%OPENSSL_DIR%
REM -DOPENSSL_MSVC_STATIC_RT=TRUE
REM -DOPENSSL_USE_STATIC_LIBS=TRUE
)


cp %OPENSSL_DIR%\lib\VC\libcrypto%PYTHON_ARCH%MD.lib %APPVEYOR_BUILD_FOLDER%
cp %OPENSSL_DIR%\lib\VC\libssl%PYTHON_ARCH%MD.lib %APPVEYOR_BUILD_FOLDER%

cmake --build . --config Release
cd ..
ls
ls ssh2
ls src/src
cp src/src/libssh2.lib %PYTHON%/libs/ || cp src/src/Release/libssh2.lib %PYTHON%/libs/
ls %PYTHON%/libs/
3 changes: 0 additions & 3 deletions ci/appveyor/openssl-1.1.0h-x64-VC2017.zip

This file was deleted.

71 changes: 0 additions & 71 deletions ci/appveyor/run_with_env.cmd

This file was deleted.

0 comments on commit 44d5617

Please sign in to comment.