Merge branch 'efficient_attributes' into attribute_access
[philo.git] / setup.py
1 #!/usr/bin/env python
2
3 from distutils.core import setup
4 import os
5
6
7 # Shamelessly cribbed from django's setup.py file.
8 def fullsplit(path, result=None):
9         """
10         Split a pathname into components (the opposite of os.path.join) in a
11         platform-neutral way.
12         """
13         if result is None:
14                 result = []
15         head, tail = os.path.split(path)
16         if head == '':
17                 return [tail] + result
18         if head == path:
19                 return result
20         return fullsplit(head, [tail] + result)
21
22 # Compile the list of packages available, because distutils doesn't have
23 # an easy way to do this. Shamelessly cribbed from django's setup.py file.
24 packages, data_files = [], []
25 root_dir = os.path.dirname(__file__)
26 if root_dir != '':
27     os.chdir(root_dir)
28 philo_dir = 'philo'
29
30 for dirpath, dirnames, filenames in os.walk(philo_dir):
31         # Ignore dirnames that start with '.'
32         for i, dirname in enumerate(dirnames):
33                 if dirname.startswith('.'): del dirnames[i]
34         if '__init__.py' in filenames:
35                 packages.append('.'.join(fullsplit(dirpath)))
36         elif filenames:
37                 data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
38
39
40 version = __import__('philo').VERSION
41
42 setup(
43         name = 'Philo',
44         version = '%s.%s' % (version[0], version[1]),
45         packages = packages,
46         data_files = data_files,
47 )