2 # -*- coding: utf-8 -*-
5 from distutils.core import setup
7 RESOURCE_PATHS = ('templates', 'static', 'media', 'locale', 'config')
11 return os.path.isdir(path) \
12 and os.path.isfile(os.path.join(path, '__init__.py'))
15 def find_packages(path, base=""):
16 """ Find all packages in path """
18 for item in os.listdir(path):
19 dir = os.path.join(path, item)
22 module_name = "%(base)s.%(item)s" % vars()
25 packages[module_name] = dir
26 packages.update(find_packages(dir, module_name))
30 def files_from(*paths, **kwargs):
31 base = kwargs.pop('base')
35 path = os.path.join(base, path)
36 if not os.path.isdir(path) or is_package(path):
39 for dir, _, files in os.walk(path):
41 yield os.path.relpath(os.path.join(dir, file), base)
43 return list(generator())
46 def django_setup(project, apps=[], apps_dir='apps', package_dir={}, packages=[], package_data={}, **kwargs):
49 extra_dirs = dict((app, os.path.join(apps_dir, app)) for app in apps)
50 extra_dirs[project] = project
51 package_dir.update(extra_dirs)
55 # with all subpackages
57 packages.extend(find_packages(os.path.join(apps_dir, app), base=app))
59 packages.append(project)
64 extra_data[app] = files_from(*RESOURCE_PATHS, base=os.path.join(apps_dir, app))
65 extra_data[project] = files_from(*RESOURCE_PATHS, base=project)
66 package_data.update(extra_data)
69 package_dir=package_dir,
71 package_data=package_data, **kwargs)
80 description='IDE for developing books.',
81 author="Fundacja Nowoczesna Polska",
82 author_email='fundacja@nowoczesnapolska.org.pl',
83 license="GNU Affero General Public License 3",
84 maintainer='Ćukasz Rekucki',
85 maintainer_email='lrekucki@gmail.com',
86 url='http://github.com/fnp/redakcja',
87 package_dir={'': 'lib'},
108 "Django (>=1.1.1,<1.2)",