-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup.py
executable file
·101 lines (84 loc) · 2.75 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env python
import os
import sys
from distutils.core import setup
sys.path.insert(0, 'lib')
from crab.version import version
with open('README.rst') as file:
long_description = file.read()
def find_packages(base, path=[]):
"""Search for Python pacakges in the directory 'base'.
Package names are built from the path components given
by 'path'."""
packages = []
for name in os.listdir(os.path.join(base, *path)):
pathname = path + [name]
pathname_ = os.path.join(base, *pathname)
if os.path.islink(pathname_):
pass
elif name == '__init__.py':
packages.append('.'.join(path))
elif os.path.isdir(pathname_):
packages.extend(find_packages(base, pathname))
return packages
def find_files(inst, base=None, path=[]):
"""Search for data files in directory 'base', starting at 'path'.
Files are to be installed in directory 'inst'. The 'base'
directory name is not included in the install path."""
files = []
subdirs = []
if base:
fullpath = os.path.join(base, *path)
else:
fullpath = os.path.join(*path)
for name in os.listdir(fullpath):
pathname = path + [name]
pathname_ = os.path.join(fullpath, name)
if os.path.islink(pathname_):
pass
elif os.path.isdir(pathname_):
subdirs.extend(find_files(inst, base, pathname))
else:
files.append(pathname_)
if files:
subdirs.append((os.path.join(inst, *path), files))
return subdirs
setup(
name='crab',
version=version,
author='Graham Bell',
author_email='[email protected]',
url='http://github.com/grahambell/crab',
description='Cron alert board',
long_description=long_description,
package_dir={'': 'lib'},
packages=find_packages('lib'),
scripts=[os.path.join('scripts', script) for script in [
'crab',
'crabd',
'crabd-check',
'crabsh',
]],
data_files=(
[(os.path.join('share', 'doc', 'crab'),
[os.path.join('doc', doc) for doc in [
'crab.ini',
'crabd.ini',
'schema.sql',
]])] +
find_files(os.path.join('share', 'crab'), None, ['res']) +
find_files(os.path.join('share', 'crab'), None, ['templ'])),
requires=[
'CherryPy (>= 3.2.2)',
'crontab (>= 0.15)',
'Mako (>= 0.7.2)',
'pytz',
],
classifiers=[
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: GNU General Public License'
' v3 or later (GPLv3+)',
'Programming Language :: Python',
'Topic :: System :: Monitoring'
]
)