#! /usr/bin/env python3 # -------------------------------------------------------------------- import sys, os # -------------------------------------------------------------------- def _main(): if len(sys.argv)-1 != 1: print(f'Usage: {sys.argv[0]} [theory directory]') exit(1) thdir = sys.argv[1] theories = [] for root, _, files in os.walk(thdir): for fname in files: if os.path.splitext(fname)[1] in ('.ec', '.eca'): theories.append(os.path.relpath(os.path.join(root, fname), thdir)) theories = sorted(theories) namemax = max(0, *(len(x) for x in theories)) print('(install') print(' (section (site (easycrypt theories)))') print(' (files') for theory in theories: print(f' ({theory:{namemax}} as {theory})') print(' )') print(')') # -------------------------------------------------------------------- if __name__ == '__main__': _main()