Skip to content

Commit

Permalink
Updated readme, installation instructions in documentation.
Browse files Browse the repository at this point in the history
Updated setup.py for readthedocs builds.
Updated travis cfg.
Updated PyPi classifiers.
  • Loading branch information
pkittenis committed Oct 20, 2018
1 parent c3206df commit 26a372b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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())"
Expand Down
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Binary wheel packages are provided for Linux, OSX and Windows, all Python versio
`Conda <https://conda.io/miniconda.html>`_ is another installation option - see `documentation <http://ssh2-python.readthedocs.org/en/latest/>`_ for more detailed instructions.

For from source installation instructions, including building against system provided libssh2, `see documentation <https://ssh2-python.readthedocs.io/en/latest/installation.html#installation-from-source>`_.

For creating native system packages for Centos/RedHat, Ubuntu, Debian and Fedora, see `instructions in the documentation <http://ssh2-python.readthedocs.io/en/latest/installation.html#system-binary-packages>`_.


Expand Down
46 changes: 30 additions & 16 deletions doc/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]:ParallelSSH/ssh2-python.git
sudo ./ci/install-ssh2.sh
git clone [email protected]: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 [email protected]:ParallelSSH/ssh2-python.git
sudo ./ci/install-ssh2.sh
git clone [email protected]: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 [email protected]: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
Expand Down
13 changes: 3 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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,))
Expand Down Expand Up @@ -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, '.'),
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 26a372b

Please sign in to comment.