Skip to content

Updates #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ environment:
PYTHON_DEF: "C:\\Python38-x64"
PYTHON_VERSION: "3.8"
# Python versions to build wheels for
PYTHONVERS: C:\Python36-x64 C:\Python37-x64 C:\Python38-x64 C:\Python39-x64 C:\Python310-x64 C:\Python311-x64
PYTHONVERS: C:\Python38-x64 C:\Python39-x64 C:\Python310-x64 C:\Python311-x64 C:\Python312-x64
PYTHON_ARCH: "64"

install:
Expand All @@ -45,7 +45,7 @@ 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." }
- set OPENSSL_DIR="C:\OpenSSL-v11-Win%PYTHON_ARCH%"
- set OPENSSL_DIR="C:\OpenSSL-v34-Win64"
- set VCLIBDIR=%WINDIR%\System32
- cp %VCLIBDIR%/vcruntime140.dll ssh/
- cp %VCLIBDIR%/msvcr120.dll ssh/
Expand All @@ -65,10 +65,13 @@ install:
# - msiexec /i kfw-4.1-amd64.msi /passive /qn
# - ps: ls "C:\Program Files\MIT\Kerberos\"
# - cp "C:\Program Files\MIT\Kerberos\*.dll" ssh/
- ps: ls ssh/*.dll
- ps: ls ssh
- ps: ls

build_script:
- for %%I in (%PYTHONVERS%) do cp %OPENSSL_DIR%/lib/VC/x64/MD/libcrypto.lib %%I/libs/libcrypto64MD.lib
- for %%I in (%PYTHONVERS%) do cp %OPENSSL_DIR%/lib/VC/x64/MD/libssl.lib %%I/libs/libssl64MD.lib
- ci\\appveyor\\build_zlib.bat
- for %%I in (%PYTHONVERS%) do cp C:/zlib/lib/zlibstatic.lib %%I/libs/
- for %%I in (%PYTHONVERS%) do ls %%I/libs/
Expand Down
53 changes: 30 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,56 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
version: 2.1

orbs:
python: circleci/python@2.1.1

jobs:
python_test:
parameters:
python_ver:
type: string
default: "3.9"
default: "3.10"
docker:
- image: cimg/python:<< parameters.python_ver >>
steps:
- checkout
- python/install-packages:
pip-dependency-file: requirements_dev.txt
pkg-manager: pip
- run:
name: Deps
command: |
sudo apt-get update
sudo apt-get install cmake openssh-server
pip install -r requirements_dev.txt
- run:
command: |
pip uninstall -y cython
pip install -e .
eval "$(ssh-agent -s)"
name: Build
- run:
command: |
set -x
ls -lhtr ssh/
pwd
ldd -r ssh/session*.so
pytest tests
name: Test
- run:
command: |
pytest ci/integration_tests
name: Integration
- run:
command: |
flake8 ssh
name: Flake
- run:
command: |
python setup.py sdist
cd dist; pip install *; cd ..
cd dist
pip install *
python -c 'from ssh.session import Session; Session()'
cd ..
name: Sdist Install
- run:
command: |
cd doc
make html
cd ..
name: Test
name: Docs

osx:
parameters:
Expand All @@ -71,6 +81,8 @@ jobs:
name: deps
command: |
brew install cmake git-lfs krb5 python libssh
brew link --force openssl
brew link --force libssh2
pip3 install twine
which twine
- run:
Expand All @@ -86,15 +98,9 @@ jobs:

manylinux-x86_64:
machine:
image: ubuntu-2004:202201-02
image: ubuntu-2004:current
steps: &manylinux-steps
- checkout
- run:
name: sdist
command: python setup.py sdist
- python/install-packages:
pip-dependency-file: requirements_dev.txt
pkg-manager: pip
- run:
name: Git LFS
command: |
Expand All @@ -106,7 +112,7 @@ jobs:
name: Deps
command: |
sudo apt-get install python3-pip
pip install -U pip
pip install -U pip setuptools
pip install twine
which twine
which python3
Expand All @@ -129,7 +135,7 @@ jobs:

manylinux-aarch64:
machine:
image: ubuntu-2004:202101-01
image: ubuntu-2004:current
resource_class: arm.medium
steps: *manylinux-steps

Expand All @@ -141,10 +147,10 @@ workflows:
matrix:
parameters:
python_ver:
- "3.6"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
filters:
tags:
ignore: /.*/
Expand All @@ -161,7 +167,8 @@ workflows:
parameters:
xcode_ver:
- "14.0.0"
- "13.1.0"
- "15.0.0"
- "16.0.0"
context: Docker
filters:
tags:
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.rpm filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
ssh/_version.py export-subst
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
libssh/compile_commands.json
/wheelhouse
/.idea
/tests/unit_test_cert_key-cert.pub
/ci/integration_tests/unit_test_cert_key-cert.pub
/doc/_build
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
recursive-exclude docker *
recursive-exclude ci *
include versioneer.py
include ssh/_version.py
exclude .travis.yml
Expand Down
9 changes: 5 additions & 4 deletions _setup_libssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import os

