other minor tweaks - doc generation should still be broken
[plcapi.git] / PLC / Methods / __init__.py
index 3ea8f6a..000edba 100644 (file)
@@ -1 +1,31 @@
-methods = 'AdmAddNode AdmAddPerson AdmAddPersonToSite AdmAddSite AdmAuthCheck AdmDeleteNode AdmDeletePerson AdmDeleteSite AdmGetAllRoles AdmGetNodes AdmGetPersonRoles AdmGetPersonSites AdmGetPersons AdmGetSites AdmGrantRoleToPerson AdmIsPersonInRole AdmRemovePersonFromSite AdmRevokeRoleFromPerson AdmSetPersonEnabled AdmSetPersonPrimarySite AdmUpdateNode AdmUpdatePerson AuthenticatePrincipal  system.listMethods  system.methodHelp  system.methodSignature  system.multicall'.split()
+#!/usr/bin/python -tt
+
+from __future__ import print_function
+
+import os
+import glob
+
+native_methods = []
+toppath = os.path.dirname(__file__)
+
+# do not blindly scan this directory, as when using devel tools
+# like `make sync` we can easily end up with more files that needed
+# which breaks in production
+
+contents = [
+    ('.', '[A-Z][a-zA-Z]*.py'),
+    ('system', '[a-zA-Z]*.py'),
+]
+
+for dir, pattern in contents:
+    prefix = len(dir) + 1
+    matches = glob.glob("{}/{}".format(dir, pattern))
+    for match in matches:
+        filename = match[prefix:][:-3]
+        python_name = filename if dir == '.' \
+            else "{}.{}".format(dir, filename)
+        native_methods.append(python_name)
+
+if __name__ == '__main__':
+    native_methods.sort()
+    print(native_methods)