other minor tweaks - doc generation should still be broken
[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     for match in matches:
24         filename = match[prefix:][:-3]
25         python_name = filename if dir == '.' \
26             else "{}.{}".format(dir, filename)
27         native_methods.append(python_name)
28
29 if __name__ == '__main__':
30     native_methods.sort()
31     print(native_methods)