Moved to a better looking setup.py file.
[asgard-bookmarks:asgard-bookmarks.git] / setup.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 import os, sys
4
5 from setuptools import setup, find_packages
6
7 from distutils.command.install_data import install_data
8 from distutils.command.install import INSTALL_SCHEMES
9
10 def read(*path):
11         return open(os.path.join(os.path.abspath(os.path.dirname(__file__)), *path)).read()
12
13 blog = __import__('blog', {}, {}, [''])
14
15 packages, data_files = [], []
16
17 root_dir = os.path.dirname(__file__)
18 if root_dir != '':
19         os.chdir(root_dir)
20
21 blog_dir = "blog"
22
23 def osx_install_data(install_data):
24         def finalize_options(self):
25                 self.set_undefined_options("install", ("install_lib", "install_dir"))
26                 install_data.finalize_options(self)
27
28 def fullsplit(path, result=None):
29         if result is None:
30                 result = []
31         head, tail = os.path.split(path)
32         if head == '':
33                 return [tail] + result
34         if head == path:
35                 return result
36         return fullsplit(head, [tail] + result)
37
38 for scheme in INSTALL_SCHEMES.values():
39         scheme['data'] = scheme['purelib']
40
41
42 for dirpath, dirnames, filenames in os.walk(blog_dir):
43         # Ignore dirnames that start with '.'
44         for i, dirname in enumerate(dirnames):
45                 if dirname.startswith("."): del dirnames[i]
46         for filename in filenames:
47                 if filename.endswith(".py"):
48                         packages.append('.'.join(fullsplit(dirpath)))
49                 else:
50                         data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
51
52 setup(
53         name = 'asgard-bookmarks',
54         version = bookmarks.__version__,
55         url = 'http://asgardproject.org/apps/bookmarks.html',
56         
57         author = 'Myles Braithwaite',
58         author_email = 'me@mylesbraithwaite.com',
59         
60         description = 'A simple Bookmarking application for the Asgard CMS system.',
61         long_description = read('docs', 'intro.rst'),
62         
63         license = 'BSD License',
64         
65         packages = packages,
66         data_files = data_files,
67         zip_safe = False,
68         
69         install_requires = [
70                 'distribute',
71         ],
72         
73         classifiers = [
74                 'Development Status :: 4 - Beta',
75                 'Environment :: Web Environment',
76                 'Intended Audience :: Developers',
77                 'Operating System :: OS Independent',
78                 'Framework :: Django',
79                 'License :: OSI Approved :: BSD License',
80                 'Programming Language :: Python',
81                 'Topic :: Internet :: WWW/HTTP',
82         ],
83 )