From 3614beba9e609b3a800d5ec26a8dad8cc760d1f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Caletka?= Date: Sat, 7 Jul 2018 22:02:18 +0200 Subject: [PATCH] Add setup.py --- LICENSE | 21 +++++++++++++++++++++ dzonegit.py | 12 +++++++++++- setup.py | 19 +++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 LICENSE create mode 100644 setup.py diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a54b91f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Ondřej Caletka + +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. diff --git a/dzonegit.py b/dzonegit.py index bcd3e99..803bbc8 100644 --- a/dzonegit.py +++ b/dzonegit.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import sys import subprocess import re from collections import namedtuple @@ -172,7 +173,7 @@ def check_updated_zones(against): pass # Old version of zone did not exist -def main(): +def pre_commit(): against = get_head() try: check_whitespace_errors(against) @@ -182,5 +183,14 @@ def main(): raise SystemExit(1) +def main(): + name = Path(sys.argv[0]).name + print(name) + if name == "pre-commit": + pre_commit() + else: + sys.exit("No valid command found") + + if __name__ == "__main__": main() diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..f807b3e --- /dev/null +++ b/setup.py @@ -0,0 +1,19 @@ +from setuptools import setup + + +setup( + name="dzonegit", + version="0.1", + description="Git hooks to admin DNS zone files in git", + author="Ondřej Caletka", + author_email="ondrej@caletka.cz", + license="MIT", + py_modules=["dzonegit"], + entry_points={ + "console_scripts": [ + "dzonegit = dzonegit:main", + "pre-commit = dzonegit:pre_commit", + ], + }, +) +