[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ancient convert rules

From: Jean Abou Samra
Subject: Re: ancient convert rules
Date: Sun, 30 Aug 2020 22:12:20 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Greetings everybody,

Le 30/08/2020 à 21:06, David Kastrup a écrit :
Jonas Hahnfeld <> writes:

For, I've been
looking at python/ 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

\version "1.9.8"

For the record, I finally figured out why we had different results: I had been
searching only the ftp/ directory. Naturally, what you did is more accurate.

What if we kept a legacy that went from the origin to, say
2.12.0 that was still Python 2 based?  And then had the new, Python 3-based 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 whatever,
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
request 363:

Also, you fixed invalid escape sequences -- thanks for that! --, but pylint can't spot cases where there aren't many actual backslash characters in the resulting string 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 decent
amount of work to be made to work with Python 3, if I understand correctly.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]