Create basic package structure

This commit is contained in:
Peter J. Holzer 2022-02-25 16:54:21 +01:00 committed by Peter J. Holzer
parent dfc1e8bf8b
commit 6ebb397a86
6 changed files with 25 additions and 14 deletions

0
LICENSE Normal file
View File

0
pyproject.toml Normal file
View File

0
setup.cfg Normal file
View File

25
src/procrusql-fit Executable file
View File

@ -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

View File

@ -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)