setup.py 2.11 KB
Newer Older
chris's avatar
chris committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
#!/usr/bin/env python
from distutils.core import setup
import os
import re


def find_packages(dirs):
    p = []
    for d in dirs:
        p.extend([
        '.'.join(directory.split(os.sep))
        for directory, _, files in os.walk(d)
        if '__init__.py' in files
        ])
    return p

def find_package_data(basedir):
    pkgdata = {}
    pkgdir = {}
    EXCLUDE_FROM_DATA=('.py', '.pyc', '.pyo')
    for directory, _, files in os.walk(basedir):
        package = '.'.join(directory.split(os.sep))
        if '__init__.py' in files:
            # Record real packages and their directories
            pkgdata[package] = [
                f for f in files
                if not f.endswith(EXCLUDE_FROM_DATA)
            ]
            pkgdir[package] = directory
        else:
            # Find parent package
            while package not in pkgdata and package:
                package = ".".join(package.split(".")[:-1])
            # Add data files relative to their parent package
            reldir = os.path.relpath(directory, pkgdir[package])
            pkgdata[package].extend(
                os.path.join(reldir, f)
                for f in files
                if not f.endswith(EXCLUDE_FROM_DATA)
            )
    return pkgdata


with open('debian/changelog') as f:
    res = re.search('\((\d.*)\)', f.readline())
    version = res.group(1)

setup(
    name='Flyers',
    version=version,
    description='Flyers web application',
    author='Christophe Siraut',
    author_email='d@tobald.eu.org',
    url='http://flyers.domainepublic.net/',
    packages=find_packages([
        'flyers',
    ]),
58
    package_data=find_package_data('flyers'),
chris's avatar
chris committed
59 60 61 62 63 64 65 66 67 68 69 70 71
    classifiers=[
        'Development Status :: 4 - Beta',
        'Environment :: Web Environment',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: GNU General Public License (GPL) License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Topic :: Internet :: WWW/HTTP',
        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
        'Topic :: Utilities'
    ],
)