diff --git a/.appveyor.yml b/.appveyor.yml index fc77fc68..9f689410 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,3 +1,18 @@ +# This file is part of ssh-python. +# Copyright (C) 2017-2022 Panos Kittenis and contributors. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation, version 2.1. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA max_jobs: 5 build: parallel: true @@ -17,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 + PYTHONVERS: C:\Python36-x64 C:\Python37-x64 C:\Python38-x64 C:\Python39-x64 C:\Python310-x64 PYTHON_ARCH: "64" install: diff --git a/.circleci/config.yml b/.circleci/config.yml index c9173950..8dee7b07 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,3 +1,18 @@ +# This file is part of ssh-python. +# Copyright (C) 2017-2021 Panos Kittenis and contributors. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation, version 2.1. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA version: 2.1 orbs: @@ -72,10 +87,10 @@ jobs: command: | twine upload --skip-existing -u $PYPI_USER -p $PYPI_PASSWORD wheels/* - manylinux: + manylinux-x86_64: machine: image: ubuntu-1604:201903-01 - steps: + steps: &manylinux-steps - checkout - run: name: sdist @@ -93,7 +108,8 @@ jobs: - run: name: Deps command: | - sudo apt-get install python-pip + sudo apt-get install python3-pip + pyenv global 3.7.0 || pyenv global 3.9.1 pip install -U pip pip install twine which twine @@ -112,6 +128,12 @@ jobs: command: | twine upload --skip-existing -u $PYPI_USER -p $PYPI_PASSWORD dist/* wheelhouse/* + manylinux2014-aarch64: + machine: + image: ubuntu-2004:202101-01 + resource_class: arm.medium + steps: *manylinux-steps + workflows: version: 2.1 main: @@ -126,19 +148,21 @@ workflows: filters: tags: ignore: /.*/ - - manylinux: + - manylinux-x86_64: &manylinux-wf context: Docker filters: tags: only: /.*/ branches: ignore: /.*/ + - manylinux2014-aarch64: *manylinux-wf - osx: matrix: parameters: xcode_ver: - - "11.6.0" - - "11.1.0" + - "13.1.0" + - "13.0.0" + - "12.5.1" context: Docker filters: tags: diff --git a/_setup_libssh.py b/_setup_libssh.py index e1224146..1f96fa16 100644 --- a/_setup_libssh.py +++ b/_setup_libssh.py @@ -1,3 +1,18 @@ +# This file is part of ssh-python. +# Copyright (C) 2017-2022 Panos Kittenis and contributors. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation, version 2.1. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# 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 diff --git a/ci/build-manylinux.sh b/ci/build-manylinux.sh index ef2a36cf..8b04b342 100755 --- a/ci/build-manylinux.sh +++ b/ci/build-manylinux.sh @@ -1,12 +1,39 @@ #!/bin/bash -xe +# This file is part of ssh-python. +# Copyright (C) 2017-2022 Panos Kittenis and contributors. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation, version 2.1. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + docker_tag="parallelssh/ssh-manylinux" +docker_files=("ci/docker/manylinux/Dockerfile" "ci/docker/manylinux/Dockerfile.2014_x86_64") rm -rf local build ssh/libssh.* ssh/*.so python ci/appveyor/fix_version.py . -docker pull $docker_tag || echo -docker build --pull --cache-from $docker_tag ci/docker/manylinux -t $docker_tag -if [[ -z "$CIRCLE_PR_NUMBER" ]]; then docker push $docker_tag; fi -docker run --rm -v `pwd`:/io $docker_tag /io/ci/build-wheels.sh -ls wheelhouse/ +if [[ $(uname -m) == "aarch64" ]]; then + docker_tag=${docker_tag}:aarch64 + docker_files=("ci/docker/manylinux/Dockerfile.aarch64") +fi + +for docker_file in "${docker_files[@]}"; do + if [[ ${docker_file} == "ci/docker/manylinux/Dockerfile_2014_x86_64" ]]; then + docker_tag="${docker_tag}:2014_x86_64" + fi + docker pull $docker_tag || echo + docker build --pull --cache-from $docker_tag ci/docker/manylinux -t $docker_tag -f ${docker_file} + if [[ -z "${CIRCLE_PULL_REQUEST}" ]]; then docker push $docker_tag; fi + docker run --rm -v "$(pwd)":/io $docker_tag /io/ci/build-wheels.sh + ls wheelhouse/ +done diff --git a/ci/build-wheels.sh b/ci/build-wheels.sh index 304ca7af..8df11faf 100755 --- a/ci/build-wheels.sh +++ b/ci/build-wheels.sh @@ -1,8 +1,24 @@ #!/bin/bash -xe +# This file is part of ssh-python. +# Copyright (C) 2017-2022 Panos Kittenis and contributors. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation, version 2.1. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + # Compile wheels rm -rf /io/build -for PYBIN in `ls -1d /opt/python/*/bin | grep -v cpython`; do +for PYBIN in $(ls -1d /opt/python/*/bin | grep -v cpython); do "${PYBIN}/pip" wheel /io/ -w wheelhouse/ done @@ -12,7 +28,7 @@ for whl in wheelhouse/*.whl; do done # Install packages and test -for PYBIN in `ls -1d /opt/python/*/bin | grep -v cpython`; do +for PYBIN in $(ls -1d /opt/python/*/bin | grep -v cpython); do "${PYBIN}/pip" install ssh-python --no-index -f /io/wheelhouse (cd "$HOME"; "${PYBIN}/python" -c 'from ssh.session import Session; Session()') done diff --git a/ci/build_ssh.sh b/ci/build_ssh.sh index e636dbbf..533f498e 100755 --- a/ci/build_ssh.sh +++ b/ci/build_ssh.sh @@ -1,4 +1,20 @@ #!/bin/bash -xe +# This file is part of ssh-python. +# Copyright (C) 2017-2022 Panos Kittenis and contributors. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation, version 2.1. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + if [ -d /usr/local/opt/openssl ]; then export OPENSSL_ROOT_DIR=/usr/local/opt/openssl diff --git a/ci/docker/manylinux/Dockerfile b/ci/docker/manylinux/Dockerfile index f3fc5cc7..2471acf4 100644 --- a/ci/docker/manylinux/Dockerfile +++ b/ci/docker/manylinux/Dockerfile @@ -2,6 +2,7 @@ FROM quay.io/pypa/manylinux2010_x86_64 ENV OPENSSL openssl-1.1.1g ENV LIBSSH 0.9.6 +ENV KRB 1.18.4 ENV SYSTEM_LIBSSH 1 ENV CFLAGS "-g0 -s" @@ -9,7 +10,7 @@ RUN yum install zlib-devel cmake3 -y ADD libssh-${LIBSSH}.tar.xz libssh.tar.xz ADD https://www.openssl.org/source/${OPENSSL}.tar.gz ${OPENSSL}.tar.gz -ADD krb5-1.18.4.tar.xz krb5-1.18.4.tar.xz +ADD krb5-${KRB}.tar.xz krb5-${KRB}.tar.xz RUN tar -xzf ${OPENSSL}.tar.gz # Openssl @@ -18,7 +19,7 @@ RUN cd ${OPENSSL} && \ make -j6 && make install_sw # Kerberos -RUN cd krb5-1.18.4.tar.xz/krb5-1.18.4/src && \ +RUN cd krb5-${KRB}.tar.xz/krb5-${KRB}/src && \ ./configure && \ make -j6 && \ make install @@ -29,6 +30,6 @@ RUN mkdir -p build_libssh && cd build_libssh && \ -DWITH_GSS_API=ON && \ make -j6 install/strip -RUN rm -rf ${OPENSSL}* libssh build_libssh krb5-1.18.4.tar.xz +RUN rm -rf ${OPENSSL}* libssh build_libssh krb5-${KRB}.tar.xz VOLUME /var/cache diff --git a/ci/docker/manylinux/Dockerfile.2014_x86_64 b/ci/docker/manylinux/Dockerfile.2014_x86_64 new file mode 100644 index 00000000..d3243755 --- /dev/null +++ b/ci/docker/manylinux/Dockerfile.2014_x86_64 @@ -0,0 +1,35 @@ +FROM quay.io/pypa/manylinux2014_x86_64 + +ENV OPENSSL openssl-1.1.1g +ENV LIBSSH 0.9.6 +ENV KRB 1.18.4 +ENV SYSTEM_LIBSSH 1 +ENV CFLAGS "-g0 -s" + +RUN yum install zlib-devel cmake3 -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 + +RUN tar -xzf ${OPENSSL}.tar.gz +# Openssl +RUN cd ${OPENSSL} && \ + ./config --prefix=/usr --openssldir=/usr/openssl threads shared && \ + make -j6 && make install_sw + +# Kerberos +RUN cd krb5-${KRB}.tar.xz/krb5-${KRB}/src && \ + ./configure && \ + make -j6 && \ + make install + +# Libssh +RUN mkdir -p build_libssh && cd build_libssh && \ + cmake3 ../libssh.tar.xz/libssh-${LIBSSH} -DCMAKE_BUILD_TYPE=Release \ + -DWITH_GSS_API=ON && \ + make -j6 install/strip + +RUN rm -rf ${OPENSSL}* libssh build_libssh krb5-${KRB}.tar.xz + +VOLUME /var/cache diff --git a/ci/docker/manylinux/Dockerfile.aarch64 b/ci/docker/manylinux/Dockerfile.aarch64 new file mode 100644 index 00000000..735e7874 --- /dev/null +++ b/ci/docker/manylinux/Dockerfile.aarch64 @@ -0,0 +1,36 @@ +FROM quay.io/pypa/manylinux2014_aarch64 + +ENV OPENSSL openssl-1.1.1g +ENV LIBSSH 0.9.6 +ENV KRB 1.18.4 +ENV SYSTEM_LIBSSH 1 +ENV CFLAGS "-g0 -s" + +RUN yum install epel-release -y +RUN yum install zlib-devel cmake3 -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 + +RUN tar -xzf ${OPENSSL}.tar.gz +# Openssl +RUN cd ${OPENSSL} && \ + ./config --prefix=/usr --openssldir=/usr/openssl threads shared && \ + make -j6 && make install_sw + +# Kerberos +RUN cd krb5-${KRB}.tar.xz/krb5-${KRB}/src && \ + ./configure && \ + make -j6 && \ + make install + +# Libssh +RUN mkdir -p build_libssh && cd build_libssh && \ + cmake3 ../libssh.tar.xz/libssh-${LIBSSH} -DCMAKE_BUILD_TYPE=Release \ + -DWITH_GSS_API=ON && \ + make -j6 install/strip + +RUN rm -rf ${OPENSSL}* libssh build_libssh krb5-${KRB}.tar.xz + +VOLUME /var/cache diff --git a/ci/osx-wheel.sh b/ci/osx-wheel.sh index 537754e4..e525ba0d 100755 --- a/ci/osx-wheel.sh +++ b/ci/osx-wheel.sh @@ -1,4 +1,20 @@ #!/bin/bash -xe +# This file is part of ssh-python. +# Copyright (C) 2017-2022 Panos Kittenis and contributors. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation, version 2.1. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + pip3 install -U virtualenv python3 -m virtualenv -p "$(which python3)" venv @@ -20,7 +36,7 @@ ls -l wheels/*.whl rm -f /usr/local/lib/libssh* pip3 install -v wheels/*.whl pwd; mkdir -p temp; cd temp; pwd -python3 -c "from ssh.session import Session; Session()" && echo "Import successfull" +python3 -c "from ssh.session import Session; Session()" && echo "Import successful" cd ..; pwd set +x deactivate diff --git a/ci/pyenv-wheel.sh b/ci/pyenv-wheel.sh deleted file mode 100755 index 47ba5024..00000000 --- a/ci/pyenv-wheel.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -xe - -brew install pyenv || brew outdated pyenv || brew upgrade pyenv -pyenv install --list - -export PYENV_VERSION=${PYENV:-3.6.4} -if [[ ! -d "$HOME/.pyenv/versions/$PYENV_VERSION" ]]; then - pyenv install $PYENV_VERSION -fi -pyenv global $PYENV_VERSION -pyenv versions - -set +x -eval "$(pyenv init -)" -set -x - -which python -python -m pip install -U virtualenv -python -m virtualenv -p "$(which python)" venv - -set +x -source venv/bin/activate -set -x - -python -V -python -m pip install -U setuptools pip -pip install -U delocate wheel -pip wheel . -cp /usr/local/lib/libssh* . -delocate-listdeps --all *.whl -delocate-wheel -v *.whl -delocate-listdeps --all *.whl - -ls -l *.whl -rm -f *.dylib -pip install -v *.whl -pwd; mkdir -p temp; cd temp; pwd -python -c "from ssh.session import Session; Session()" && echo "Import successfull" -cd ..; pwd -set +x -deactivate -set -x - -mv -f *.whl wheels/ -ls -lh wheels diff --git a/setup.py b/setup.py index c6059a92..fde24df0 100644 --- a/setup.py +++ b/setup.py @@ -65,7 +65,7 @@ runtime_library_dirs = ["$ORIGIN/."] if not SYSTEM_LIBSSH else None _lib_dir = os.path.abspath("./local/lib") if not SYSTEM_LIBSSH else "/usr/local/lib" -include_dirs = ["./local/include"] if (ON_WINDOWS or ON_RTD) or \ +include_dirs = ["./local/include", "./libssh/include"] if (ON_WINDOWS or ON_RTD) or \ not SYSTEM_LIBSSH else ["/usr/local/include"] extensions = [