from sys import stderr
from subprocess import check_call
from glob import glob
from shutil import copy2
from multiprocessing import cpu_count
from shutil import copy2
from subprocess import check_call
from sys import stderr


def build_ssh():
Expand All @@ -28,6 +27,8 @@ def build_ssh():
return
if os.path.exists('/usr/local/opt/openssl'):
os.environ['OPENSSL_ROOT_DIR'] = '/usr/local/opt/openssl'
if os.path.exists('/opt/homebrew/opt/openssl'):
os.environ['OPENSSL_ROOT_DIR'] = '/opt/homebrew/opt/openssl'

if not os.path.exists('src'):
os.mkdir('src')
Expand Down
5 changes: 3 additions & 2 deletions ci/appveyor/build_ssh.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ cmake ..\libssh ^
-DOPENSSL_ROOT_DIR=%OPENSSL_DIR%


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%
dir %OPENSSL_DIR%\lib\VC\x64\MD\
cp %OPENSSL_DIR%\lib\VC\x64\MD\libcrypto.lib %APPVEYOR_BUILD_FOLDER%\libcrypto64MD.lib
cp %OPENSSL_DIR%\lib\VC\x64\MD\libssl.lib %APPVEYOR_BUILD_FOLDER%\libssl64MD.lib

cmake --build . --config Release
cmake --install . --prefix ../local
Expand Down
4 changes: 3 additions & 1 deletion ci/appveyor/fix_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import json
import sys


def get_describe_tag():
return subprocess.check_output(['git', 'describe', '--tags']).strip().decode('utf-8')
return subprocess.check_output(['git', 'describe', '--tags']).strip().decode('utf-8').split('-')[0]


