.. _mirrors-sync-configuration-2.2:

========================================================================
Customizing your PyPI or Anaconda repository mirror - v 2.2.0 or earlier
========================================================================

.. raw:: html

    <p>Although some aspects of mirroring PyPI and the Anaconda repository differ, the methodology for the specification of which packages to mirror is identical.  You can specify:</p>
    <ul class="simple">
    <li>platforms (valid options are: &#8216;linux-64&#8217;, &#8216;linux-32&#8217;, &#8216;osx-64&#8217;, &#8216;win-32&#8217;, and &#8216;win-64&#8217;)</li>
    <li>whitelist</li>
    <li>blacklist</li>
    <li>license_blacklist (the only valid option at this time is &#8216;GPL&#8217;)</li>
    </ul>
    <p>All specification information should be included in the same file, and can be passed to the binstar-sync-pypi or binstar-sync-conda command via the &#8211;mirror-config argument:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">binstar</span><span class="o">-</span><span class="n">sync</span><span class="o">-</span><span class="n">conda</span> <span class="o">--</span><span class="n">mirror</span><span class="o">-</span><span class="n">config</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">binstar</span><span class="o">/</span><span class="n">mirrors</span><span class="o">/</span><span class="n">conda</span><span class="o">.</span><span class="n">yaml</span>
    <span class="n">binstar</span><span class="o">-</span><span class="n">sync</span><span class="o">-</span><span class="n">pypi</span> <span class="o">--</span><span class="n">mirror</span><span class="o">-</span><span class="n">config</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">binstar</span><span class="o">/</span><span class="n">mirrors</span><span class="o">/</span><span class="n">pypi</span><span class="o">.</span><span class="n">yaml</span>
    </pre></div>
    </div>
    <div class="section" id="platform-specific-mirroring">
    <h2>Platform-specific mirroring<a class="headerlink" href="#platform-specific-mirroring" title="Permalink to this headline">¶</a></h2>
    <p>By default, the binstar-sync-pypi and binstar-sync-conda tools will mirror all platforms.  If you know that you will <em>not</em> need every platform, you will find it useful to save time and space by editing the sync-configuration.txt file to specify the platform(s) you want mirrored:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">platforms</span><span class="p">:</span>
      <span class="o">-</span> <span class="n">linux</span><span class="o">-</span><span class="mi">64</span>
      <span class="o">-</span> <span class="n">win</span><span class="o">-</span><span class="mi">32</span>
    </pre></div>
    </div>
    </div>
    <div class="section" id="whitelist-mirroring">
    <h2>&#8220;Whitelist&#8221; Mirroring<a class="headerlink" href="#whitelist-mirroring" title="Permalink to this headline">¶</a></h2>
    <p>If your .yaml file contains a &#8216;whitelist&#8217; argument, <em>only</em> the packages enumerated under whitelist will be synced to your repository.</p>
    <p>The file must contain a newline separated list of packages:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">whitelist</span><span class="p">:</span>
      <span class="o">-</span> <span class="n">dnspython</span>
      <span class="o">-</span> <span class="n">shapely</span>
      <span class="o">-</span> <span class="n">gdal</span>
    </pre></div>
    </div>
    </div>
    <div class="section" id="blacklist-mirroring">
    <h2>&#8220;Blacklist&#8221; Mirroring<a class="headerlink" href="#blacklist-mirroring" title="Permalink to this headline">¶</a></h2>
    <p>Although the whitelist is an inclusive delineation, the blacklist functions as an exclusive delineation.  For example:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">blacklist</span><span class="p">:</span>
      <span class="o">-</span> <span class="n">bzip2</span>
      <span class="o">-</span> <span class="n">tk</span>
      <span class="o">-</span> <span class="n">openssl</span>
    </pre></div>
    </div>
    <p>...will have the effect of mirroring the entire Anaconda repository <em>except</em> the bzip2, tk, and openssl packages.</p>
    </div>
    <div class="section" id="license-blacklist-mirroring">
    <h2>&#8220;License Blacklist&#8221; Mirroring<a class="headerlink" href="#license-blacklist-mirroring" title="Permalink to this headline">¶</a></h2>
    <p>Currently, only blacklisting GPL packages is supported:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">license_blacklist</span><span class="p">:</span>
      <span class="o">-</span> <span class="n">GPL</span>
    </pre></div>
    </div>
    <p>In this example, the mirror will copy all the packages in the repository except those which are GPL-licensed, because the entire GPL license has been license_blacklisted.</p>
    </div>
    <div class="section" id="combining-multiple-mirror-configurations">
    <h2>Combining Multiple Mirror Configurations<a class="headerlink" href="#combining-multiple-mirror-configurations" title="Permalink to this headline">¶</a></h2>
    <p>In some situations, you may find that combining two or more of the arguments above is the simplest way to get exactly the packages you want.</p>
    <p>The <em>platform</em> argument is evaluated before whitelist, blacklist or license_blacklist arguments.  For example:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">platforms</span><span class="p">:</span>
      <span class="o">-</span> <span class="n">linux</span><span class="o">-</span><span class="mi">64</span>
    <span class="n">whitelist</span><span class="p">:</span>
      <span class="o">-</span> <span class="n">dnspython</span>
      <span class="o">-</span> <span class="n">shapely</span>
      <span class="o">-</span> <span class="n">gdal</span>
    </pre></div>
    </div>
    <p>...would have the effect of mirroring ONLY linux-64 distributions of the dnspython, shapely and gdal packages.</p>
    <p>The combination of both <em>whitelist</em> and <em>blacklist</em> functionality is an unlikely scenario, because their impact is complementary.  It is recommended that you employ the argument that requires the enumeration of the least number of packages. Use <em>whitelist</em> if you want to install fewer than half the packages in the repository, and <em>blacklist</em> if you want to install more than half the total packages.</p>
    <p>If the <em>whitelist</em> and <em>license_blacklist</em> arguments are both employed, the <em>license_blacklist</em> will be evaluated first, with the <em>whitelist</em> functioning as a modifier. In this way packages which have been initially blacklisted can be added back in.:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">license_blacklist</span><span class="p">:</span>
      <span class="o">-</span> <span class="n">GPL</span>
    <span class="n">whitelist</span><span class="p">:</span>
      <span class="o">-</span> <span class="n">pyqt</span>
    </pre></div>
    </div>
    <p>This mirror configuration will copy ALL packages in the repository, except those that are GPL-licensed, and will subsequently copy PyQt, despite its GPL license, because it has been whitelisted.</p>
    </div>
