Skip to content

Commit 16671a7

Browse files
authored
Fix readthedocs builds (#52)
* Updated rtd configuration - resolves #51 * Updated sphinx configuration, docstrings * Cleanup setup.py
1 parent 0a3984f commit 16671a7

File tree

9 files changed

+49
-83
lines changed

9 files changed

+49
-83
lines changed

.environment.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.readthedocs.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
conda:
2-
file: .environment.yml
1+
version: 2
2+
build:
3+
apt_packages:
4+
- cmake
5+
- openssl
36
python:
4-
setup_py_install: true
7+
install:
8+
- method: pip
9+
path: .

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ include ssh/*.pyx
88
include ssh/*.pxd
99
include ssh/*.c
1010
recursive-include libssh *
11-
include ci/build_ssh.sh
1211
include _setup_libssh.py

_setup_libssh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def build_ssh():
4141
os.symlink('lib', 'local/lib64')
4242

4343
os.chdir('src')
44-
check_call('cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../local -DWITH_GSS_API=ON ../libssh',
44+
check_call('cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../local -DWITH_GSSAPI=ON ../libssh',
4545
shell=True, env=os.environ)
4646
check_call(['make', '-j%s' % (cpu_count(),), 'all', 'install'])
4747
os.chdir('..')

ci/build_ssh.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

doc/conf.py

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# -- Project information -----------------------------------------------------
1919

2020
project = 'ssh-python'
21-
copyright = '2020, Panos Kittenis'
21+
copyright = '2022, Panos Kittenis'
2222
author = 'Panos Kittenis'
2323

2424

@@ -36,8 +36,20 @@
3636
'sphinx.ext.todo',
3737
]
3838

39+
# Autodoc settings
40+
autodoc_default_flags = ['members']
41+
3942
# Add any paths that contain templates here, relative to this directory.
40-
templates_path = ['_templates']
43+
# templates_path = ['templates']
44+
45+
# The suffix of source filenames.
46+
source_suffix = '.rst'
47+
48+
# The encoding of source files.
49+
# source_encoding = 'utf-8-sig'
50+
51+
# The master toctree document.
52+
master_doc = 'index'
4153

4254
# List of patterns, relative to source directory, that match files and
4355
# directories to ignore when looking for source files.
@@ -52,10 +64,13 @@
5264
#
5365
html_theme = 'sphinx_rtd_theme'
5466

67+
# If true, links to the reST sources are added to the pages.
68+
html_show_sourcelink = False
69+
5570
# Add any paths that contain custom static files (such as style sheets) here,
5671
# relative to this directory. They are copied after the builtin static files,
5772
# so a file named "default.css" will overwrite the builtin "default.css".
58-
html_static_path = ['_static']
73+
# html_static_path = ['_static']
5974

6075

6176
# -- Extension configuration -------------------------------------------------
@@ -75,19 +90,6 @@
7590
# If true, `todo` and `todoList` produce output, else they produce nothing.
7691
todo_include_todos = True
7792

78-
# List of patterns, relative to source directory, that match files and
79-
# directories to ignore when looking for source files.
80-
# This patterns also effect to html_static_path and html_extra_path
81-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
82-
83-
84-
# -- Options for HTML output ----------------------------------------------
85-
86-
# The theme to use for HTML and HTML Help pages. See the documentation for
87-
# a list of builtin themes.
88-
#
89-
html_theme = 'sphinx_rtd_theme'
90-
9193
# Theme options are theme-specific and customize the look and feel of a theme
9294
# further. For a list of options available for each theme, see the
9395
# documentation.
@@ -121,3 +123,6 @@
121123
htmlhelp_basename = 'ssh-pythondoc'
122124
intersphinx_mapping = {'https://docs.python.org/': None}
123125
autoclass_content = "both"
126+
127+
# A list of files that should not be packed into the epub file.
128+
epub_exclude_files = ['search.html']

setup.py

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@
2020

2121
_PYTHON_MAJOR_VERSION = int(platform.python_version_tuple()[0])
2222
ON_WINDOWS = platform.system() == 'Windows'
23-
ON_RTD = os.environ.get('READTHEDOCS') == 'True'
24-
SYSTEM_LIBSSH = bool(os.environ.get('SYSTEM_LIBSSH', 0)) or \
25-
ON_RTD or ON_WINDOWS
23+
SYSTEM_LIBSSH = bool(os.environ.get('SYSTEM_LIBSSH', 0)) or ON_WINDOWS
2624

2725
if ON_WINDOWS and _PYTHON_MAJOR_VERSION < 3:
2826
raise ImportError(
2927
"ssh-python requires Python 3 or above on Windows platforms.")
3028

29+
3130
# Only build libssh if SYSTEM_LIBSSH is not set and running a build
3231
if not SYSTEM_LIBSSH and (len(sys.argv) >= 2 and not (
3332
'--help' in sys.argv[1:] or
3433
sys.argv[1] in (
3534
'--help-commands', 'egg_info', '--version', 'clean',
3635
'sdist', '--long-description')) and
3736
__name__ == '__main__'):
37+
sys.stdout.write("SYSTEM_LIBSSH is unset, starting embedded libssh build%s" % (os.linesep,))
3838
build_ssh()
3939

4040
ext = 'pyx' if USING_CYTHON else 'c'
@@ -64,17 +64,20 @@
6464

6565

6666
runtime_library_dirs = ["$ORIGIN/."] if not SYSTEM_LIBSSH else None
67-
_lib_dir = os.path.abspath("./local/lib") if not SYSTEM_LIBSSH else "/usr/local/lib"
68-
include_dirs = ["./local/include", "./libssh/include"] if (ON_WINDOWS or ON_RTD) or \
69-
not SYSTEM_LIBSSH else ["/usr/local/include"]
67+
lib_dirs = [os.path.abspath("./local/lib")] if not SYSTEM_LIBSSH else ["/usr/local/lib"]
68+
69+
include_dirs = ["./local/include", "./libssh/include"] \
70+
if ON_WINDOWS or not SYSTEM_LIBSSH else ["/usr/local/include"]
7071

72+
sys.stdout.write("Library dirs: %s, runtime dirs: %s, include: %s%s" %
73+
(lib_dirs, runtime_library_dirs, include_dirs, os.linesep))
7174
extensions = [
7275
Extension(
7376
sources[i].split('.')[0].replace(os.path.sep, '.'),
7477
sources=[sources[i]],
7578
include_dirs=include_dirs,
7679
libraries=_libs,
77-
library_dirs=[_lib_dir],
80+
library_dirs=lib_dirs,
7881
runtime_library_dirs=runtime_library_dirs,
7982
extra_compile_args=_comp_args,
8083
**cython_args
@@ -95,19 +98,7 @@
9598
sys.stdout.write("Cython arguments: %s%s" % (cython_args, os.linesep))
9699

97100

98-
sys.stdout.write("Windows platform: %s, Python major version: %s.%s" % (ON_WINDOWS, _PYTHON_MAJOR_VERSION, os.sep))
99-
if ON_WINDOWS and _PYTHON_MAJOR_VERSION == 2:
100-
# Python 2 on Windows builds are unsupported.
101-
extensions = [
102-
Extension(
103-
'ssh',
104-
sources=[os.sep.join(['ssh', '__init__.%s' % (ext,)])],
105-
extra_compile_args=_comp_args,
106-
**cython_args
107-
)
108-
]
109-
package_data = {}
110-
sys.stdout.write("Windows Python 2 build - %s extensions: %s" % (len(extensions), os.sep))
101+
sys.stdout.write("Windows platform: %s, Python major version: %s.%s" % (ON_WINDOWS, _PYTHON_MAJOR_VERSION, os.linesep))
111102

112103
setup(
113104
name='ssh-python',
@@ -117,7 +108,7 @@
117108
license='LGPLv2.1',
118109
author='Panos Kittenis',
119110
author_email='22e889d8@opayq.com',
120-
description=('libssh C library bindings for Python.'),
111+
description="libssh C library bindings for Python.",
121112
long_description=open('README.rst').read(),
122113
packages=find_packages(
123114
'.', exclude=('embedded_server', 'embedded_server.*',
@@ -133,12 +124,12 @@
133124
'Operating System :: OS Independent',
134125
'Programming Language :: C',
135126
'Programming Language :: Python',
136-
'Programming Language :: Python :: 2',
137-
'Programming Language :: Python :: 2.7',
138127
'Programming Language :: Python :: 3',
139128
'Programming Language :: Python :: 3.6',
140129
'Programming Language :: Python :: 3.7',
141130
'Programming Language :: Python :: 3.8',
131+
'Programming Language :: Python :: 3.9',
132+
'Programming Language :: Python :: 3.10',
142133
'Topic :: System :: Shells',
143134
'Topic :: System :: Networking',
144135
'Topic :: Software Development :: Libraries',
@@ -147,6 +138,7 @@
147138
'Operating System :: POSIX :: Linux',
148139
'Operating System :: POSIX :: BSD',
149140
'Operating System :: MacOS :: MacOS X',
141+
'Operating System :: Microsoft :: Windows',
150142
],
151143
ext_modules=extensions,
152144
package_data=package_data,

ssh/session.c

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ssh/session.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ cdef class Session:
312312
return handle_error_codes(rc, self._session)
313313

314314
def options_get(self, Option option):
315-
"""Get option value. This function can only be used for string optinos.
315+
"""Get option value. This function can only be used for string options.
316316
For numeric or other options use the individual functions.
317317
"""
318318
cdef char *_value

0 commit comments

Comments
 (0)