Skip to content
Merged
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
16 changes: 9 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,22 @@

_PYTHON_MAJOR_VERSION = int(platform.python_version_tuple()[0])
ON_WINDOWS = platform.system() == 'Windows'
SYSTEM_LIBSSH = bool(os.environ.get('SYSTEM_LIBSSH', 0))
ON_RTD = os.environ.get('READTHEDOCS') == 'True'
SYSTEM_LIBSSH = bool(os.environ.get('SYSTEM_LIBSSH', 0)) or \
ON_RTD 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 running a build
if (len(sys.argv) >= 2 and not (
# 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__'):
if not (ON_WINDOWS and _PYTHON_MAJOR_VERSION != 2):
build_ssh()
__name__ == '__main__'):
build_ssh()

ext = 'pyx' if USING_CYTHON else 'c'
sources = glob('ssh/*.%s' % (ext,))
Expand Down Expand Up @@ -63,7 +64,8 @@

runtime_library_dirs = ["$ORIGIN/."] if not SYSTEM_LIBSSH else None
_lib_dir = os.path.abspath("./src/lib") if not SYSTEM_LIBSSH else "/usr/local/lib"
include_dirs = ["libssh/include"] if ON_WINDOWS or not SYSTEM_LIBSSH else ["/usr/local/include"]
include_dirs = ["libssh/include"] if (ON_WINDOWS or ON_RTD) or \
not SYSTEM_LIBSSH else ["/usr/local/include"]

extensions = [
Extension(
Expand Down