From e4655c25aea84b28f8190e3d19214c0666a57fdb Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Wed, 15 Feb 2017 09:33:38 +0100 Subject: [PATCH] Initial commit Signed-off-by: Thomas Klaehn --- .gitignore | 3 +++ .gitlab-ci.yml | 22 ++++++++++++++++++++++ .project | 17 +++++++++++++++++ .pydevproject | 10 ++++++++++ Readme.md | 1 + pylint_wrapper.py | 32 ++++++++++++++++++++++++++++++++ pylintrc | 2 ++ source/main/__init__.py | 14 ++++++++++++++ source/setup.py | 18 ++++++++++++++++++ tests/__init__.py | 5 +++++ tests/unittests/__init__.py | 5 +++++ 11 files changed, 129 insertions(+) create mode 100644 .gitignore create mode 100644 .gitlab-ci.yml create mode 100644 .project create mode 100644 .pydevproject create mode 100644 Readme.md create mode 100644 pylint_wrapper.py create mode 100644 pylintrc create mode 100644 source/main/__init__.py create mode 100644 source/setup.py create mode 100644 tests/__init__.py create mode 100644 tests/unittests/__init__.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1fbac47 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.pyc +source/dist/ +source/MANIFEST diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..40d3c60 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,22 @@ +variables: +# SW_KERNEL: "0" +# SW_MAJOR: "1" +# SW_MINOR: "10" + +before_script: + - "echo $CI_BUILD_ID" + - "echo $CI_BUILD_REF_NAME" + +stages: + - static_analysis + - test + +static_analysis_tests: + stage: static_analysis + script: + - "python pylint_wrapper.py -s src -s tests" + +unit_tests: + stage: test + script: + - "python tests/unittest/" diff --git a/.project b/.project new file mode 100644 index 0000000..6545939 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + mqtt_logger + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/.pydevproject b/.pydevproject new file mode 100644 index 0000000..cb13045 --- /dev/null +++ b/.pydevproject @@ -0,0 +1,10 @@ + + + +/${PROJECT_DIR_NAME} +/${PROJECT_DIR_NAME}/source +/${PROJECT_DIR_NAME}/tests + +python 2.7 +Default + diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..ee0b3c6 --- /dev/null +++ b/Readme.md @@ -0,0 +1 @@ +# mqtt data logger diff --git a/pylint_wrapper.py b/pylint_wrapper.py new file mode 100644 index 0000000..9489183 --- /dev/null +++ b/pylint_wrapper.py @@ -0,0 +1,32 @@ +''' +Created on Feb 11, 2017 +The pylint wrapper is needed for ci because pylint will return != 0 also in +warning case. + +@author: tkl +''' +import os +import sys +import getopt + +def main(argv): + ''' Entry Point for the pylint wrapper. ''' + options, _ = getopt.getopt(argv, "s:", ["source="]) + source_list = [] + for opt, args in options: + if opt in ("-s", "--source"): + source_list.append(args) + + source_str = "" + for source in source_list: + source_str += source + " " + + os.system("pylint " + source_str) +# pylint for sonar cube +# os.system("pylint " + source_str + \ +# " -r n --msg-template=\"{path}:{line}: [{msg_id}({symbol}), " + \ +# "{obj}] {msg}\" > sonar.report") + return 0 + +if __name__ == "__main__": + sys.exit(main(sys.argv[1:])) diff --git a/pylintrc b/pylintrc new file mode 100644 index 0000000..1b59ef2 --- /dev/null +++ b/pylintrc @@ -0,0 +1,2 @@ +[TYPECHECK] +ignored-modules = numpy \ No newline at end of file diff --git a/source/main/__init__.py b/source/main/__init__.py new file mode 100644 index 0000000..4c973d6 --- /dev/null +++ b/source/main/__init__.py @@ -0,0 +1,14 @@ +''' +Created on Feb 15, 2017 + +@author: tkl +''' +import sys + +def main(): + ''' Entry point for the mqtt data logger. + ''' + pass + +if __name__ == '__main__': + sys.exit(main()) diff --git a/source/setup.py b/source/setup.py new file mode 100644 index 0000000..4731727 --- /dev/null +++ b/source/setup.py @@ -0,0 +1,18 @@ +''' +Created on Feb 15, 2017 + +Type 'python setup.py sdist' to create the distribution, +type 'python setup.py install' to install the distribution. + +@author: tkl +''' +from distutils.core import setup + +setup( + name='mqtt_logger', + version='0.1', + author='tkl', + author_email='tkl@blackfinn.de', + url='files.blackfinn.de/python/mqtt_logger-0.1.tar.gz', + packages=['main'], + ) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..5a3505b --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,5 @@ +''' +Created on Feb 15, 2017 + +@author: tkl +''' diff --git a/tests/unittests/__init__.py b/tests/unittests/__init__.py new file mode 100644 index 0000000..5a3505b --- /dev/null +++ b/tests/unittests/__init__.py @@ -0,0 +1,5 @@ +''' +Created on Feb 15, 2017 + +@author: tkl +'''