setup.py 2.84 KB
Newer Older
Christophe Siraut's avatar
Christophe Siraut committed
1
#!/usr/bin/env python
2
from distutils.core import setup
chris's avatar
chris committed
3 4 5 6
import os
import re


chris's avatar
chris committed
7 8 9 10 11 12 13 14 15 16
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

chris's avatar
chris committed
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
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)
Christophe Siraut's avatar
Christophe Siraut committed
47

48
setup(
chris's avatar
chris committed
49 50
    name='Nuages',
    version=version,
51 52 53 54
    description='Nuages web application',
    author='Christophe Siraut',
    author_email='d@tobald.eu.org',
    url='http://nuages.domainepublic.net/',
chris's avatar
chris committed
55
    packages=find_packages([
56 57 58
        'nuages',
        'nuages_templates',
        'registration_templates'
chris's avatar
chris committed
59 60 61 62 63
    ]),
    package_data=dict(
        find_package_data('nuages_templates').items() +
        find_package_data('registration_templates').items()
    ),
64 65 66 67 68
    install_requires=[
        'django',
        'django-jquery',
        'django-registration',
        'django-datetime-widget',
chris's avatar
chris committed
69 70
        'django-bootstrap-staticfiles',
        'django-meetingpoll'
71 72 73 74 75 76 77 78 79 80 81 82 83 84
    ],
    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'
    ],
)
chris's avatar
chris committed
85 86

setup(
chris's avatar
chris committed
87
    name='DjangoMeetingPoll',
chris's avatar
chris committed
88 89 90 91 92
    version=version,
    description='Meeting poll Django Application',
    author='Christophe Siraut',
    author_email='d@tobald.eu.org',
    url='http://nuages.domainepublic.net/',
chris's avatar
chris committed
93
    packages=find_packages([
chris's avatar
chris committed
94
        'meetingpoll',
chris's avatar
chris committed
95
    ]),
chris's avatar
chris committed
96 97 98 99 100
    package_data=find_package_data('meetingpoll'),
    install_requires=[
        'django',
    ],
)