Skip to content
Browse files

Have basic either-or package naming working via local pip

  • Loading branch information
bitprophet committed Nov 24, 2016
1 parent d9c7dcf commit dfe31d4d4de8f60692ed0a3fc21e18332021accc
Showing with 48 additions and 10 deletions.
  1. +1 −0 fabric2
  2. +25 −10
  3. +22 −0 sites/www/installing.rst
@@ -1,14 +1,29 @@
#!/usr/bin/env python

# Support setuptools or distutils
from setuptools import setup
except ImportError:
from distutils.core import setup
import os
import setuptools

# Enable the option of building/installing Fabric 2.x as "fabric2". This allows
# users migrating from 1.x to 2.x to have both in the same process space and
# migrate piecemeal. It leverages the fact that the Git repository holds a
# symbolic link from 'fabric' to 'fabric2' (so it effectively has a 'copy' of
# the code under either name).
# NOTE: this only works when one is executing directly (e.g. it cannot
# be triggered when installing a wheel or other binary archive); the
# maintainers take care of triggering this explicitly at build time so that two
# different wheels & PyPI entries are in play.
# See also sites/www/installing.txt.
package_name = 'fabric'
binary_name = 'fab'
if os.environ.get('PACKAGE_AS_FABRIC2', None):
package_name = 'fabric2'
binary_name = 'fab2'

# Version info -- read without importing
_locals = {}
with open('fabric/') as fp:
with open(os.path.join(package_name, '')) as fp:
exec(, None, _locals)
version = _locals['__version__']

@@ -20,8 +35,8 @@

description='High level SSH command execution',
@@ -37,10 +52,10 @@
'console_scripts': [
'fab =',
'{0} = {1}'.format(binary_name, package_name),

@@ -22,11 +22,33 @@ are typically older and harder to support), typically called ``fabric`` or

$ sudo apt-get install fabric

Installing Fabric 2.x as ``fabric2``

Users who are migrating from Fabric 1 to Fabric 2 may find it useful to have
both versions installed side-by-side. The easiest way to do this is to use the
handy ``fabric2`` PyPI entry::

$ pip install fabric2

This upload is generated from the normal Fabric repository, but is tweaked at
build time so that it installs a ``fabric2`` package instead of a ``fabric``
one. The codebase is otherwise unchanged.

Users working off of the Git repository can enable that same tweak with an
environment variable, e.g.::

$ PACKAGE_AS_FABRIC2=yes pip install -e .


$ PACKAGE_AS_FABRIC2=yes python develop

or any other ```` related command.

.. note::
The value of the environment variable doesn't matter, as long as it is not


0 comments on commit dfe31d4

Please sign in to comment.