Add pytest-style unit tests for the StringTree class.
This commit also adds the needed infrastructure: Dependency on
python3-pytest, the unit test directory structure and conftest.py in
.gitignore.
Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v0.80.2
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit does a couple of things in one go:
- Move the implementations from jw.util.Cmds and jw.util.Cmd back to
jwutils where they came from to remain backwards compatible for
code still using jwutils.
- No code uses jw.util.Cmds and jw.util.Cmd yet, so remove them.
- Add new jw.util.App and jw.util.Cmd classes instead, which are
re-exported modules from jw.pkg.lib. These implementations are very
similar, but not identical to jwutils.Cmds and jwutils.App.
Originally, Cmds and Cmd had been copied from jw-python to jw-pkg App
and Cmd, respectively, because an App class proved indispensible in
jw-pkg. The two classes have subsequently evolved in jw-pkg, and
re-using them here ends the fork and removes the redundancy.
This makes jw-python expose the same App / Cmd pair as jw.pkg does
for as long as Cmds is still in use. In the future, it might be a
good idea to remove Cmds, Cmd and App from jw-python entirely.
Signed-off-by: Jan Lindemann <jan@janware.com>
Depend on python3-networkx because ldap.Connection.object_class_tree needs it.
Note that this is a relatively weak necessity which installed 1.7 GB worth of
500 new packages on talmix.david.jannet. Maybe this can be solved in a less
costly way.
Signed-off-by: Jan Lindemann <jan@janware.com>
- Streamline proj.mk over all projects a little
- Turn the string "jw-build" into a variable which can be overridden from the
environment.
- Add support for JWBDIR_SEARCH_PATH, also overridable from the environment.
Signed-off-by: Jan Lindemann <jan@janware.com>
argcomplete takes the arguments added to argparse, and builds bash
completion with it. Add it to all Cmds based executables.
Signed-off-by: Jan Lindemann <jan@janware.com>
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>
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>
Line numbers of parsed input are now automatically maintained. More
needed data structures are now automatically created in the API header
file.
Signed-off-by: Jan Lindemann <jan@janware.com>
First time parsing doesn't error out with a syntax error. No usable AST
is produced, strings are not returned from lexer, and AST lists aren't
lists, really.
TEXT:="Hello world!"; had to be excluded from the example, because I
don't get how this could be parsed with the given syntax. There's a
special sequence "all visible characters", but any lexer regex I could
think of will also match the types defining "alphabetic character" and
return the respective tokens (e.g. T_A) or vice-versa, depending on the
order in the lexer input file. I suppose, the only sensible way to
handle this, is to define "all visible characters" by defining the
tokens for the missing characters, and then use them along T_A ... T_Z
or their derived types.
Signed-off-by: Jan Lindemann <jan@janware.com>
Doesn't successfully parse grammartest.code, yet, it errors out with a
syntax error on whitespace. But at least it compiles and starts.
Signed-off-by: Jan Lindemann <jan@janware.com>
Arguments to --irrelevant-symbols are not meant to be represented in the
AST resulting from parsing.
Also, add pad() to misc.py.
Signed-off-by: Jan Lindemann <jan@janware.com>
More code is removed from the special parser directories and centralized
into grammar.py, Cmd.py, and generate-flex-bison.mk.
Signed-off-by: Jan Lindemann <jan@janware.com>