title: Modify setup.py to support pip install from github
body: <p>I'd like to modify the <a href="https://github.com/ansible/ansible/blob/devel/setup.py" rel="nofollow">setup.py</a> script from the <a href="http://ansible.github.com" rel="nofollow">Ansible</a> project so that I can install ansible into a virtualenv like so:</p>
  
  <pre><code>pip install -e git://github.com/lorin/ansible.git#egg=ansible
  </code></pre>
  
  <p>When I do this now, ansible doesn't run properly, because it can't import the ansible module.</p>
  
  <pre><code>$ ansible
  Traceback (most recent call last):
    File "/Users/lorin/.virtualenvs/ansible/bin/ansible", line 7, in &lt;module&gt;
      execfile(__file__)
    File "/Users/lorin/.virtualenvs/ansible/src/ansible/bin/ansible", line 25, in     &lt;module&gt;
      from ansible.runner import Runner
  ImportError: No module named ansible.runner
  </code></pre>
  
  <p>From what I can tell, one or both of these files tells Python where to find the Ansible module.</p>
  
  <p><code>$venv/lib/python2.7/sites-packages/ansible.egg-link</code>: </p>
  
  <pre><code>/Users/lorin/.virtualenvs/ansible/src/ansible
  .
  </code></pre>
  
  <p><code>$venv/lib/python2.7/sites-packages/easy-install.pth</code>:</p>
  
  <pre><code>import sys; sys.__plen = len(sys.path)
  ./setuptools-0.6c11-py2.7.egg
  ./pip-1.0.2-py2.7.egg
  /Users/lorin/.virtualenvs/ansible/src/ansible
  import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)
  </code></pre>
  
  <p>In both cases, it points to <code>/Users/lorin/.virtualenvs/ansible/src/ansible</code>, but I think it should actually point to <code>/Users/lorin/.virtualenvs/ansible/src/ansible/lib</code>, since the ansible module is a subset of that directory.</p>
  
  <p>(Note: I can't just move the ansible/lib/ansible directory to ansible/ansible since the upstream project is unlikely to accept that change).</p>
  
  <p>I tried to modify these files by hand to see if that would resolve the issue, but that revealed a new problem:</p>
  
  <pre><code>$ ansible
  Traceback (most recent call last):
    File "/Users/lorin/.virtualenvs/ansible/bin/ansible", line 4, in &lt;module&gt;
      from pkg_resources import require; require('ansible==0.6')
    File "build/bdist.linux-i686/egg/pkg_resources.py", line 2603, in &lt;module&gt;
    File "build/bdist.linux-i686/egg/pkg_resources.py", line 666, in require
    File "build/bdist.linux-i686/egg/pkg_resources.py", line 565, in resolve
  pkg_resources.DistributionNotFound: ansible==0.6
  </code></pre>
  
  <p>And, "pip freeze" does not report that the package was installed at all:</p>
  
  <pre><code>$ pip freeze
  Jinja2==2.6
  PyYAML==3.10
  paramiko==1.7.7.2
  pycrypto==2.6
  wsgiref==0.1.2
  </code></pre>
  
  <p>Even once I resolve these issues, I need to somehow set the <code>ANSIBLE_LIBRARY</code> environment variable to point to <code>$venv/src/ansible/library</code> when the virtualenv is activated.</p>
  
  <p>So, to sum up, what do I need to do to:</p>
  
  <ul>
  <li>Get the various Python paths to point to the right directory?</li>
  <li>Deal with the version error?</li>
  <li>Set the <code>ANSIBLE_LIBRARY</code> environment variable?</li>
  </ul>
  
  <p>I also don't want to change the behavior of the setup.py script for the other use cases. I don't have any experience with any of the various Python build tools, so I'm at a loss. </p>