|
20 | 20 |
|
21 | 21 | _PYTHON_MAJOR_VERSION = int(platform.python_version_tuple()[0])
|
22 | 22 | ON_WINDOWS = platform.system() == 'Windows'
|
23 |
| -SYSTEM_LIBSSH = bool(os.environ.get('SYSTEM_LIBSSH', 0)) |
| 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 |
24 | 26 |
|
25 | 27 | if ON_WINDOWS and _PYTHON_MAJOR_VERSION < 3:
|
26 | 28 | raise ImportError(
|
27 | 29 | "ssh-python requires Python 3 or above on Windows platforms.")
|
28 | 30 |
|
29 |
| -# Only build libssh if running a build |
30 |
| -if (len(sys.argv) >= 2 and not ( |
| 31 | +# Only build libssh if SYSTEM_LIBSSH is not set and running a build |
| 32 | +if not SYSTEM_LIBSSH and (len(sys.argv) >= 2 and not ( |
31 | 33 | '--help' in sys.argv[1:] or
|
32 | 34 | sys.argv[1] in (
|
33 | 35 | '--help-commands', 'egg_info', '--version', 'clean',
|
34 | 36 | 'sdist', '--long-description')) and
|
35 |
| - __name__ == '__main__'): |
36 |
| - if not (ON_WINDOWS and _PYTHON_MAJOR_VERSION != 2): |
37 |
| - build_ssh() |
| 37 | + __name__ == '__main__'): |
| 38 | + build_ssh() |
38 | 39 |
|
39 | 40 | ext = 'pyx' if USING_CYTHON else 'c'
|
40 | 41 | sources = glob('ssh/*.%s' % (ext,))
|
|
63 | 64 |
|
64 | 65 | runtime_library_dirs = ["$ORIGIN/."] if not SYSTEM_LIBSSH else None
|
65 | 66 | _lib_dir = os.path.abspath("./src/lib") if not SYSTEM_LIBSSH else "/usr/local/lib"
|
66 |
| -include_dirs = ["libssh/include"] if ON_WINDOWS or not SYSTEM_LIBSSH else ["/usr/local/include"] |
| 67 | +include_dirs = ["libssh/include"] if (ON_WINDOWS or ON_RTD) or \ |
| 68 | + not SYSTEM_LIBSSH else ["/usr/local/include"] |
67 | 69 |
|
68 | 70 | extensions = [
|
69 | 71 | Extension(
|
|
0 commit comments