dbf9959baceeee151f74784a08366b77e0e99ffe
[plcapi.git] / PLC / Methods / __init__.py
1 #!/usr/bin/python -tt
2
3 from __future__ import print_function
4
5 import os
6 import glob
7
8 native_methods = []
9 toppath = os.path.dirname(__file__)
10
11 # do not blindly scan this directory, as when using devel tools
12 # like `make sync` we can easily end up with more files that needed
13 # which breaks in production
14
15 contents = [
16     ('.', '[A-Z][a-zA-Z]*.py'),
17     ('system', '[a-zA-Z]*.py'),
18 ]
19
20 for dir, pattern in contents:
21     prefix = len(dir) + 1
22     matches = glob.glob("{}/{}".format(dir, pattern))
23     print(matches)
24     for match in matches:
25         filename = match[prefix:][:-3]
26         python_name = filename if dir == '.' \
27             else "{}.{}".format(dir, filename)
28         native_methods.append(python_name)
29
30 if __name__ == '__main__':
31     native_methods.sort()
32     print(native_methods)