Change to new Make concept
This commit is contained in:
parent
8c9d4f794c
commit
f1caa2050c
18
.gitmodules
vendored
18
.gitmodules
vendored
@ -1,27 +1,27 @@
|
||||
[submodule "state_machine"]
|
||||
path = state_machine
|
||||
path = pylibs/state_machine
|
||||
url = https://git.mount-mockery.de/pylib/state_machine
|
||||
[submodule "socket_protocol"]
|
||||
path = socket_protocol
|
||||
path = pylibs/socket_protocol
|
||||
url = https://git.mount-mockery.de/pylib/socket_protocol
|
||||
[submodule "stringtools"]
|
||||
path = stringtools
|
||||
path = pylibs/stringtools
|
||||
url = https://git.mount-mockery.de/pylib/stringtools
|
||||
[submodule "report"]
|
||||
path = report
|
||||
path = pylibs/report
|
||||
url = https://git.mount-mockery.de/pylib/report
|
||||
[submodule "task"]
|
||||
path = task
|
||||
path = pylibs/task
|
||||
url = https://git.mount-mockery.de/pylib/task
|
||||
[submodule "caching"]
|
||||
path = caching
|
||||
path = pylibs/caching
|
||||
url = https://git.mount-mockery.de/pylib/caching
|
||||
[submodule "tcp_socket"]
|
||||
path = tcp_socket
|
||||
path = pylibs/tcp_socket
|
||||
url = https://git.mount-mockery.de/pylib/tcp_socket
|
||||
[submodule "fstools"]
|
||||
path = fstools
|
||||
path = pylibs/fstools
|
||||
url = https://git.mount-mockery.de/pylib/fstools
|
||||
[submodule "helpers"]
|
||||
path = helpers
|
||||
path = pylibs/helpers
|
||||
url = https://git.mount-mockery.de/pylib/helpers
|
||||
|
178
Makefile
178
Makefile
@ -1,67 +1,133 @@
|
||||
# Minimal makefile for Sphinx documentation
|
||||
#
|
||||
# git helper Makefile: Version 2.5 (2025-08-11)
|
||||
default: help
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = venv/bin/sphinx-build
|
||||
SOURCEDIR = .
|
||||
BUILDDIR = _build
|
||||
MODULES = $(sort \
|
||||
caching\
|
||||
fstools\
|
||||
helpers\
|
||||
socket_protocol\
|
||||
state_machine\
|
||||
stringtools\
|
||||
stringtools.csp\
|
||||
stringtools.stp\
|
||||
task\
|
||||
tcp_socket\
|
||||
)
|
||||
.ONESHELL:
|
||||
SHELL = /usr/bin/bash
|
||||
MAKEFLAGS += --no-print-directory
|
||||
.SILENT:
|
||||
|
||||
# Put it first so that "make" without argument is like "make help".
|
||||
-include __make.d__/*.mk
|
||||
|
||||
.PHONY: all help Makefile
|
||||
GIT_FLAG = ./.git
|
||||
VENV_FLAG = ./.venv_required
|
||||
VENV_FOLDER = ./venv
|
||||
|
||||
all: index.rst $(MODULES) html
|
||||
localhelp:
|
||||
|
||||
help:
|
||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
echo "Possible common options are:"
|
||||
echo " - init - Initialise the repository and all folders below with a Makefile"
|
||||
echo " - giti - Get the git status of all submodules including their submodules"
|
||||
echo " - update_submodules - Set all submodules to remote master"
|
||||
echo " - venv_flag - Set the venev flag for the base folder. A venv will be generated"
|
||||
echo " - clean - clean up"
|
||||
echo " - deepclean - clean up this and all Makefiles below"
|
||||
$(MAKE) localhelp
|
||||
echo "You are able to create files make.d/*.mk and add local rules there. "
|
||||
echo " - localinit: print_head - Will be executed as last step in the init process."
|
||||
echo " - localhelp: print_head - Will be executed in th middle of the help text generation"
|
||||
echo " - localclean:print_head - Will be executed before the clean rule"
|
||||
|
||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||
html: Makefile
|
||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
localinit:
|
||||
|
||||
clean: Makefile
|
||||
rm -f *.rst
|
||||
@for module in $(MODULES) ; do \
|
||||
if [ -d "$$module/_examples_" ]; then make --no-print-directory -C $$module/_examples_ clean; fi \
|
||||
done
|
||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
||||
index.rst: Makefile
|
||||
@echo Generating $@
|
||||
@echo "Indices and tables\n==================\n\n* :ref:\`genindex\`\n* :ref:\`modindex\`\n* :ref:\`search\`\n" > $@
|
||||
@echo "Modules\n=======\n\n.. toctree::\n :maxdepth: 2\n" >> $@
|
||||
|
||||
%: Makefile
|
||||
@echo "Preparing $@"
|
||||
@echo ".. automodule:: $@\n :members:" > $@.rst
|
||||
@if [ "$(findstring .,$@)" != "." ]; then \
|
||||
git -C $@ checkout master 2>&1; \
|
||||
git -C $@ pull 2>&1;\
|
||||
make -C $@/_examples_ all; \
|
||||
fi
|
||||
@echo " $@.rst" >> index.rst; \
|
||||
|
||||
update:
|
||||
git pull
|
||||
init: print_head
|
||||
# Init git repo
|
||||
if [[ -e $(GIT_FLAG) ]]; then
|
||||
echo -e "\033[1;33mInitialising git submodules...\e[0m"
|
||||
git submodule init
|
||||
git submodule update
|
||||
git submodule foreach git checkout master
|
||||
git submodule foreach git pull
|
||||
echo
|
||||
fi
|
||||
# Init submodules
|
||||
SUBDIRS=$$(find . -maxdepth 2 -mindepth 2 -name Makefile | sort)
|
||||
for subdir in $$SUBDIRS; do
|
||||
$(MAKE) --no-print-directory -C $$(dirname $$subdir) init
|
||||
done
|
||||
if [[ $$SUBDIRS = *[![:space:]]* ]]; then
|
||||
$(MAKE) print_head
|
||||
fi
|
||||
# Create venv if needed
|
||||
if [[ -e $(VENV_FLAG) ]]; then
|
||||
BASEPATH=$$(pwd -P)
|
||||
#
|
||||
# Create venv
|
||||
#
|
||||
if [ ! -e venv ];then
|
||||
echo -e "\033[1;33mCreating venv in $$BASEPATH...\e[0m"
|
||||
python3 -m venv $$BASEPATH/venv > /dev/null 2>&1
|
||||
else
|
||||
echo -e "\033[1;33mVirtualenv already exists in $$BASEPATH...\e[0m"
|
||||
fi
|
||||
echo
|
||||
|
||||
copy:
|
||||
rsync -av --delete _build/html/ /data/docker/apache/pylib_docs
|
||||
chown www-data.www-data -R /data/docker/apache/pylib_docs
|
||||
#
|
||||
# Install modules
|
||||
#
|
||||
echo -e "\033[1;33mInstalling modules to venv in $$BASEPATH...\e[0m"
|
||||
for req_file in $$(find -L $$BASEPATH -name requirements.txt 2> /dev/null); do
|
||||
# echo " $$req_file"
|
||||
while read req_mod; do
|
||||
if [[ $$req_mod = *[![:space:]]* ]]; then
|
||||
# req_mod is not empty
|
||||
OUT=$$($$BASEPATH/venv/bin/pip install -U $$req_mod 2>&1 )
|
||||
if [[ $$OUT =~ "Successfully installed" ]]; then
|
||||
echo -e " * \033[1;32m$$req_mod installed.\e[0m"
|
||||
elif [[ $$OUT =~ "already satisfied" ]]; then
|
||||
echo -e " * \033[1;36m$$req_mod already installed.\e[0m"
|
||||
else
|
||||
echo -e " * \033[1;31m$$req_mod installation FAILED!\e[0m"
|
||||
#echo $$OUT
|
||||
fi
|
||||
fi
|
||||
done < $$req_file
|
||||
done
|
||||
echo
|
||||
fi
|
||||
# Start local init
|
||||
echo -e "\033[1;33mDoing localinit...\e[0m"
|
||||
$(MAKE) localinit
|
||||
|
||||
update_submodules:
|
||||
git submodule foreach "git fetch && git checkout master && git pull && git submodule init && git submodule update"
|
||||
|
||||
giti_this: print_head
|
||||
giti
|
||||
echo " Submodules:"
|
||||
git submodule --quiet foreach "echo -n ' ' && giti"
|
||||
|
||||
giti:
|
||||
git submodule --quiet foreach "[ -e Makefile ] && make --no-print-directory giti_this || :"
|
||||
|
||||
localclean:
|
||||
|
||||
clean: localclean
|
||||
if [[ ! -e $(VENV_FLAG) ]]; then
|
||||
if [[ -d $(VENV_FOLDER) ]]; then
|
||||
rm -rf $(VENV_FOLDER)
|
||||
fi
|
||||
fi
|
||||
|
||||
cleanall: clean
|
||||
for subdir in $$(find . -maxdepth 2 -mindepth 2 -name Makefile | sort); do
|
||||
$(MAKE) --no-print-directory -C $$(dirname $$subdir) cleanall
|
||||
done
|
||||
|
||||
|
||||
venv_flag:
|
||||
if [[ ! -e $(VENV_FLAG) ]]; then
|
||||
touch $(VENV_FLAG)
|
||||
if [[ -e $(GIT_FLAG) ]]; then
|
||||
git add $(VENV_FLAG)
|
||||
fi
|
||||
fi
|
||||
|
||||
print_head:
|
||||
DIRNAME=$$(basename $$(pwd))
|
||||
DIRLENGTH=$${#DIRNAME}
|
||||
echo -ne "\n\n\033[1;34m╔═"
|
||||
for i in $$(seq 1 $$DIRLENGTH); do echo -n "═"; done
|
||||
echo -e "═╗"
|
||||
echo -e "║ $$DIRNAME ║"
|
||||
echo -ne "╚═"
|
||||
for i in $$(seq 1 $$DIRLENGTH); do echo -n "═"; done
|
||||
echo -e "═╝\033[00m"
|
||||
|
28
__make.d__/docs.mk
Normal file
28
__make.d__/docs.mk
Normal file
@ -0,0 +1,28 @@
|
||||
SPHINXBUILD = venv/bin/sphinx-build
|
||||
SPHINXAPIDOC = venv/bin/sphinx-apidoc
|
||||
SOURCEDIR = pylibs
|
||||
BUILDDIR = _build
|
||||
|
||||
all: html
|
||||
|
||||
pylibs/modules.rst:
|
||||
$(SPHINXAPIDOC) -Mo $(SOURCEDIR) $(SOURCEDIR)
|
||||
|
||||
examples:
|
||||
for d in $$(find pylibs/**/_examples_ -name Makefile -exec dirname {} \;); do make -C $$d; done
|
||||
|
||||
html: pylibs/modules.rst examples
|
||||
@$(SPHINXBUILD) --conf-dir . "$(SOURCEDIR)" "$(BUILDDIR)"
|
||||
|
||||
localclean:
|
||||
rm -f $(SOURCEDIR)/*.rst
|
||||
rm -rf $(BUILDDIR)/*
|
||||
for d in $$(find pylibs/**/_examples_ -name Makefile -exec dirname {} \;); do make -C $$d clean; done
|
||||
|
||||
update:
|
||||
git pull
|
||||
$(MAKE) update_submodules
|
||||
|
||||
copy:
|
||||
rsync -av --delete $(BUILDDIR)/ /data/docker/apache/pylib_docs
|
||||
chown www-data.www-data -R /data/docker/apache/pylib_docs
|
1
caching
1
caching
@ -1 +0,0 @@
|
||||
Subproject commit 9a1fa9e0ab586f228b5614747a1953f36fb03793
|
10
conf.py
10
conf.py
@ -14,7 +14,7 @@
|
||||
#
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.abspath('.'))
|
||||
sys.path.insert(0, os.path.abspath('./pylibs'))
|
||||
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
@ -54,14 +54,14 @@ templates_path = ['_templates']
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
master_doc = 'modules'
|
||||
|
||||
# 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 = None
|
||||
language = 'en'
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
@ -88,7 +88,9 @@ html_theme = 'python_docs_theme'
|
||||
# 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']
|
||||
#
|
||||
# html_static_path = ['_static']
|
||||
html_static_path = []
|
||||
|
||||
# Custom sidebar templates, must be a dictionary that maps document names
|
||||
# to template names.
|
||||
|
1
fstools
1
fstools
@ -1 +0,0 @@
|
||||
Subproject commit 9237f6f7f77eed79b8163077c1b4d87189193fbe
|
1
helpers
1
helpers
@ -1 +0,0 @@
|
||||
Subproject commit c4f055189856dddf9f05c56189453370d25ba620
|
1
pylibs/caching
Submodule
1
pylibs/caching
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 3d79e803f62d92b860d4f8241ed2e8e1f7c16934
|
1
pylibs/fstools
Submodule
1
pylibs/fstools
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit ef8d79b1871839b662aa823c30ce912580995265
|
1
pylibs/helpers
Submodule
1
pylibs/helpers
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 9b04dc44607422052acc78d7cf191d1a43fcded6
|
1
pylibs/report
Submodule
1
pylibs/report
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit a7fd9404aa9fb3c977e38bee6aa6c794dbb04b1d
|
1
pylibs/socket_protocol
Submodule
1
pylibs/socket_protocol
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 449086b7c2f4055b409ef61301d36fbceef3aa4f
|
1
pylibs/state_machine
Submodule
1
pylibs/state_machine
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 2653d49a3e1eec2dec148b2eb77f83b1b3b9c176
|
1
pylibs/stringtools
Submodule
1
pylibs/stringtools
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 9054a66a6d8a5ffbac4c729b476da4c5102d186d
|
1
pylibs/task
Submodule
1
pylibs/task
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 93ada5fc6d4f945fbc7d5533465b13b7a951f976
|
1
pylibs/tcp_socket
Submodule
1
pylibs/tcp_socket
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit d8683e060658ad6da5a3b1e62b29842536737483
|
1
report
1
report
@ -1 +0,0 @@
|
||||
Subproject commit 7003c13ef8c7e7c3a55a545cbbad4039cc024a9f
|
@ -1 +0,0 @@
|
||||
Subproject commit 7f2b90c99030ac39f5bf7bfd92d1dd3d6c3657fa
|
@ -1 +0,0 @@
|
||||
Subproject commit aef99580e1cdc05e6ca80efe05461ab861d6ef39
|
@ -1 +0,0 @@
|
||||
Subproject commit e1f76d96312e540544b2328d0937b0aa41126aa9
|
1
task
1
task
@ -1 +0,0 @@
|
||||
Subproject commit af35e83d1f07fd4cb9070bdb77cf1f3bdda3a463
|
@ -1 +0,0 @@
|
||||
Subproject commit 72741ff81280a19c728cbc151f8b3b083220130e
|
Loading…
x
Reference in New Issue
Block a user