aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-07-18 20:43:26 +0200
committerSimon Warta <[email protected]>2015-07-27 13:04:41 +0200
commit18e055b6dcb5688a8c669cdbc54d53541681a21e (patch)
treeaaa398b0f162e7a6cf2d340d0aedb63d351fc69d
parent2e9109c80eb8fbbb94893827bf9753a735917735 (diff)
Document OS features
-rw-r--r--doc/os.rst54
-rwxr-xr-xsrc/scripts/update_docs.py100
2 files changed, 154 insertions, 0 deletions
diff --git a/doc/os.rst b/doc/os.rst
new file mode 100644
index 000000000..9e1ee641e
--- /dev/null
+++ b/doc/os.rst
@@ -0,0 +1,54 @@
+Botan OS information
+========================================
+
+OS Features
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+A summary of OS features as defined in ``src/build-data/os``.
+
+::
+
+ a: aix
+ a: android
+ c: cygwin
+ d: darwin
+ d: dragonfly
+ f: freebsd
+ h: haiku
+ h: hpux
+ h: hurd
+ i: irix
+ l: linux
+ m: mingw
+ n: nacl
+ n: netbsd
+ o: openbsd
+ q: qnx
+ s: solaris
+ w: windows
+
+.. csv-table::
+ :header: "Feature", "a", "a", "c", "d", "d", "f", "h", "h", "h", "i", "l", "m", "n", "n", "o", "q", "s", "w"
+
+ "clock_gettime", " ", "X", " ", " ", "X", "X", " ", " ", " ", " ", "X", " ", " ", "X", "X", "X", " ", " "
+ "cryptgenrandom", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", "X"
+ "dlopen", " ", "X", " ", "X", " ", "X", " ", " ", " ", " ", "X", " ", " ", "X", "X", "X", " ", " "
+ "getsid", "X", " ", "X", "X", " ", "X", "X", "X", " ", "X", "X", " ", " ", "X", " ", "X", "X", " "
+ "gettimeofday", "X", "X", "X", "X", "X", "X", "X", "X", " ", "X", "X", " ", "X", "X", "X", "X", "X", " "
+ "gmtime_r", " ", "X", " ", "X", " ", "X", "X", " ", " ", " ", "X", " ", " ", "X", "X", "X", " ", " "
+ "gmtime_s", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X"
+ "loadlibrary", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", "X"
+ "memset_s", " ", " ", " ", "X", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "
+ "mkgmtime", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", "X"
+ "posix_mlock", " ", "X", " ", " ", "X", "X", " ", " ", "X", " ", "X", " ", " ", "X", "X", "X", "X", " "
+ "query_perf_counter", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X"
+ "readdir", " ", "X", " ", "X", " ", "X", " ", " ", " ", " ", "X", " ", " ", "X", "X", " ", " ", " "
+ "rtlsecurezeromemory", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X"
+ "stl_filesystem_msvc", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X"
+ "timegm", " ", " ", "X", "X", " ", "X", " ", " ", " ", " ", "X", " ", " ", "X", "X", " ", " ", " "
+ "virtual_lock", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X"
+ "win32_get_systemtime", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", " "
+ "win32_virtual_lock", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", " "
+
+.. note::
+ This file is auto generated by ``src/scripts/update_docs.py``. Dont modify it manually.
diff --git a/src/scripts/update_docs.py b/src/scripts/update_docs.py
new file mode 100755
index 000000000..03b9dd67b
--- /dev/null
+++ b/src/scripts/update_docs.py
@@ -0,0 +1,100 @@
+#!/usr/bin/env python3
+
+"""
+A script to automatically write docs to /docs. Currently it generates
+os.rst, a feature table of OS features.
+
+Requires Python 3.
+
+(C) 2015 Simon Warta (Kullo GmbH)
+
+Botan is released under the Simplified BSD License (see license.txt)
+"""
+
+# global
+import argparse
+import glob
+import os
+import sys
+
+# Assume this script is in botan/src/scripts
+botan_root = os.path.join(os.path.dirname(sys.argv[0]), "..", "..")
+
+# locale
+sys.path.append(botan_root)
+from configure import OsInfo
+
+parser = argparse.ArgumentParser(description="")
+parser.add_argument('--verbose', dest='verbose', action='store_const',
+ const=True, default=False,
+ help='Verbose output (default: false)')
+args = parser.parse_args()
+
+def update_os():
+ PAGE_TITLE="Botan OS information"
+ TABLE_TITLE="OS Features"
+
+ files = []
+ files += glob.glob(botan_root + '/src/build-data/os/*.txt')
+ files.sort()
+
+ if len(files) == 0:
+ print("No info.txt files found.")
+ sys.exit(1)
+
+ f1 = open(os.path.join(botan_root, 'doc', 'os.rst'), 'w+')
+
+ all_features = set()
+ oss = {}
+
+ for filename in files:
+ o = OsInfo(filename)
+ oss[o.basename] = o
+ all_features |= set(o.target_features)
+ if args.verbose:
+ print(o.basename)
+ print(o.target_features)
+
+ featurelist = list(all_features)
+ featurelist.sort()
+ oslist = list(oss.keys())
+ oslist.sort()
+
+ if args.verbose:
+ print(featurelist)
+
+ print(PAGE_TITLE, file=f1)
+ print("========================================", file=f1)
+ print("", file=f1)
+
+ print(TABLE_TITLE, file=f1)
+ print("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", file=f1)
+ print("", file=f1)
+
+ print("A summary of OS features as defined in ``src/build-data/os``.", file=f1)
+ print("", file=f1)
+
+ print("::", file=f1)
+ print("", file=f1)
+ for o in oslist:
+ print(" %s: %s" % (o[0:1], o), file=f1)
+ print("", file=f1)
+
+ print('.. csv-table::', file=f1)
+ print(' :header: "Feature", "' + '", "'.join([o[0:1] for o in oslist]) + '"', file=f1)
+ print('', file=f1)
+
+ for f in featurelist:
+ line = ' "' + f + '"'
+ for o in oslist:
+ line += ', "'
+ line += 'X' if f in oss[o].target_features else ' '
+ line += '"'
+ print(line, file=f1)
+ print("", file=f1)
+ print(".. note::", file=f1)
+ print(" This file is auto generated by ``src/scripts/%s``. Dont modify it manually."
+ % os.path.basename(sys.argv[0]), file=f1)
+
+if __name__ == '__main__':
+ update_os()