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
3 4 5 6
import os
import re


Christophe Siraut's avatar
Christophe Siraut 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

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(
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/',
Christophe Siraut's avatar
Christophe Siraut committed
55
    packages=find_packages([
56 57 58
        'nuages',
        'nuages_templates',
        'registration_templates'
Christophe Siraut's avatar
Christophe Siraut 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',
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'
    ],
)
85 86

setup(
Christophe Siraut's avatar
Christophe Siraut committed
87
    name='DjangoMeetingPoll',
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/',
Christophe Siraut's avatar
Christophe Siraut committed
93
    packages=find_packages([
94
        'meetingpoll',
Christophe Siraut's avatar
Christophe Siraut committed
95
    ]),
96 97 98 99 100
    package_data=find_package_data('meetingpoll'),
    install_requires=[
        'django',
    ],
)