setup.py 2.08 KB
Newer Older
1
import os
Konrad Mohrfeldt's avatar
Konrad Mohrfeldt committed
2
from setuptools import setup, find_packages
3

Konrad Mohrfeldt's avatar
Konrad Mohrfeldt committed
4 5 6 7 8 9 10 11 12 13 14

# parse dependencies from requirements.txt
def get_requirements():
    with open('requirements.txt') as f:
        return [
            line.split('#')[0].strip() for line in f.read().splitlines()
            if not line.strip().startswith('#')
        ]


def get_readme():
15
    with open(os.path.join(os.path.dirname(__file__), 'README.md'), encoding='utf-8') as f:
Konrad Mohrfeldt's avatar
Konrad Mohrfeldt committed
16 17 18
        return f.read()


19 20 21 22 23
def get_version():
    with open(os.path.join(os.path.dirname(__file__), 'VERSION')) as f:
        return f.read().strip()


24
def include_recursive(directory):
Konrad Mohrfeldt's avatar
Konrad Mohrfeldt committed
25
    result = {}
26 27 28
    for dirpath, dirnames, filenames in os.walk(directory):
        if filenames:
            result[dirpath] = [os.path.join(dirpath, fname) for fname in filenames]
Konrad Mohrfeldt's avatar
Konrad Mohrfeldt committed
29 30 31 32 33 34 35 36 37 38 39 40
    return tuple(result.items())


def get_root_packages():
    return [pkg for pkg in find_packages() if '.' not in pkg]


static_files = include_recursive('static')
offline_website = include_recursive('offline-website')

setup(
    name='stadtgestalten',
41
    version=get_version(),
Konrad Mohrfeldt's avatar
Konrad Mohrfeldt committed
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
    description='Stadtgestalten is a platform that encourages and enables '
                'social action and solidarity',
    long_description=get_readme(),
    url='https://git.hack-hro.de/stadtgestalten/stadtgestalten.git',
    author='Stadtgestalten Maintainers',
    author_email='wir@stadtgestalten.org',
    packages=find_packages(),
    include_package_data=True,
    classifiers=[
        'Framework :: Django',
        'Intended Audience :: End Users/Desktop',
        'Development Status :: 5 - Production/Stable',
        'Natural Language :: German',
        'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
        'Programming Language :: Python :: 3',
        'Programming Language :: JavaScript',
        'Environment :: Web Environment',
        'Topic :: Internet :: WWW/HTTP',
    ],
    install_requires=get_requirements(),
    data_files=(
63 64 65
        ('.', (
            'manage.py', 'README.md', 'LICENSE', 'CONTRIBUTORS.md', 'CONTRIBUTING.md',
        )),
Konrad Mohrfeldt's avatar
Konrad Mohrfeldt committed
66 67
    ) + static_files + offline_website,
)