diff --git a/.travis.yml b/.travis.yml index 40a0cdf2..ae6ef129 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,7 +41,7 @@ jobs: - SYSTEM_LIBSSH2: 1 before_install: - brew update - - brew outdated openssl || brew upgrade openssl || echo "y" + - brew outdated openssl || travis_wait brew upgrade openssl || echo "y" - brew link --overwrite python@2 || brew install python@2 || brew link --overwrite python@2 - which python2 - python2 -c "from __future__ import print_function; import ssl; from platform import python_version; print(ssl.OPENSSL_VERSION); print(python_version())" diff --git a/README.rst b/README.rst index f2d7dd5a..f26559c8 100644 --- a/README.rst +++ b/README.rst @@ -35,6 +35,8 @@ Binary wheel packages are provided for Linux, OSX and Windows, all Python versio `Conda `_ is another installation option - see `documentation `_ for more detailed instructions. +For from source installation instructions, including building against system provided libssh2, `see documentation `_. + For creating native system packages for Centos/RedHat, Ubuntu, Debian and Fedora, see `instructions in the documentation `_. diff --git a/doc/installation.rst b/doc/installation.rst index ac33ac35..8c899326 100644 --- a/doc/installation.rst +++ b/doc/installation.rst @@ -55,62 +55,76 @@ To install, run the following. Installation from Source ========================== -To install from source, ``libssh2`` and Python development headers are required. +Source distributions inlude a bundled ``libssh2`` which is built automatically by default. OpenSSL development libraries are required. -Custom build -------------- +For builds against system provided ``libssh2``, the ``SYSTEM_LIBSSH2=1`` environment variable setting can be used. -For best compatibility, it is recommended to use the ``libssh2`` submodule included in ``ssh2-python`` repository to build with. +Standard build +--------------- + +Source distributions include a bundled ``libssh2`` which is used by default. .. code-block:: shell - git clone --recurse-submodules git@github.com:ParallelSSH/ssh2-python.git - sudo ./ci/install-ssh2.sh + git clone git@github.com:ParallelSSH/ssh2-python.git virtualenv my_env source my_env/bin/activate python setup.py install -The ``sudo ./ci/install-ssh2.sh`` line will install a version of ``libssh2`` under ``/usr/local`` that is the same version used to build binary wheels with and is ensured to be compatible. -If there are multiple development headers and/or libraries for ``libssh2`` on the system, the following can be used to set the include path, runtime and build library directories: +System library build +--------------------- + +Building against system provided ``libssh2`` is another option which may be preferred. This can be done by setting the ``SYSTEM_LIBSSH2=1`` environment variable: .. code-block:: shell - git clone --recurse-submodules git@github.com:ParallelSSH/ssh2-python.git - sudo ./ci/install-ssh2.sh + git clone git@github.com:ParallelSSH/ssh2-python.git virtualenv my_env source my_env/bin/activate - python setup.py build_ext -I /usr/local/include -R /usr/local/lib/x86_64-linux-gnu -L /usr/local/lib/x86_64-linux-gnu + export SYSTEM_LIBSSH2=1 python setup.py install -System library build ---------------------- -Building against system provided ``libssh2`` is another option which may be preferred. +Custom Compiler Configuration +------------------------------- + +If there are multiple ``libssh2`` installations on the system, the following can be used to set the include path, runtime and build time library directory paths respectively: -If the ``libssh2`` version provided by the system is not compatible, run the build with the ``EMBEDDED_LIB=0`` and ``HAVE_AGENT_FWD=0`` environment variables set. This will disable features that require ``libssh2`` >= ``1.6.0`` as well as agent forwarding implementation which is only present in the ``libssh2`` submodule of this repository. +.. code-block:: shell + + git clone git@github.com:ParallelSSH/ssh2-python.git + virtualenv my_env + source my_env/bin/activate + python setup.py build_ext -I /usr/local/include -R /usr/local/lib/x86_64-linux-gnu -L /usr/local/lib/x86_64-linux-gnu + python setup.py install -Clone the repository, install dependencies and run install in a new virtualenv from the repository's root directory. Ubuntu _______ +Example for Debian or Ubuntu based distributions. + .. code-block:: shell sudo apt-get install libssh2-1-dev python-dev virtualenv my_env source my_env/bin/activate + export SYSTEM_LIBSSH2=1 python setup.py install RedHat _______ + +Example for RedHat based distributions. .. code-block:: shell sudo yum install libssh2-devel python-devel virtualenv my_env source my_env/bin/activate + export SYSTEM_LIBSSH2=1 python setup.py install diff --git a/setup.py b/setup.py index a90ef772..af781171 100644 --- a/setup.py +++ b/setup.py @@ -22,8 +22,9 @@ else: USING_CYTHON = True +ON_RTD = os.environ.get('READTHEDOCS') == 'True' -SYSTEM_LIBSSH2 = bool(os.environ.get('SYSTEM_LIBSSH2', 0)) +SYSTEM_LIBSSH2 = bool(os.environ.get('SYSTEM_LIBSSH2', 0)) or ON_RTD # Only build libssh if running a build if not SYSTEM_LIBSSH2 and (len(sys.argv) >= 2 and not ( @@ -35,13 +36,6 @@ build_ssh2() ON_WINDOWS = platform.system() == 'Windows' -ON_RTD = os.environ.get('READTHEDOCS') == 'True' - -if ON_RTD: - files = glob('ssh2/*.c') - for _file in files: - os.remove(_file) - ext = 'pyx' if USING_CYTHON else 'c' sources = glob('ssh2/*.%s' % (ext,)) @@ -76,7 +70,7 @@ runtime_library_dirs = ["$ORIGIN/."] if not SYSTEM_LIBSSH2 else None _lib_dir = os.path.abspath("./src/src") if not SYSTEM_LIBSSH2 else "/usr/local/lib" -include_dirs = ["libssh2/include"] if not SYSTEM_LIBSSH2 else ["/usr/local/include"] +include_dirs = ["libssh2/include"] if ON_RTD or not SYSTEM_LIBSSH2 else ["/usr/local/include"] extensions = [ Extension(sources[i].split('.')[0].replace(os.path.sep, '.'), @@ -126,7 +120,6 @@ 'Programming Language :: C', 'Programming Language :: Python', 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4',