def make_version_file(basedir):
rev = os.environ.get('APPVEYOR_REPO_COMMIT',
Expand Down
2 changes: 1 addition & 1 deletion ci/build-manylinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if [[ $(uname -m) == "aarch64" ]]; then
fi

for docker_file in "${docker_files[@]}"; do
if [[ ${docker_file} == "ci/docker/manylinux/Dockerfile_2014_x86_64" ]]; then
if [[ ${docker_file} == "ci/docker/manylinux/Dockerfile.2014_x86_64" ]]; then
docker_tag="${docker_repo}:2014_x86_64"
elif [[ ${docker_file} == "ci/docker/manylinux/Dockerfile" ]]; then
docker_tag="${docker_repo}:2010_x86_64"
Expand Down
11 changes: 7 additions & 4 deletions ci/build-wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
rm -rf /io/build
# For testing
#for PYBIN in $(ls -1d /opt/python/cp310-cp310/bin | grep -v cpython); do
for PYBIN in $(ls -1d /opt/python/*/bin | grep -v cpython); do
for PYBIN in $(ls -1d /opt/python/*/bin | grep -v cpython | grep -v cp313t); do
echo "Building for Python binary ${PYBIN}"
"${PYBIN}/pip" wheel /io/ -w wheelhouse/
done

Expand All @@ -29,8 +30,10 @@ for whl in wheelhouse/*.whl; do
done

# Install packages and test
#for PYBIN in $(ls -1d /opt/python/cp310-cp310/bin | grep -v cpython); do
for PYBIN in $(ls -1d /opt/python/*/bin | grep -v cpython); do
for PYBIN in $(ls -1d /opt/python/*/bin | grep -v cpython | grep -v cp313t); do
# for PYBIN in `ls -1d /opt/python/cp310-cp310/bin | grep -v cpython`; do
echo "Installing for Python binary ${PYBIN}"
"${PYBIN}/pip" install ssh-python --no-index -f /io/wheelhouse
(cd "$HOME"; "${PYBIN}/python" -c 'from ssh.session import Session; Session()')
(cd "$HOME"; "${PYBIN}/python" -c 'from ssh.session import Session; Session()' &&
echo "Import sanity check succeeded.")
done
25 changes: 19 additions & 6 deletions ci/docker/manylinux/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
FROM quay.io/pypa/manylinux2010_x86_64

ENV OPENSSL openssl-1.1.1q
ENV LIBSSH 0.10.4
ENV KRB 1.18.4
ENV OPENSSL openssl-3.4.0
ENV LIBSSH 0.11.1
ENV KRB 1.21.3
ENV CMAKE 3.31.3
ENV SYSTEM_LIBSSH 1
ENV CFLAGS "-g0 -s"

RUN yum install zlib-devel cmake3 -y
RUN yum install zlib-devel cmake3 perl-IPC-Cmd -y

ADD libssh-${LIBSSH}.tar.xz libssh.tar.xz
ADD https://www.openssl.org/source/${OPENSSL}.tar.gz ${OPENSSL}.tar.gz
ADD krb5-${KRB}.tar.xz krb5-${KRB}.tar.xz
ADD cmake-${CMAKE}.tar.xz cmake-${CMAKE}.tar.xz

RUN tar -xzf ${OPENSSL}.tar.gz

# Openssl
RUN cd ${OPENSSL} && \
./config --prefix=/usr --openssldir=/usr/openssl threads shared && \
make -j6 && make install_sw


# CMake - Krb dependency
RUN cd cmake-${CMAKE}.tar.xz/cmake-${CMAKE} && \
./bootstrap --prefix=/usr && \
make && \
make install


RUN yum remove cmake3 -y

# Kerberos
RUN cd krb5-${KRB}.tar.xz/krb5-${KRB}/src && \
./configure && \
Expand All @@ -26,10 +39,10 @@ RUN cd krb5-${KRB}.tar.xz/krb5-${KRB}/src && \

# Libssh
RUN mkdir -p build_libssh && cd build_libssh && \
cmake3 ../libssh.tar.xz/libssh-${LIBSSH} -DCMAKE_BUILD_TYPE=Release \
cmake ../libssh.tar.xz/libssh-${LIBSSH} -DCMAKE_BUILD_TYPE=Release \
-DWITH_GSSAPI=ON -DWITH_EXAMPLES=OFF && \
make -j6 install/strip

RUN rm -rf ${OPENSSL}* libssh build_libssh krb5-${KRB}.tar.xz
RUN rm -rf ${OPENSSL}* libssh build_libssh krb5-${KRB}.tar.xz cmake-${CMAKE}.tar.xz

VOLUME /var/cache
8 changes: 4 additions & 4 deletions ci/docker/manylinux/Dockerfile.2014_x86_64
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM quay.io/pypa/manylinux2014_x86_64

ENV OPENSSL openssl-1.1.1q
ENV LIBSSH 0.10.4
ENV KRB 1.18.4
ENV OPENSSL openssl-3.4.0
ENV LIBSSH 0.11.1
ENV KRB 1.21.3
ENV SYSTEM_LIBSSH 1
ENV CFLAGS "-g0 -s"

RUN yum install zlib-devel cmake3 -y
RUN yum install zlib-devel cmake3 perl-IPC-Cmd -y

ADD libssh-${LIBSSH}.tar.xz libssh.tar.xz
ADD https://www.openssl.org/source/${OPENSSL}.tar.gz ${OPENSSL}.tar.gz
Expand Down
8 changes: 4 additions & 4 deletions ci/docker/manylinux/Dockerfile.aarch64
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM quay.io/pypa/manylinux2014_aarch64

ENV OPENSSL openssl-1.1.1q
ENV LIBSSH 0.10.4
ENV KRB 1.18.4
ENV OPENSSL openssl-3.4.0
ENV LIBSSH 0.11.1
ENV KRB 1.21.3
ENV SYSTEM_LIBSSH 1
ENV CFLAGS "-g0 -s"

RUN yum install epel-release -y && yum install zlib-devel cmake3 -y
RUN yum install epel-release -y && yum install zlib-devel cmake3 perl-IPC-Cmd -y

ADD libssh-${LIBSSH}.tar.xz libssh.tar.xz
ADD https://www.openssl.org/source/${OPENSSL}.tar.gz ${OPENSSL}.tar.gz
Expand Down
3 changes: 3 additions & 0 deletions ci/docker/manylinux/cmake-3.31.3.tar.xz
Git LFS file not shown
3 changes: 0 additions & 3 deletions ci/docker/manylinux/krb5-1.18.4.tar.xz

This file was deleted.

3 changes: 3 additions & 0 deletions ci/docker/manylinux/krb5-1.21.3.tar.xz
Git LFS file not shown
3 changes: 0 additions & 3 deletions ci/docker/manylinux/libssh-0.10.4.tar.xz

This file was deleted.

16 changes: 0 additions & 16 deletions ci/docker/manylinux/libssh-0.10.4.tar.xz.asc

This file was deleted.

3 changes: 3 additions & 0 deletions ci/docker/manylinux/libssh-0.11.1.tar.xz
Git LFS file not shown
Loading