diff --git a/README.md b/README.md index a0e3a1e..61007d3 100644 --- a/README.md +++ b/README.md @@ -93,3 +93,13 @@ $ python -m lmwsip.run /tmp/hoek-h10.sip > [LO] < [! ] ``` + +### Git pre commit hook + +Er is een git pre-commit hook aanwezig in "githooks". Deze moet geactiveerd +worden door hem te symlinken naar .git/hooks. + +Deze git hook verzorgt een versie nummer en een syntax check voor commit. + +Het versie nummer komt uit de setup.py en word in de module geplaats als +`__version__`. diff --git a/githooks/pre-commit b/githooks/pre-commit new file mode 100755 index 0000000..0bc8e4a --- /dev/null +++ b/githooks/pre-commit @@ -0,0 +1,7 @@ +#!/bin/sh + +VERSION=$(grep version setup.py | sed -e 's/.*="//' -e 's/",//') +sed -i "s/^__version__ = .*/__version__ = '${VERSION}'/" lmwsip/__init__.py +git add lmwsip/__init__.py + +python setup.py test diff --git a/lmwsip/__init__.py b/lmwsip/__init__.py index a225a22..6dfef0d 100644 --- a/lmwsip/__init__.py +++ b/lmwsip/__init__.py @@ -11,6 +11,8 @@ import logging from datetime import datetime, timedelta from dateutil import tz +__version__ = '0.1.01' + class LmwSip: """Class to connect to the LMW Standard Interface prototcol (sip) diff --git a/lmwsip/tests/__init__.py b/lmwsip/tests/__init__.py index e9e7782..4cecdf0 100755 --- a/lmwsip/tests/__init__.py +++ b/lmwsip/tests/__init__.py @@ -129,6 +129,9 @@ class lmwsipTest(unittest.TestCase): sleep(2) self.assertEqual(self.sip.sendrecv("LOGOUTCOUNT"), "1\r") + def test_versionstr(self): + self.assertEqual(type(lmwsip.__version__), str) + def test_run(self): capturedOutput = io.StringIO() sys.stdout = capturedOutput diff --git a/setup.py b/setup.py index 54ed029..ac302cc 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ with open("README.md", "r") as fh: setuptools.setup( name="lmwsip", # Replace with your own username - version="0.0.10", + version="0.1.01", author="Marcel Nijenhof", author_email="pip@pion.xs4all.nl", description="Interface for the lmw sip protocol",