Closed askpatrickw closed 3 years ago
I think it has to do with longer strings. Importing everything might be a slow process. Perhaps we can update to account for the new format using regular expressions.
I should have written the description a little differently... The reason the multiline value fails is file is split on "\n" an then walked line by line... https://github.com/adafruit/circup/blob/master/circup.py#L330
Hmm... we could read in the file, remove all new lines and then regex out a value... Feels like a hack though. ;-)
You can do multiline regex. I'm just checked and it's doing regex currently, but likely isn't taking the parenthesis into account and may need to be adjusted to work on multiple lines. I did some multiline regex when working on this library: https://github.com/adafruit/Adafruit_Python_Shell/blob/master/adafruit_shell.py, but I can't remember the specifics.
This is also fixed in my PR. I took a simpler route. Since we were already reading in the whole file, I could look for all dunder matches, loop through them and add them to result without the use of exec() and without looping over the whole file line by line.
The way extract_metadata() walks a .py file assumes all dunder values are on the same line as the variable name does not work if the repo url is long enough that black reformats it and wrap with parenthesis.
So far, I've only seen this with 1 library:
I wonder if we can't import
__repo__
and__version__
or the whole library and get all the dunder globals... but I've not thought about it much yet.