chiark / gitweb /
packaging fixes
[hippotat.git] / setup.py
1 #!/usr/bin/python3
2
3 from setuptools import setup, find_packages
4
5 import re as regexp
6 import glob
7 import sys
8
9 scripts = ['hippotat','hippotatd']
10 scan = scripts + glob.glob('hippotatlib/*.py')
11
12 def find_requires():
13   mod_pat = r'[._0-9a-zA-Z]+'
14   res = list(map(regexp.compile,
15                  [r'from\s+('+mod_pat+r')\s+import\b',
16                   r'import\s+('+mod_pat+r')\s']))
17   reqs = { }
18   for scanf in scan:
19     print('scanning %s' % scanf, file=sys.stderr)
20     for l in open(scanf):
21       for re in res:
22         m = re.match(l)
23         if m is not None:
24           reqs[m.group(1)] = True
25           break
26   print(repr(reqs), file=sys.stderr)
27   return list(reqs.keys())
28
29 setup(
30   name="hippotat",
31   packages=find_packages(),
32   install_requires=find_requires(),
33   scripts=scripts
34 )