File: setup.py

package info (click to toggle)
hippotat 1.2.3
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 684 kB
  • sloc: sh: 423; makefile: 130; perl: 84; python: 79; ansic: 34
file content (34 lines) | stat: -rwxr-xr-x 787 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/python3

from setuptools import setup, find_packages

import re as regexp
import glob
import sys

scripts = ['hippotat','hippotatd']
scan = scripts + glob.glob('hippotatlib/*.py')

def find_requires():
  mod_pat = r'[._0-9a-zA-Z]+'
  res = list(map(regexp.compile,
                 [r'from\s+('+mod_pat+r')\s+import\b',
                  r'import\s+('+mod_pat+r')\s']))
  reqs = { }
  for scanf in scan:
    print('scanning %s' % scanf, file=sys.stderr)
    for l in open(scanf):
      for re in res:
        m = re.match(l)
        if m is not None:
          reqs[m.group(1)] = True
          break
  print(repr(reqs), file=sys.stderr)
  return list(reqs.keys())

setup(
  name="hippotat",
  packages=find_packages(),
  install_requires=find_requires(),
  scripts=scripts
)