[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ancient convert rules
Jean Abou Samra
Re: ancient convert rules
Sun, 30 Aug 2020 22:12:20 +0200
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0
Le 30/08/2020 à 21:06, David Kastrup a écrit :
Jonas Hahnfeld <email@example.com> writes:
For https://gitlab.com/lilypond/lilypond/-/issues/6024, I've been
looking at python/convertrules.py and wonder if we really need all
ancient rules starting from version 0.1.9. Right now, a majority of
these won't even apply because Python 3 is much pickier about bad
escape codes in the regular expressions. Example:
re.sub('\\musicalpitch', '\\pitch', s)
is wrong because \\ only escapes for the string and neither \m nor \p
are correct escapes in a regular expression. For this case, it's easy
to fix with raw strings and I think I was able to resolve most errors
so that all rules are able to run, but I've no way to guarantee that my
edits are correct.
To make the story short: Can we maybe instead drop any rules older than
2.12.0? Its last minor release 2.12.3 is more than 10 years ago.
Music tends to stick around really really long once entered. Admittedly
old convert-ly rules tended to be a lot less thorough than what we tend
to do now.
dak@lola:/usr/local/tmp/The-Mutopia-Project$ git grep -h '\\version'|sort
gives me something starting with
For the record, I finally figured out why we had different results: I
searching only the ftp/ directory. Naturally, what you did is more accurate.
What if we kept a legacy convert.ly that went from the origin to, say
2.12.0 that was still Python 2 based? And then had the new, Python 3-based
convert.ly start from 2.12.0?
This would provide a way for anybody who needed to get old source code up
to the current standard to do so, and would eliminate the burden of
converting the whole file to Python 3.
Maybe the solution is just to mention somewhere in the documentation of
convert-ly that if the user wants to upgrade from older that 2.12 or
they can use the convert-ly from LilyPond 2.18?
I definitely overlooked how often there are*too many* backslashes in
the code. So there are a lot more changes requried than what is in merge
Also, you fixed invalid escape sequences -- thanks for that! --, but
spot cases where there aren't many actual backslash characters in the
to escape backslashes in the regular expression (the second level of
escaping), like in Jonas'
original example. This is why it seems all ancient rules would require a
amount of work to be made to work with Python 3, if I understand correctly.
Re: ancient convert rules, Joram Noeck, 2020/08/30