title: setup.py's sdist, bdist and install behaving differently regarding data_files
body: <p>I'm trying to distribute web assets along with a web app that I'm trying to package, but I'm failing miserably. I don't understand why I have a different list of files installed or packages when I run bdist, sdist, or install. </p>
  
  <h2>Project Layout</h2>
  
  <p>The project runs with python 3 on Arch. The results are the same with Py3 on Raspbian.
   I've done a very trimmed down version to make things simpler, which I describe here.</p>
  
  <p>The files layout is as follow :</p>
  
  <pre><code>data/index.html  
  MANIFEST.in
  mylib.py
  setup.py
  </code></pre>
  
  <p>The <code>MANIFEST.in</code> file is :</p>
  
  <pre><code>recursive-include data *
  </code></pre>
  
  <p>The <code>setup.py</code> is :</p>
  
  <pre><code>#!/usr/bin/env python
  
  from setuptools import setup, find_packages
  
  setup(name='mylib',
        version='0.1.2',
        url='http://www.example.org',
        author='Foo',
        packages=find_packages(),
        data_files = [ ('share/mylib', ['data/index.html']) ]
  )
  </code></pre>
  
  <p><em>My goal is to install <code>index.html</code> in <code>PREFIX/share/mylib/index.html</code>.</em></p>
  
  <h2>Running setup.py</h2>
  
  <p>Now, <code>bdist</code> includes the file at the seemingly right location, while <code>sdist</code> and <code>install</code> just ignore it :  </p>
  
  <ul>
  <li><strong>bdist</strong></li>
  </ul>
  
  <p>Using bdist, I have the following files in the resulting tar :</p>
  
  <pre><code>./usr/lib/python3.3/site-packages/mylib-0.1.2-py3.3.egg-info/SOURCES.txt
  ./usr/lib/python3.3/site-packages/mylib-0.1.2-py3.3.egg-info/top_level.txt
  ./usr/lib/python3.3/site-packages/mylib-0.1.2-py3.3.egg-info/dependency_links.txt
  ./usr/lib/python3.3/site-packages/mylib-0.1.2-py3.3.egg-info/PKG-INFO
  ./usr/share/mylib/index.html
  </code></pre>
  
  <p>This is exactly what I want to be installed, perfect. However, I really want <code>sdist</code> and <code>install</code> to work, since I want to distribute this thing on PyPI and be able to install from source checkouts.</p>
  
  <ul>
  <li><strong>sdist</strong></li>
  </ul>
  
  <p>When I untar the sdist file, everything seems ok and data is included :</p>
  
  <pre><code>...
  mylib-0.1.2/data/
  mylib-0.1.2/data/index.html
  ...
  </code></pre>
  
  <p>However, if I <code>sudo python setup.py install --record=log.txt</code> in the directory where it is untarred, the only file listed in the log is <code>/usr/lib/python3.3/site-packages/mylib-0.1.2-py3.3.egg</code>. No trace of <code>data/index.html</code> anywhere ('/usr/local/share', '/usr/share')</p>
  
  <ul>
  <li><strong>install</strong></li>
  </ul>
  
  <p>Same issue as sdist (I suppose this is expected). No trace of <code>data/index.html</code> anywhere ('/usr/local/share', '/usr/share').</p>
  
  <p>I also tried to add a setup.cfg like this :</p>
  
  <pre><code>[install]
  install-data=/usr/local/share/mylib/
  install_data=/usr/local/share/mylib/
  </code></pre>
  
  <p>(I've added both install-data and install_data since docs state to use the later, while I saw other projects using the former). No luck.</p>
  
  <h2>Epilogue</h2>
  
  <p>Now, I quite new to python and it's environment, I'm probably missing something obvious or misunderstanding how setuptools works. I've been reading the doc back an forth, reading stackoverflow's Q&amp;A in data_files at great length, but didn't make any progress.</p>
  
  <p>If someone could point me to the right direction to solve this, this would be great. A link to a simple project distributing assets would be a good read too. I just couldn't find one that gave me that "Ah ah!" moment.</p>
  
  <p>Thanks for reading.</p>