Commit graph

76 commits

Author SHA1 Message Date
6dd594d47b Fix multiple Python 3 compatibility issues
Changes in Python 3 that made the code choke:

  o basestring is merged into str
  o print() needs parentesis
  o Class inheritance syntax changed
  o Abstract baseclass (ABCMeta) syntax changed
  o map.iteritems() is replaced by map.items()
  o Inconsistent use of tabs and spaces are no longer tolerated

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-10 16:38:59 +01:00
6eaad195a8 Fix padding after equal sign in makefiles
Padding should be done only if RHS is not empty.

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-06 13:38:42 +01:00
586f31d06c process-text-files.py: Add command cleanup-spaces
The command removes traling empty spaces from lines and trailing empty lines
from files.

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-04 21:18:13 +01:00
a4b447375a process-text-files.py: Add command indent-makefiles
The command is intended to reformat makefiles in a general fashion.
It currently only vertically aligns equal signs in makefiles.

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-03 17:11:57 +01:00
0cb09081eb process-text-files.py: Slightly beautify help message
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-01 14:10:16 +01:00
70117f9d34 Fix most brutal breakages introduced by commit 974a567
The cleanup commit 974a567 added some stub namespace-addition code to
project-text-files.py, which was never completed, but which broke all
other functionality of project-text-files.py. This commit doesn't
complete the implementation, but restores its previous functionality.

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-01 13:57:51 +01:00
101bad0617 $(MODDIR)/make/defs.mk: Set HDRDIR_SCOPE_PREFIX = $(PROJECT)
Set HDRDIR_SCOPE_PREFIX = $(PROJECT) by default.

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-02-27 17:40:39 +01:00
9baf68baa4 Rename LAST_RPM_VERSION to RELEASES
Signed-off-by: Jan Lindemann <jan@janware.com>
2018-12-16 12:07:11 +01:00
bfa30d5d20 Rename CVS_PROJ_DIR to PROJECTS_DIR
Signed-off-by: Jan Lindemann <jan@janware.com>
2018-12-16 11:42:57 +01:00
754b27af0b Release 1.0.0-4@centos-7/x86_64
Signed-off-by: janware DevOps <devops@janware.com>
2018-12-14 15:13:54 +01:00
fd125f07fe Add class Cmds
run_sub_commands() was the only way to access subcommands up to now,
Cmds.run() adds another interface, an object as a place to add
customizations affecting all commands, e.g. global command line
options.

Signed-off-by: Jan Lindemann <jan@janware.com>
2018-12-11 14:10:01 +01:00
4b7dad4b6b Release 1.0.0-4@suse-tumbleweed/x86_64
Signed-off-by: Jan Lindemann <jan@janware.com>
2018-12-01 15:52:44 +01:00
f0aad9afaf Start version: 1.0.0-4
Signed-off-by: janware DevOps <devops@janware.com>
2018-12-01 15:46:02 +01:00
7081768a5a Release 1.0.0-3@suse-tumbleweed/x86_64
Signed-off-by: janware DevOps <devops@janware.com>
2018-10-25 11:12:03 +02:00
8c768f6d59 Start version: 1.0.0-3
Signed-off-by: janware DevOps <devops@janware.com>
2018-10-25 11:10:19 +02:00
974a56793a project-text-files.py: Add CmdAddCppNamespace
This is an old patch, tackling namespace addition. Not finished, just
a cleanup commit.

Signed-off-by: Jan Lindemann <jan@janware.com>
2018-10-24 18:50:44 +02:00
e1974118b5 process-text-files.py: Fix file name matching
For some unbeknown reason, file names were compared case-invariantly
before deciding upon renaming them.

