ReleaseEngineering/How To/Install a Python Virtualenv with Puppet: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Created page with "{{Release Engineering How To|Install a Python Virtualenv with Puppet}} As of completion of {{bug|635007}}, Puppet can install virtualenvs for you. Here's how to make that happen...")
 
No edit summary
Line 23: Line 23:
  epydoc-3.0.1.tar.gz
  epydoc-3.0.1.tar.gz
  mock-0.7.0b4.tar.gz
  mock-0.7.0b4.tar.gz
and put those in the ``python-packages`` directory on the puppet servers.  Since our puppet file serving is a bit messed up at the moment, the location of this directory varies; see [http://hg.mozilla.org/build/puppet-manifests/file/tip/modules/python/manifests/virtualenv.pp virtualenv.pp] for details.
and put those in the [[ReleaseEngineering/PuppetAgain/Python|python/packages]] download directory, if they're not already there.


= Manifest =
= Manifest =

Revision as of 06:15, 8 March 2012

As of completion of bug 635007, Puppet can install virtualenvs for you. Here's how to make that happen.

Prep

First, you'll need to figure out:

  • which copy of Python you want to use as a basis for the virtualenv
  • the entire list of packages and versions that's required

The former will probably vary from slave to slave, although we should bring such variance to heel.

The latter is important because the python::virtualenv type does not follow dependencies. To figure this out, build yourself a virtualenv, install what you need using pip, and then use pip freeze to find a list of packages and versions, e.g.,

decorator==3.2.1
distribute==0.6.14
epydoc==3.0.1
mock==0.7.0b4
pytz==2010o
zope.interface==3.6.1


virtualenv installs 'distribute' for you, so there's no need to include it in your list. Aside from that, you'll need to get ahold of the tarballs for each of the required packages, e.g.,

decorator-3.2.1.tar.gz
epydoc-3.0.1.tar.gz
mock-0.7.0b4.tar.gz

and put those in the python/packages download directory, if they're not already there.

Manifest

Then, you'll need to put together a python::virtualenv resource, e.g.,

python::virtualenv {
  "/my/virtualenv":
    python => "/usr/bin/python",
    packages => [ 'decorator-3.2.1', 'epydoc-3.0.1', 'mock-0.7.0b4',
                  'pytz-2010o', 'zope-interface-3.6.1' ];
}

the nodes on which that resource are instantiated will find themselves with an installed virtualenv. It's that easy!