diff --git a/.environment.yml b/.environment.yml deleted file mode 100644 index 7f9a732a..00000000 --- a/.environment.yml +++ /dev/null @@ -1,8 +0,0 @@ -channels: - - conda-forge -dependencies: - - python - - setuptools - - libssh - - toolchain3 - - cython diff --git a/.readthedocs.yml b/.readthedocs.yml index db9795a9..e5226632 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,4 +1,9 @@ -conda: - file: .environment.yml +version: 2 +build: + apt_packages: + - cmake + - openssl python: - setup_py_install: true + install: + - method: pip + path: . diff --git a/MANIFEST.in b/MANIFEST.in index a7e50d76..6ff18aa4 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -8,5 +8,4 @@ include ssh/*.pyx include ssh/*.pxd include ssh/*.c recursive-include libssh * -include ci/build_ssh.sh include _setup_libssh.py diff --git a/_setup_libssh.py b/_setup_libssh.py index 1f96fa16..81f7ffcd 100644 --- a/_setup_libssh.py +++ b/_setup_libssh.py @@ -41,7 +41,7 @@ def build_ssh(): os.symlink('lib', 'local/lib64') os.chdir('src') - check_call('cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../local -DWITH_GSS_API=ON ../libssh', + check_call('cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../local -DWITH_GSSAPI=ON ../libssh', shell=True, env=os.environ) check_call(['make', '-j%s' % (cpu_count(),), 'all', 'install']) os.chdir('..') diff --git a/ci/build_ssh.sh b/ci/build_ssh.sh deleted file mode 100755 index 533f498e..00000000 --- a/ci/build_ssh.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/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 -fi - -mkdir -p src && cd src -cmake -DCMAKE_BUILD_TYPE=Release -DWITH_GSSAPI=ON ../libssh -make -j6 -cd .. -cp src/src/libssh.so* ssh/ diff --git a/doc/conf.py b/doc/conf.py index 95d8999f..0746768d 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -18,7 +18,7 @@ # -- Project information ----------------------------------------------------- project = 'ssh-python' -copyright = '2020, Panos Kittenis' +copyright = '2022, Panos Kittenis' author = 'Panos Kittenis' @@ -36,8 +36,20 @@ 'sphinx.ext.todo', ] +# Autodoc settings +autodoc_default_flags = ['members'] + # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +# templates_path = ['templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +# source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -52,10 +64,13 @@ # html_theme = 'sphinx_rtd_theme' +# If true, links to the reST sources are added to the pages. +html_show_sourcelink = False + # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +# html_static_path = ['_static'] # -- Extension configuration ------------------------------------------------- @@ -75,19 +90,6 @@ # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = True -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This patterns also effect to html_static_path and html_extra_path -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] - - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'sphinx_rtd_theme' - # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. @@ -121,3 +123,6 @@ htmlhelp_basename = 'ssh-pythondoc' intersphinx_mapping = {'https://docs.python.org/': None} autoclass_content = "both" + +# A list of files that should not be packed into the epub file. +epub_exclude_files = ['search.html'] diff --git a/setup.py b/setup.py index fde24df0..4f204a8f 100644 --- a/setup.py +++ b/setup.py @@ -20,14 +20,13 @@ _PYTHON_MAJOR_VERSION = int(platform.python_version_tuple()[0]) ON_WINDOWS = platform.system() == 'Windows' -ON_RTD = os.environ.get('READTHEDOCS') == 'True' -SYSTEM_LIBSSH = bool(os.environ.get('SYSTEM_LIBSSH', 0)) or \ - ON_RTD or ON_WINDOWS +SYSTEM_LIBSSH = bool(os.environ.get('SYSTEM_LIBSSH', 0)) or ON_WINDOWS if ON_WINDOWS and _PYTHON_MAJOR_VERSION < 3: raise ImportError( "ssh-python requires Python 3 or above on Windows platforms.") + # Only build libssh if SYSTEM_LIBSSH is not set and running a build if not SYSTEM_LIBSSH and (len(sys.argv) >= 2 and not ( '--help' in sys.argv[1:] or @@ -35,6 +34,7 @@ '--help-commands', 'egg_info', '--version', 'clean', 'sdist', '--long-description')) and __name__ == '__main__'): + sys.stdout.write("SYSTEM_LIBSSH is unset, starting embedded libssh build%s" % (os.linesep,)) build_ssh() ext = 'pyx' if USING_CYTHON else 'c' @@ -64,17 +64,20 @@ 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", "./libssh/include"] if (ON_WINDOWS or ON_RTD) or \ - not SYSTEM_LIBSSH else ["/usr/local/include"] +lib_dirs = [os.path.abspath("./local/lib")] if not SYSTEM_LIBSSH else ["/usr/local/lib"] + +include_dirs = ["./local/include", "./libssh/include"] \ + if ON_WINDOWS or not SYSTEM_LIBSSH else ["/usr/local/include"] +sys.stdout.write("Library dirs: %s, runtime dirs: %s, include: %s%s" % + (lib_dirs, runtime_library_dirs, include_dirs, os.linesep)) extensions = [ Extension( sources[i].split('.')[0].replace(os.path.sep, '.'), sources=[sources[i]], include_dirs=include_dirs, libraries=_libs, - library_dirs=[_lib_dir], + library_dirs=lib_dirs, runtime_library_dirs=runtime_library_dirs, extra_compile_args=_comp_args, **cython_args @@ -95,19 +98,7 @@ sys.stdout.write("Cython arguments: %s%s" % (cython_args, os.linesep)) -sys.stdout.write("Windows platform: %s, Python major version: %s.%s" % (ON_WINDOWS, _PYTHON_MAJOR_VERSION, os.sep)) -if ON_WINDOWS and _PYTHON_MAJOR_VERSION == 2: - # Python 2 on Windows builds are unsupported. - extensions = [ - Extension( - 'ssh', - sources=[os.sep.join(['ssh', '__init__.%s' % (ext,)])], - extra_compile_args=_comp_args, - **cython_args - ) - ] - package_data = {} - sys.stdout.write("Windows Python 2 build - %s extensions: %s" % (len(extensions), os.sep)) +sys.stdout.write("Windows platform: %s, Python major version: %s.%s" % (ON_WINDOWS, _PYTHON_MAJOR_VERSION, os.linesep)) setup( name='ssh-python', @@ -117,7 +108,7 @@ license='LGPLv2.1', author='Panos Kittenis', author_email='22e889d8@opayq.com', - description=('libssh C library bindings for Python.'), + description="libssh C library bindings for Python.", long_description=open('README.rst').read(), packages=find_packages( '.', exclude=('embedded_server', 'embedded_server.*', @@ -133,12 +124,12 @@ 'Operating System :: OS Independent', 'Programming Language :: C', 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', 'Topic :: System :: Shells', 'Topic :: System :: Networking', 'Topic :: Software Development :: Libraries', @@ -147,6 +138,7 @@ 'Operating System :: POSIX :: Linux', 'Operating System :: POSIX :: BSD', 'Operating System :: MacOS :: MacOS X', + 'Operating System :: Microsoft :: Windows', ], ext_modules=extensions, package_data=package_data, diff --git a/ssh/session.c b/ssh/session.c index fd932b16..71e605c1 100644 --- a/ssh/session.c +++ b/ssh/session.c @@ -5943,13 +5943,13 @@ static PyObject *__pyx_pf_3ssh_7session_7Session_58options_set(struct __pyx_obj_ * return handle_error_codes(rc, self._session) * * def options_get(self, Option option): # <<<<<<<<<<<<<< - * """Get option value. This function can only be used for string optinos. + * """Get option value. This function can only be used for string options. * For numeric or other options use the individual functions. */ /* Python wrapper */ static PyObject *__pyx_pw_3ssh_7session_7Session_61options_get(PyObject *__pyx_v_self, PyObject *__pyx_v_option); /*proto*/ -static char __pyx_doc_3ssh_7session_7Session_60options_get[] = "Session.options_get(self, Option option)\nGet option value. This function can only be used for string optinos.\n For numeric or other options use the individual functions.\n "; +static char __pyx_doc_3ssh_7session_7Session_60options_get[] = "Session.options_get(self, Option option)\nGet option value. This function can only be used for string options.\n For numeric or other options use the individual functions.\n "; static PyObject *__pyx_pw_3ssh_7session_7Session_61options_get(PyObject *__pyx_v_self, PyObject *__pyx_v_option) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -6118,7 +6118,7 @@ static PyObject *__pyx_pf_3ssh_7session_7Session_60options_get(struct __pyx_obj_ * return handle_error_codes(rc, self._session) * * def options_get(self, Option option): # <<<<<<<<<<<<<< - * """Get option value. This function can only be used for string optinos. + * """Get option value. This function can only be used for string options. * For numeric or other options use the individual functions. */ diff --git a/ssh/session.pyx b/ssh/session.pyx index 9df087ef..383aaa15 100644 --- a/ssh/session.pyx +++ b/ssh/session.pyx @@ -312,7 +312,7 @@ cdef class Session: return handle_error_codes(rc, self._session) def options_get(self, Option option): - """Get option value. This function can only be used for string optinos. + """Get option value. This function can only be used for string options. For numeric or other options use the individual functions. """ cdef char *_value