It will be difficult to maintain files for each version of Python. It's more easy to use directives to separate Python 2 code from Python 3 code.
Note : py4lo uses Python 3 to pack scripts in ods files, but thoses scripts may be Python 2 scripts, e.g. for old versions of LO/OO. The version has to be specified with the python_version key of the toml file. The format has to be major.minor (currently, it's just major).
What would those directives like ? Well, just like the good old C preprocessor directive :
# py4lo: if python_version < 2.7
... some code ...
# py4lo: elif python_version < 3.0
... some other code ...
# py4lo: else
... some other code ...
# py4lo: endif
Parsing with shlex, a code for comparators. It has to be simple : no imbrication allowed.
It will be difficult to maintain files for each version of Python. It's more easy to use directives to separate Python 2 code from Python 3 code.
Note : py4lo uses Python 3 to pack scripts in ods files, but thoses scripts may be Python 2 scripts, e.g. for old versions of LO/OO. The version has to be specified with the
python_version
key of the toml file. The format has to bemajor.minor
(currently, it's justmajor
).What would those directives like ? Well, just like the good old C preprocessor directive :
Parsing with
shlex
, a code for comparators. It has to be simple : no imbrication allowed.