2 # -*- coding: utf-8 -*-
5 from distutils.core import setup
9 os.path.isdir(path) and
10 os.path.isfile(os.path.join(path, '__init__.py'))
13 def find_packages(path, base="" ):
14 """ Find all packages in path """
16 for item in os.listdir(path):
17 dir = os.path.join(path, item)
20 module_name = "%(base)s.%(item)s" % vars()
23 packages[module_name] = dir
24 packages.update(find_packages(dir, module_name))
27 def files_from(*paths, **kwargs):
28 base = kwargs.pop('base')
31 path = os.path.join(base, path)
32 if not os.path.isdir(path) or is_package(path): continue
34 for dir, _, files in os.walk(path):
36 yield os.path.relpath(os.path.join(dir, file),base)
38 return list(generator())
40 RESOURCE_PATHS = ('templates', 'static', 'media', 'locale', 'config')
42 def django_setup(project, apps=[], apps_dir='apps', package_dir = {}, packages = [], package_data = {}, **kwargs):
45 extra_dirs = dict( (app, os.path.join(apps_dir,app)) for app in apps )
46 extra_dirs[project] = project
47 package_dir.update(extra_dirs)
51 # with all subpackages
53 packages.extend(find_packages(os.path.join(apps_dir, app), base=app))
55 packages.append(project)
60 extra_data[app] = files_from(*RESOURCE_PATHS, base=os.path.join(apps_dir, app))
61 extra_data[project] = files_from(*RESOURCE_PATHS, base=project)
62 package_data.update(extra_data)
65 package_dir = package_dir,
67 package_data = package_data, **kwargs)
75 description='IDE for developing books.',
76 author="Fundacja Nowoczesna Polska",
77 author_email='fundacja@nowoczesnapolska.org.pl',
78 license="GNU Affero General Public License 3",
79 maintainer='Ćukasz Rekucki',
80 maintainer_email='lrekucki@gmail.com',
81 url='http://github.com/fnp/redakcja',
82 package_dir = {'': 'lib'},
92 project = 'platforma',
103 "Django (>=1.1.1,<1.2)",
105 # data_files=[ ('', ['LICENSE', 'NOTICE', 'README.rst', 'AUTHORS.md', 'requirements.txt'])],