Compare commits
No commits in common. "0f3cd9be19b209d8b09b08069c4bf8a79dee2ab1" and "dfc1e8bf8bf54e33b62d090b0e5c1fcf2e4f0f5b" have entirely different histories.
0f3cd9be19
...
dfc1e8bf8b
22
LICENSE
22
LICENSE
|
@ -1,22 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2020 Peter J. Holzer
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
|
|
12
README.md
12
README.md
|
@ -1,14 +1,2 @@
|
||||||
ProcruSQL
|
ProcruSQL
|
||||||
=========
|
=========
|
||||||
|
|
||||||
Make a database fit its description.
|
|
||||||
|
|
||||||
Why?
|
|
||||||
----
|
|
||||||
|
|
||||||
To be written ...
|
|
||||||
|
|
||||||
Syntax
|
|
||||||
------
|
|
||||||
|
|
||||||
To be written ...
|
|
||||||
|
|
|
@ -291,3 +291,17 @@ def rulename():
|
||||||
rulenum += 1
|
rulenum += 1
|
||||||
return f"__rule_{rulenum}"
|
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)
|
|
@ -1,5 +1,4 @@
|
||||||
import logging
|
import logging
|
||||||
import sys
|
|
||||||
|
|
||||||
import psycopg2
|
import psycopg2
|
||||||
from psycopg2 import sql
|
from psycopg2 import sql
|
||||||
|
@ -242,19 +241,3 @@ def dump_dot():
|
||||||
for i in range(1, len(in_order)):
|
for i in range(1, len(in_order)):
|
||||||
print(f"\t{in_order[i-1]} -> {in_order[i]} [style=dashed]")
|
print(f"\t{in_order[i-1]} -> {in_order[i]} [style=dashed]")
|
||||||
print("}")
|
print("}")
|
||||||
|
|
||||||
def 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)
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
[build-system]
|
|
||||||
requires = [
|
|
||||||
"setuptools>=42",
|
|
||||||
"wheel"
|
|
||||||
]
|
|
||||||
build-backend = "setuptools.build_meta"
|
|
28
setup.cfg
28
setup.cfg
|
@ -1,28 +0,0 @@
|
||||||
[metadata]
|
|
||||||
name = ProcruSQL
|
|
||||||
version = 0.0.1
|
|
||||||
author = Peter J. Holzer
|
|
||||||
author_email = hjp@hjp.at
|
|
||||||
description = Make a database fit its description
|
|
||||||
long_description = file: README.md
|
|
||||||
long_description_content_type = text/markdown
|
|
||||||
url = https://git.hjp.at:3000/hjp/procrusql
|
|
||||||
project_urls =
|
|
||||||
Bug Tracker = https://git.hjp.at:3000/hjp/procrusql/issues
|
|
||||||
classifiers =
|
|
||||||
Programming Language :: Python :: 3
|
|
||||||
License :: OSI Approved :: MIT License
|
|
||||||
Operating System :: OS Independent
|
|
||||||
|
|
||||||
[options]
|
|
||||||
package_dir =
|
|
||||||
= src
|
|
||||||
packages = find:
|
|
||||||
python_requires = >=3.8
|
|
||||||
|
|
||||||
[options.packages.find]
|
|
||||||
where = src
|
|
||||||
|
|
||||||
[options.entry_points]
|
|
||||||
console_scripts =
|
|
||||||
procrusql-fit = procrusql:main
|
|
Loading…
Reference in New Issue