All my projects have a fairly similar package layout:package_name/package_name/setup.pypackage_name/package_name/__init__.pypackage_name/package_name/data/foo.txtpackage_name/package_name/__init__.py contains:__version__ = '0.0.1'__author__ = 'Alec Taylor <alec.taylor6@gmail.com>'With a setup.py like:from setuptools import setup, find_packagesfrom os import path, listdirfrom functools import partialfrom itertools import imap, ifilterfrom ast import parsefrom pip import __file__ as pip_locif __name__ == '__main__':    package_name = 'foooooo'    f_for = partial(path.join, path.dirname(__file__), package_name)    d_for = partial(path.join,path.dirname(path.dirname(pip_loc)), package_name)    to_funcs = lambda name: (partial(path.join, f_for(name)),                             partial(path.join, d_for(name)))    _data_join, _data_install_dir = to_funcs('data')    get_vals = lambda var0, var1: imap(                   lambda buf: next(imap(lambda e: e.value.s, parse(buf).body)),                       ifilter(lambda line: line.startswith(var0) or                                            line.startswith(var1), f))    with open(path.join(package_name, '__init__.py')) as f:        __author__, __version__ = get_vals('__version__', '__author__')    setup(name=package_name,        author=__author__,        version=__version__,        test_suite=package_name + '.tests',        packages=find_packages(),        package_dir={package_name: package_name},        data_files=[            (_data_install_dir(), map(_data_join, listdir(_data_join())))        ]    )This setup.py has been tested on Windows and Linux with Python 2.7.PS: I'm planning to upgrade all my packages to work with 2.7 and 3+.
setup.py with data_files and __author__ parsing
python;python 3.x;python 2.7