Skip to content
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
8 changes: 0 additions & 8 deletions .environment.yml

This file was deleted.

11 changes: 8 additions & 3 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
conda:
file: .environment.yml
version: 2
build:
apt_packages:
- cmake
- openssl
python:
setup_py_install: true
install:
- method: pip
path: .
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion _setup_libssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('..')
Expand Down
27 changes: 0 additions & 27 deletions ci/build_ssh.sh

This file was deleted.

37 changes: 21 additions & 16 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# -- Project information -----------------------------------------------------

project = 'ssh-python'
copyright = '2020, Panos Kittenis'
copyright = '2022, Panos Kittenis'
author = 'Panos Kittenis'


Expand All @@ -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.
Expand All @@ -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 -------------------------------------------------
Expand All @@ -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.
Expand Down Expand Up @@ -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']
38 changes: 15 additions & 23 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@

_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
sys.argv[1] in (
'--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'
Expand Down Expand Up @@ -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
Expand All @@ -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',
Expand All @@ -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.*',
Expand All @@ -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',
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions ssh/session.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ssh/session.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down