diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e69de29 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..e69de29 diff --git a/src/procrusql-fit b/src/procrusql-fit new file mode 100755 index 0000000..a086a29 --- /dev/null +++ b/src/procrusql-fit @@ -0,0 +1,25 @@ +#!/usr/bin/python3 +import logging +import sys + +import psycopg2 + +import procrusql +import procrusql.parser + +if __name__ == "__main__": + logging.basicConfig(format="%(asctime)s %(levelname)s %(name)s %(lineno)d | %(message)s", level=logging.DEBUG) + with open(sys.argv[1]) as rf: + text = rf.read() + ps = procrusql.parser.ParseState(text) + + ps2 = procrusql.parser.parse_ruleset(ps) + + if not ps2: + ps.printerror() + sys.exit(1) + + db = psycopg2.connect(sys.argv[2]) + procrusql.fit(db, ps2.ast) + +# vim: tw=0 diff --git a/procrusql.py b/src/procrusql/__init__.py similarity index 100% rename from procrusql.py rename to src/procrusql/__init__.py diff --git a/parse_dsl_manual b/src/procrusql/parser.py similarity index 95% rename from parse_dsl_manual rename to src/procrusql/parser.py index ecdc431..5d33596 100755 --- a/parse_dsl_manual +++ b/src/procrusql/parser.py @@ -291,17 +291,3 @@ def rulename(): rulenum += 1 return f"__rule_{rulenum}" -if __name__ == "__main__": - logging.basicConfig(format="%(asctime)s %(levelname)s %(name)s %(lineno)d | %(message)s", level=logging.DEBUG) - with open(sys.argv[1]) as rf: - text = rf.read() - ps = ParseState(text) - - ps2 = parse_ruleset(ps) - - if not ps2: - ps.printerror() - sys.exit(1) - - db = psycopg2.connect(sys.argv[2]) - procrusql.fit(db, ps2.ast)