Versie nummer in de module

This commit is contained in:
Marcel Nijenhof
2021-02-16 16:16:42 +01:00
parent 830aebdfa4
commit 00d9d64f50
5 changed files with 23 additions and 1 deletions

View File

@@ -93,3 +93,13 @@ $ python -m lmwsip.run /tmp/hoek-h10.sip
> [LO] > [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__`.

7
githooks/pre-commit Executable file
View File

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

View File

@@ -11,6 +11,8 @@ import logging
from datetime import datetime, timedelta from datetime import datetime, timedelta
from dateutil import tz from dateutil import tz
__version__ = '0.1.01'
class LmwSip: class LmwSip:
"""Class to connect to the LMW Standard Interface prototcol (sip) """Class to connect to the LMW Standard Interface prototcol (sip)

View File

@@ -129,6 +129,9 @@ class lmwsipTest(unittest.TestCase):
sleep(2) sleep(2)
self.assertEqual(self.sip.sendrecv("LOGOUTCOUNT"), "1\r") self.assertEqual(self.sip.sendrecv("LOGOUTCOUNT"), "1\r")
def test_versionstr(self):
self.assertEqual(type(lmwsip.__version__), str)
def test_run(self): def test_run(self):
capturedOutput = io.StringIO() capturedOutput = io.StringIO()
sys.stdout = capturedOutput sys.stdout = capturedOutput

View File

@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools.setup( setuptools.setup(
name="lmwsip", # Replace with your own username name="lmwsip", # Replace with your own username
version="0.0.10", version="0.1.01",
author="Marcel Nijenhof", author="Marcel Nijenhof",
author_email="pip@pion.xs4all.nl", author_email="pip@pion.xs4all.nl",
description="Interface for the lmw sip protocol", description="Interface for the lmw sip protocol",