diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0f881da --- /dev/null +++ b/.gitignore @@ -0,0 +1,65 @@ +# general stuff +*~ +unittest/testresults/* +unittest/output_data/* + +# eclipse stuff +.settings/ + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..bb8e23c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,15 @@ +[submodule "pylibs/mqtt"] + path = pylibs/mqtt + url = https://git.mount-mockery.de/pylib/mqtt.git +[submodule "pylibs/unittest"] + path = pylibs/unittest + url = https://git.mount-mockery.de/pylib/unittest.git +[submodule "pylibs/report"] + path = pylibs/report + url = https://git.mount-mockery.de/pylib/report.git +[submodule "pylibs/fstools"] + path = pylibs/fstools + url = https://git.mount-mockery.de/pylib/fstools.git +[submodule "pylibs/rspec"] + path = pylibs/rspec + url = https://git.mount-mockery.de/pylib/rspec.git diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3cb9918 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +MODULE_NAME := $(shell basename `pwd`) + +view_unittest: + xdg-open pylibs/$(MODULE_NAME)/_testresults_/unittest.pdf + +view_requirements: + xdg-open pylibs/$(MODULE_NAME)/_requirements_/specification.pdf + +view_docs: + xdg-open pylibs/$(MODULE_NAME)/_docs_/index.html + +clean: + make -kC docs clean; make -kC requirements cleanall; make -kC unittest clean diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..1cd6bbb --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,38 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +MAKEFLAGS += --no-print-directory + +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SPHINXPRJ = $(shell basename `dirname \`pwd\``) +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: $(SPHINXPRJ) + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +$(SPHINXPRJ): Makefile + make -C $@/_examples_ all + +clean: + @echo "\033[1;33mCleanung up docs...\033[00m" + @echo "\e[1m * Sphix build directory...\e[0m" + @rm -rf $(BUILDDIR)/* + @make -kC $(SPHINXPRJ)/_examples_ clean + +release: html + rm -rf $(SPHINXPRJ)/_docs_ + mv $(BUILDDIR)/html $(SPHINXPRJ)/_docs_ + +view_html: html + xdg-open $(BUILDDIR)/html/index.html \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..82f5662 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,179 @@ +# -*- coding: utf-8 -*- +# +# Configuration file for the Sphinx documentation builder. +# +# This file does only contain a selection of the most common options. For a +# full list see the documentation: +# http://www.sphinx-doc.org/en/master/config + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import sys +sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'mqtt' +copyright = '2025, Dirk Alders' +author = 'Dirk Alders' + +# The short X.Y version +version = '' +# The full version, including alpha/beta/rc tags +release = '' + + +# -- General configuration --------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.coverage', + 'python_docs_theme', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = 'en' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = None + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'python_docs_theme' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# The default sidebars (for documents that don't match any pattern) are +# defined by theme itself. Builtin themes are using these templates by +# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', +# 'searchbox.html']``. +# +# html_sidebars = {} + + +# -- Options for HTMLHelp output --------------------------------------------- + +# Output file base name for HTML help builder. +htmlhelp_basename = 'cachingdoc' + + +# -- Options for LaTeX output ------------------------------------------------ + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'caching.tex', 'socket\\_protocol Documentation', + 'Dirk Alders', 'manual'), +] + + +# -- Options for manual page output ------------------------------------------ + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'caching', 'caching Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ---------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'caching', 'caching Documentation', + author, 'caching', 'One line description of project.', + 'Miscellaneous'), +] + + +# -- Options for Epub output ------------------------------------------------- + +# Bibliographic Dublin Core info. +epub_title = project + +# The unique identifier of the text. This can be a ISBN number +# or the project homepage. +# +# epub_identifier = '' + +# A unique identification for the text. +# +# epub_uid = '' + +# A list of files that should not be packed into the epub file. +epub_exclude_files = ['search.html'] + + +# -- Extension configuration ------------------------------------------------- diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..d367f78 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,23 @@ +.. socket_protocol documentation master file, created by + sphinx-quickstart on Fri Jan 1 19:56:01 2021. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to cachings's documentation! +==================================== + +.. automodule:: caching + :members: + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/mqtt b/docs/mqtt new file mode 120000 index 0000000..fa77920 --- /dev/null +++ b/docs/mqtt @@ -0,0 +1 @@ +../pylibs/mqtt \ No newline at end of file diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..5451033 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,4 @@ +sphinx +python-docs-theme +paho-mqtt + diff --git a/pylibs/fstools b/pylibs/fstools new file mode 160000 index 0000000..9237f6f --- /dev/null +++ b/pylibs/fstools @@ -0,0 +1 @@ +Subproject commit 9237f6f7f77eed79b8163077c1b4d87189193fbe diff --git a/pylibs/mqtt b/pylibs/mqtt new file mode 160000 index 0000000..cf7250c --- /dev/null +++ b/pylibs/mqtt @@ -0,0 +1 @@ +Subproject commit cf7250c05c99ba0698b3a960e7b8a445b9dad649 diff --git a/pylibs/report b/pylibs/report new file mode 160000 index 0000000..74e6f20 --- /dev/null +++ b/pylibs/report @@ -0,0 +1 @@ +Subproject commit 74e6f20d09cf76b3fbbdfa04c192b01708e50d5d diff --git a/pylibs/rspec b/pylibs/rspec new file mode 160000 index 0000000..1a941be --- /dev/null +++ b/pylibs/rspec @@ -0,0 +1 @@ +Subproject commit 1a941be7e01af8ba468c829933eb4f3db7b04330 diff --git a/pylibs/unittest b/pylibs/unittest new file mode 160000 index 0000000..bc0672b --- /dev/null +++ b/pylibs/unittest @@ -0,0 +1 @@ +Subproject commit bc0672bec78e821a59ce63ccd4dfa69f95196a48 diff --git a/unittest/Makefile b/unittest/Makefile new file mode 120000 index 0000000..a053924 --- /dev/null +++ b/unittest/Makefile @@ -0,0 +1 @@ +../pylibs/unittest/scripts/Makefile \ No newline at end of file diff --git a/unittest/requirements.txt b/unittest/requirements.txt new file mode 100644 index 0000000..c3bd74d --- /dev/null +++ b/unittest/requirements.txt @@ -0,0 +1,5 @@ +coverage +jinja2 +distro +paho-mqtt + diff --git a/unittest/src/config.py b/unittest/src/config.py new file mode 100644 index 0000000..d48fa18 --- /dev/null +++ b/unittest/src/config.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +# -*- coding: UTF-8 -*- + +import optparse +import os +import mqtt as lib + +release_unittest_version = 'c939a2bf3448ed3a941b618e1565d224' +lib_path = os.path.realpath(lib.__path__[0]) +additional_loggers_to_catch = [] + +if __name__ == "__main__": + parser = optparse.OptionParser("usage: %prog [options] folder_for_document") + parser.add_option("-p", "--path", dest="libpath", action="store_true", default=False, help="prints the library path") + (options, args) = parser.parse_args() + + if options.libpath: + print(lib_path) diff --git a/unittest/src/fstools b/unittest/src/fstools new file mode 120000 index 0000000..972cabe --- /dev/null +++ b/unittest/src/fstools @@ -0,0 +1 @@ +../../pylibs/fstools \ No newline at end of file diff --git a/unittest/src/mqtt b/unittest/src/mqtt new file mode 120000 index 0000000..c8c2bf9 --- /dev/null +++ b/unittest/src/mqtt @@ -0,0 +1 @@ +../../pylibs/mqtt \ No newline at end of file diff --git a/unittest/src/report b/unittest/src/report new file mode 120000 index 0000000..75e7c6c --- /dev/null +++ b/unittest/src/report @@ -0,0 +1 @@ +../../pylibs/report \ No newline at end of file diff --git a/unittest/src/rspec b/unittest/src/rspec new file mode 120000 index 0000000..a6d14cd --- /dev/null +++ b/unittest/src/rspec @@ -0,0 +1 @@ +../../pylibs/rspec \ No newline at end of file diff --git a/unittest/src/tests/__init__.py b/unittest/src/tests/__init__.py new file mode 100644 index 0000000..f2f81a9 --- /dev/null +++ b/unittest/src/tests/__init__.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python +# -*- coding: UTF-8 -*- + +import mqtt + +from report import TCEL_FULL +from report import TCEL_SHORT +from report import TCEL_SINGLE +from report import TCEL_SMOKE + +from tests import test_rx + +execution_level = 'full' + +def testrun(tcl): + # + # caching.property_cache_json + # + tcl.testCase('description', TCEL_FULL, test_rx.receive) diff --git a/unittest/src/tests/test_rx.py b/unittest/src/tests/test_rx.py new file mode 100644 index 0000000..6578e41 --- /dev/null +++ b/unittest/src/tests/test_rx.py @@ -0,0 +1,2 @@ +def receive(tLogger): + tLogger.error("NYI") \ No newline at end of file diff --git a/unittest/src/unittest b/unittest/src/unittest new file mode 120000 index 0000000..d41489a --- /dev/null +++ b/unittest/src/unittest @@ -0,0 +1 @@ +../../pylibs/unittest \ No newline at end of file diff --git a/unittest/src/unittest.py b/unittest/src/unittest.py new file mode 100644 index 0000000..c59b6da --- /dev/null +++ b/unittest/src/unittest.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# + +import optparse +import os +import report +import unittest +import tests + +parser = optparse.OptionParser("usage: %prog [clean|run|coverage|pdf|copy|release]") +parser.add_option("-e", "--execution-level", dest="execution_level", default="full", help="sets the execution level [full | short | smoke | single]") +(options, args) = parser.parse_args() + + +if report.TCEL_REVERSE_NAMED.get(tests.execution_level, report.TCEL_FULL) < report.TCEL_REVERSE_NAMED.get(options.execution_level, report.TCEL_FULL): + options.execution_level = tests.execution_level + +unittest.run.unittest(options, args, os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) diff --git a/unittest/testresults/.gitkeep b/unittest/testresults/.gitkeep new file mode 100644 index 0000000..e69de29