Sophie

Sophie

distrib > Fedora > 17 > i386 > media > updates > by-pkgid > b50d8ee6d7871fcc13c0677a9364ed59 > files > 363

bcfg2-doc-1.3.0-1.fc17.noarch.rpm



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Environment setup for development &mdash; Bcfg2 1.3.0 documentation</title>
    
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.3.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/sidebar.js"></script>
    <link rel="shortcut icon" href="../_static/favicon.ico"/>
    <link rel="top" title="Bcfg2 1.3.0 documentation" href="../index.html" />
    <link rel="up" title="Bcfg2 Development" href="index.html" />
    <link rel="next" title="Testing" href="testing.html" />
    <link rel="prev" title="Developing for Packages" href="packages.html" />
 
<link rel="stylesheet" href="../_static/bcfg2.css" type=""/>

  </head>
  <body>

<div style="text-align: left; padding: 10px 10px 15px 15px">
<a href="../index.html"><img src="../_static/bcfg2_logo.png" border="0" alt="sampledoc"/></a>
</div>

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="testing.html" title="Testing"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="packages.html" title="Developing for Packages"
             accesskey="P">previous</a> |</li>
	<li><a href="../index.html">home</a> |&nbsp;</li>
	<!--<li><a href="../search.html">search</a> |&nbsp;</li>-->
	<li><a href="../help/index.html">help</a> |&nbsp;</li>
	<li><a href="../contents.html">documentation </a> &raquo;</li>

          <li><a href="../contents.html" >Bcfg2 documentation 1.3.0</a> &raquo;</li>
          <li><a href="index.html" accesskey="U">Bcfg2 Development</a> &raquo;</li> 
      </ul>
    </div>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="environment-setup-for-development">
<span id="development-setup"></span><h1>Environment setup for development<a class="headerlink" href="#environment-setup-for-development" title="Permalink to this headline">¶</a></h1>
<div class="section" id="checking-out-a-copy-of-the-code">
<h2>Checking Out a Copy of the Code<a class="headerlink" href="#checking-out-a-copy-of-the-code" title="Permalink to this headline">¶</a></h2>
<ul>
<li><p class="first">Check out a copy of the code:</p>
<div class="highlight-python"><pre>git clone https://github.com/Bcfg2/bcfg2.git</pre>
</div>
</li>
<li><p class="first">Add <tt class="file docutils literal"><span class="pre">bcfg2/src/sbin</span></tt> to your <span class="target" id="index-0"></span><tt class="xref std std-envvar docutils literal"><span class="pre">PATH</span></tt> environment variable</p>
</li>
<li><p class="first">Add <tt class="file docutils literal"><span class="pre">bcfg2/src/lib</span></tt> to your <span class="target" id="index-1"></span><tt class="xref std std-envvar docutils literal"><span class="pre">PYTHONPATH</span></tt> environment variable</p>
</li>
</ul>
</div>
<div class="section" id="using-a-virtual-environment-for-development">
<h2>Using a Virtual Environment for Development<a class="headerlink" href="#using-a-virtual-environment-for-development" title="Permalink to this headline">¶</a></h2>
<p>Bcfg2 is a pure Python program, and Python makes available certain
tools that simplify creating isolated environments. Such environments
are useful for running code under development, running code that needs
to be installed without actually installing it in system locations, or
running parallel, independent installations of the same packages.</p>
<p>One popular tool for doing this is <a class="reference external" href="http://pypi.python.org/pypi/virtualenv">virtualenv</a>. The following commands
will bootstrap an isolated environment where the Bcfg2 server can
run. They assume you are starting from an empty directory, on a
Posix-like system that has Python and the <tt class="docutils literal"><span class="pre">virtualenv</span></tt> package
installed (e.g., on Debian it is available as <tt class="docutils literal"><span class="pre">python-virtualenv</span></tt>):</p>
<div class="highlight-sh"><div class="highlight"><pre><span class="c"># Work in a scratch directory</span>
mkdir test_env
<span class="nb">cd </span>test_env

<span class="c"># This creates the environment</span>
virtualenv .

<span class="c"># &quot;Activate&quot; the environment. From this point forward, Python</span>
<span class="c"># and its libraries will first be searched for in test_env and</span>
<span class="c"># its subdirectories. When you begin a new session that should</span>
<span class="c"># use this environment, re-execute this command.</span>
. bin/activate

<span class="c"># The pip command is useful for installing python code from a</span>
<span class="c"># variety of locations, including directly from git repositories</span>
easy_install pip

<span class="c"># Install Bcfg2 from git. The -e puts the source in an editable</span>
<span class="c"># git clone under the &quot;src&quot; dir.</span>
pip install -e git://git.mcs.anl.gov/bcfg2.git#egg<span class="o">=</span>Bcfg2

<span class="c"># Install a newer version of the Cheetah library, for example</span>
pip install --upgrade cheetah

<span class="c"># If you want to run IPython from within the virtual</span>
<span class="c"># environment, it will need to be installed locally, even if it</span>
<span class="c"># is already available on the system, or else it won&#39;t find .</span>
pip install --upgrade ipython

<span class="c"># Note, if you install IPython, deactivate and reactivate the</span>
<span class="c"># virtualenv before attempting to use it.</span>
deactivate
. bin/activate
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">One caveat about this environment is that it assumes you have
already installed Bcfg2&#8217;s dependencies on the system itself. Pip is
capable of building packages such as <tt class="docutils literal"><span class="pre">lxml</span></tt> that include native
code, but you will need to be sure its build-time prerequisites are
available.</p>
</div>
<p>Consider using the above commands to create an isolated Bcfg2
environment in the same directory as your Bcfg2
<a class="reference internal" href="../glossary.html#term-repository"><em class="xref std std-term">repository</em></a>. Copy your <tt class="file docutils literal"><span class="pre">/etc/bcfg2.conf</span></tt> file into a
local <tt class="file docutils literal"><span class="pre">etc</span></tt> directory, tweak the paths as needed and you can run
an independent Bcfg2 server as a non-root user. This is useful for
confirming a new release of Bcfg2 and all its tools works against your
current <a class="reference internal" href="../glossary.html#term-repository"><em class="xref std std-term">repository</em></a> before upgrading.</p>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Environment setup for development</a><ul>
<li><a class="reference internal" href="#checking-out-a-copy-of-the-code">Checking Out a Copy of the Code</a></li>
<li><a class="reference internal" href="#using-a-virtual-environment-for-development">Using a Virtual Environment for Development</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="packages.html"
                        title="previous chapter">Developing for Packages</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="testing.html"
                        title="next chapter">Testing</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/development/setup.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="testing.html" title="Testing"
             >next</a> |</li>
        <li class="right" >
          <a href="packages.html" title="Developing for Packages"
             >previous</a> |</li>
	<li><a href="../index.html">home</a> |&nbsp;</li>
	<!--<li><a href="../search.html">search</a> |&nbsp;</li>-->
	<li><a href="../help/index.html">help</a> |&nbsp;</li>
	<li><a href="../contents.html">documentation </a> &raquo;</li>

          <li><a href="../contents.html" >Bcfg2 documentation 1.3.0</a> &raquo;</li>
          <li><a href="index.html" >Bcfg2 Development</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2009-2013, Narayan Desai.
      Last updated on Mar 20, 2013.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
  </body>
</html>