33d3b7a7b3
jwutils.Cmds: Cmd.add_subcommands() fails for multiple commands
...
jwutils.Cmd.add_subcommands() had two issues. First, it failed for more than one command, and with that fixed, it only added the first command of a list of commands passed as an argument. This commit fixes both issues and leaves some logging and cleanup in place, which was used during debugging.
Signed-off-by: Jan Lindemann <jan@janware.com>
2020-04-07 09:23:13 +02:00
6d6c48e6b8
jwutils.misc: Add get_derived_classes()
...
get_derived_classes(mod, baseclass) returns a list of class definitions from a module which are subclasses of baseclass.
Signed-off-by: Jan Lindemann <jan@janware.com>
2020-04-05 16:53:12 +02:00
fb6b205440
StringTree.__getitem__(): Return value child
...
StringTree.__getitem__() returned the node, now return its value child instead. That's nicer and closer to the expected behaviour, as it supports StringTree usage as a key-value store for configuration or so. It breaks the existing API, but I think I have fixed the only pace where it was used: jw-grammar/grammar.py.
Signed-off-by: Jan Lindemann <jan@janware.com>
2020-04-05 14:23:59 +02:00
edf861c985
jwutils.Cmds: Fix empty to cmds member variable
...
Cmds.cmds was sometimes empty, so fix that and make sure it points to the Cmds instance it was crated by. Actually the name of the Cmds class is a bad pick, should have been App or something, so to add .app, too, as a path for future compatibility.
Signed-off-by: Jan Lindemann <jan@janware.com>
2020-04-05 14:17:54 +02:00
c5b964a5bb
jwutils.Cmd: Add method add_subcommands()
...
Add method jwutils.Cmd.add_subcommands(). cmd.add_subcommands(C) will parse and invoke C as a subcommand of cmd, if C is of type jwutils.cmd.
Signed-off-by: Jan Lindemann <jan@janware.com>
2020-04-04 16:32:39 +02:00
ad67dd3832
jwutils.Cmds: Beautify log invocations
...
Add from jwutils import log to avoid unnecessary jwutils.log module path.
Signed-off-by: Jan Lindemann <jan@janware.com>
2020-04-04 13:43:08 +02:00
c0b31bb968
Release 1.0.0-12@suse-tumbleweed/x86_64
...
Signed-off-by: janware DevOps <devops@janware.com>
2020-05-10 09:55:50 +00:00
0d1634a3ed
Start version: 1.0.0-12
...
Signed-off-by: janware DevOps <devops@janware.com>
2020-05-10 09:55:29 +00:00
e48fa1b00a
Cmds.py: Add early evaluation of --log-xxx
...
jwutils.log.set_flags() and .set_level() is not set until after all commands are loaded. This can make debugging complicated. OTOH, command-line parsing is also not done until all commands are loaded, because they define the command line options. This commit adds some poor man's command line parsing for fetching --log-level and --log-flags only, and applying them before the commands are all loaded.
Signed-off-by: Jan Lindemann <jan@janware.com>
2020-04-04 11:39:01 +02:00
dc532704d0
StringTree: Add support for adding StringTree children
...
Add support for adding children of type StringTree. If a StringTree argument is passed to .add(), this should do the right thing. It makes use of the newly added .__add_children() method and involves quite a bit of hairy case distinctions.
Signed-off-by: Jan Lindemann <jan@janware.com>
2020-04-04 11:35:26 +02:00
dead9d9561
StringTree: add child_list()
...
Signed-off-by: Jan Lindemann <jan@janware.com>
2020-04-04 11:31:25 +02:00
160667b6a9
StringTree: Re-implement __str__()
...
Signed-off-by: Jan Lindemann <jan@janware.com>
2020-04-04 11:29:14 +02:00
020bb970bd
stree/serdes.py: Add support for kwarg "root_content"
...
parse() and read() up to present automatically set the root content of a StringTree object to "root". This can now be optionally defined by the "root_content" keyword argument.
Signed-off-by: Jan Lindemann <jan@janware.com>
2020-04-04 11:14:33 +02:00
79ebb798c7
slog_m(): Support kwarg "caller"
...
Treat slog_m() to a caller keyword argument, up to now only supported by slog().
Signed-off-by: Jan Lindemann <jan@janware.com>
2020-04-04 11:12:11 +02:00
70bfb51948
Release 1.0.0-11@suse-tumbleweed/x86_64
...
Signed-off-by: janware DevOps <devops@janware.com>
2020-02-10 19:00:10 +00:00
948d46311f
Start version: 1.0.0-11
...
Signed-off-by: janware DevOps <devops@janware.com>
2020-02-10 18:59:50 +00:00
a5bf929f14
Add missing async keywords to jwutils.Cmd.run() reimplementations
...
Signed-off-by: Jan Lindemann <jan@janware.com>
2020-02-10 19:49:46 +01:00
f04a9c4fb2
Release 1.0.0-10@suse-tumbleweed/x86_64
...
Signed-off-by: janware DevOps <devops@janware.com>
2020-02-10 13:58:57 +00:00
ad9eee07d4
Change dependencies python-magic|termcolor -> python3
...
This breaks on both openSUSE Tumbleweed and Ubuntu 18.04.
Signed-off-by: Jan Lindemann <jan@janware.com>
2020-02-10 13:54:42 +00:00
7dfe9cf91f
Start version: 1.0.0-10
...
Signed-off-by: janware DevOps <devops@janware.com>
2020-02-10 13:49:50 +00:00
08f9aae61a
log.get_caller_pos(): Implement frames > 1
...
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-12-30 17:46:20 +01:00
c2f229c95c
Release 1.0.0-9@suse-tumbleweed/x86_64
...
Signed-off-by: janware DevOps <devops@janware.com>
2019-12-27 16:22:01 +01:00
a8f8c7d6ce
Start version: 1.0.0-9
...
Signed-off-by: janware DevOps <devops@janware.com>
2019-12-27 16:14:11 +01:00
350c2147dd
process-text-files.py: Make it usable again
...
This --maxdepth / --name patch introduced broke run(). This commit fixes that.
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-12-25 11:44:48 +01:00
26d322023a
log.py: Improve console color implementation
...
o Remove unnecessary function prio_colors() o Don't output color codes on non-TTY output
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-12-23 18:01:53 +01:00
f810a7cdc1
Merge branch 'master' of ssh://git.janware.com/srv/git/jan/proj/jw-python
...
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-12-22 09:39:24 +00:00
2171e1e16e
log.py: Add support for flag "date"
...
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-12-21 19:08:51 +00:00
bdb6d48f59
process-text-files.py: Support --name and --maxdepth
...
Add support for --name (globbing pattern) and --maxdepth (as in find(1)).
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-12-20 11:39:40 +01:00
5578bd486a
process-text-files.py: Support --name and --maxdepth
...
Add support for --name (globbing pattern) and --maxdepth (as in find(1)).
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-12-20 11:39:40 +01:00
a85f0929c6
Consistently replace def run() by async def run()
...
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-12-20 08:41:58 +01:00
8a74e030dc
Add python-termcolor to package deps
...
Also fix package group (Development/Libraries/Python).
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-12-07 20:13:08 +01:00
89b4b5c05d
Release 1.0.0-8@ubuntu-18.04/amd64
...
Signed-off-by: janware DevOps <devops@janware.com>
2019-12-07 15:18:45 +00:00
13b58c2fa0
Change license from proprietary to LGPLv2
...
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-12-07 14:13:48 +00:00
d3faa8ee85
log.py: Add utilities, better list-support in slog_m()
...
- Add functions: append_to_prefix(), remove_from_prefix() set_filename_length() - Make slog_m() log one list item per line - Add console_color_chars(prio)
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-10-30 15:46:26 +01:00
c96ffe52c0
Add Process and Signals support
...
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-10-29 11:25:03 +01:00
6123a68195
Cmds.py: Run all commands in asyncio event loop
...
This commit makee Cmds run all sub-commands in an asyncio event loop. The event loop is currently passed to the commands, which seems unnecessary and looks like it's using a feature which is bound to be deprecated in the future.
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-10-28 13:12:18 +01:00
036a978130
log.py: Add slog_m() (multiline logging)
...
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-10-28 12:50:17 +01:00
1cdb38b767
log.py: Make some variables private
...
Add leading underscore to variables that should not be visible outside of log.py. Also do some indentation beautification.
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-10-28 10:59:20 +01:00
ddfb500fa2
Add misc.object_builtin_name()
...
object_builtin_name() is meant to derive an object name from its class name. Doesn't work well, but adding the code nonetheless for improving it later.
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-10-24 18:45:05 +02:00
1f122fae82
Rename the MODDIR makefile variable to JWBDIR
...
Rename the omnipresent MODDIR variable to JWBDIR, since that's more to the point.
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-06-29 23:32:20 +02:00
20baf30f03
Release 1.0.0-8@suse-tumbleweed/x86_64
...
Signed-off-by: janware DevOps <devops@janware.com>
2019-06-26 17:44:56 +00:00
dd23bc8737
Start version: 1.0.0-8
...
Signed-off-by: janware DevOps <devops@janware.com>
2019-06-26 17:44:41 +00:00
8d72fabe28
$(TOPDIR)/make: Beautify makefile indendation
...
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-06-25 22:56:59 +02:00
9a78398202
Rename variable PROJECTS_DIR to DEV_PROJECTS_DIR in proj.mk
...
PROJECTS_DIR is a final version of where the projects to be compiled against are. DEV_PROJECTS_DIR is merely a candidate, used in proj.mk, currently only there.
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-06-25 21:15:32 +02:00
e6e64d09fd
proj.mk: Allow MODDIR to be overridden from the environment
...
Make the MODDIR definition in proj.mk depend on the environment: - Change "=" assignment to "?=" - Prepend $(BUILD_TOOLS_PREFIX) to /opt/jw-build
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-06-19 13:18:54 +02:00
79ce30cec6
Release 1.0.0-7@suse-tumbleweed/x86_64
...
Signed-off-by: janware DevOps <devops@janware.com>
2019-06-04 10:41:56 +00:00
7158232efe
Start version: 1.0.0-7
...
Signed-off-by: janware DevOps <devops@janware.com>
2019-06-04 10:41:40 +00:00
c606d53ee8
Merge branch 'master' of ssh://git.jannet.de/srv/git/jan/proj/jw-python
...
Signed-off-by: janware DevOps <devops@janware.com>
2019-06-04 12:32:17 +02:00
2e543e9cfe
Release 1.0.0-6@suse-tumbleweed/x86_64
...
Signed-off-by: janware DevOps <devops@janware.com>
2019-06-03 09:11:36 +00:00
4471ddfd0f
Add forgotten jwutils/CppState.py
...
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-06-03 10:00:04 +02:00