Signed-off-by: Jan Lindemann <jan@janware.com>
2018-03-16 15:02:09 +01:00
fc5241a2e8 Now excplicitly calling python2 executable instead of python
Signed-off-by: Jan Lindemann <jan@janware.com>
2018-01-02 13:09:06 +00:00
3ea89a7812 Explicitly set python version in hashbang
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-12-29 22:26:06 +01:00
0014310353 Release 1.0.0-2@suse-tumbleweed/x86_64
Signed-off-by: janware DevOps <devops@janware.com>
2017-12-26 23:25:19 +01:00
2f8c13e886 Start version: 1.0.0-2
Signed-off-by: janware DevOps <devops@janware.com>
2017-12-26 23:25:05 +01:00
e0d48b2dc7 Add process-text-files.py
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-12-20 20:08:23 +01:00
2b23026bfa Add HDRDIR_SCOPE_SUFFIX to ytools include files
Change ytools header location from #include <header.h> to
#include <ytools/header.h>.

Signed-off-by: Jan Lindemann <jan@janware.com>
2017-12-18 19:32:49 +01:00
d7a5c931b8 Merge branch 'master' of ssh://git.jannet.de/srv/git/jan/proj/jw-python
Signed-off-by: janware DevOps <devops@janware.com>
2017-12-17 16:04:00 +01:00
838ac06ebb Fix: StringTree misparsed key = "val # blah"
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-26 21:25:01 +01:00
150bf5fd69 test/trim-src: Fix: test.mk doesn't belong into the git repo
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-25 16:15:55 +01:00
cf60b29281 Add python-magic to pkg.os.requires
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-23 15:05:18 +01:00
ef79027b06 misc.py: Make process cleanup more robust
Eliminate a far chance of an exception thrown during process cleanup.

Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-22 09:52:22 +01:00
3d93d534db StringTree: Respect quoted quotes
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-22 09:34:26 +01:00
4a200c8851 misc.py: Add atomic_store()
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-22 09:33:18 +01:00
a9aadbad5a trim-src.py: Some beautification to whitespaces
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-18 16:59:23 +01:00
74a27f1c19 Add conf/profile
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-18 15:43:49 +01:00
24ba182fa1 Add script trim-src.py
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-18 15:42:09 +01:00
5a87040e10 stree/serdes.py: Allow quoted = in rhs of assignment
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-12 16:08:34 +01:00
c2c409ed4b Move grammar-related stuff into package jw-grammar
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-12 16:08:26 +01:00
930efae39f grammar.py: Add grammar_fix_list_recursion()
This replaces the mechanism to always construct lists with a leading
empty rule. This leads to many RR-conflicts, so this empty rule is omitted
and later added conditionally by grammar_fix_list_recursion(). Sadly,
the condition is bollocks, since it's always true.

Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-06 12:01:06 +01:00
a2e5f9e1c9 grammar.py: Fix duplicate and missing rules
- unroll_lists() sometimes introduced identical lists into a rule set
- unroll_options() sometimes chopped off a production's last rule

Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-05 18:30:57 +01:00
dafe6d34b2 generate-flex-bison.mk: Add dependency on config file
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-05 16:36:08 +01:00
7007c894b8 StringTree fix: Comments were not ignored in quotes
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-05 16:35:41 +01:00
07a328d9a8 grammar.py: Reimplement configured types
Add function grammar_add_configured_types() and keep configured types as
symbols as part of the grammar like all the others

Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-05 16:34:00 +01:00
c7ecfbff3a grammar.py: Add support for --start-symbols
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-04 11:05:39 +01:00
3cba245b77 grammar.py and friends: Improve line numbers and headers
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>
2017-11-03 12:54:19 +01:00
a3a8313ce8 grammar.py and friends: Make list parsing run through
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>
2017-11-02 13:47:19 +01:00
6ca2eeef61 StringTree parser: Add support for comments
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-02 11:47:04 +01:00
1a7a34f73c grammar.py and friends: Implement config file support
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-02 08:54:39 +01:00
214c222002 Add StringTree and friends
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-01 13:26:10 +01:00
16ce7abd93 grammar.py and friends: Make test/grammar compile and start
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>
2017-10-30 13:05:22 +01:00
8c5934725c grammar.py: Add support for --irrelevant-symbols
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>
2017-10-30 10:00:25 +01:00
6297f10f55 grammar.py et al: Centralize more code
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>
2017-10-29 18:25:55 +01:00
fee94deb48 grammar.py: Don't create productions for special sequences
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-10-29 14:18:52 +01:00