8 Commits

Author SHA1 Message Date
P. J. McDermott
1f1a68e94e Check for and fix copyrights.csv rows with wrong numbers of fields
This should prevent accidental uses of commas in fields without quotes.
It would have caught the previous issue of str.join() not quoting fields
that contain commas.  For now though, it found a different issue: three
rows added in commit c6313453143c had duplicated MD5 fields.
2024-02-07 11:12:55 +01:00
P. J. McDermott
5a048ad303 Fix how update_copyrights writes fields with commas
str.join() isn't smart enough to quote CSV fields when necessary, so
a field containing field separators (commas) would get parsed by the
second update_copyrights run as multiple fields.  Upon finding some rows
containing an extra field, the csv.reader() object then added an extra
blank field to each of all the other rows.

Use csv.writer() instead of str.join() to write proper CSV output.

This commit also undoes the removal of commas from fields that was
necessary in commit 676c1fa2b98.
2024-02-07 11:12:55 +01:00
P. J. McDermott
4c87a4be74 Fix license on LordBob's portraits, and check licenses
Commit 97c8feb8ca3b (pull #7903) specified for 58 of LordBob's portraits
a license of "GNU GPL v2+;CC BY-SA 4.0".  I don't know if the semicolon
is supposed to mean "and" or "or".

"And" (e.g. a GNU GPL v2+ file with CC BY-SA 4.0 modifications) isn't
legally possible.  "Or" appears incorrect, because LordBob [licensed][1]
his portraits under "the GNU GPL" and I can't find any evidence of him
also licensing them under CC BY-SA 4.0.

Also make update_copyrights check for possibly invalid licenses like
"GNU GPL v2+;CC BY-SA 4.0".

[1]: https://forums.wesnoth.org/viewtopic.php?p=329342#p329342
2024-01-30 21:20:10 -06:00
P. J. McDermott
efad8a0f74 Fix and check copyrights.csv "Needs Update" field
Commit 97c8feb8ca3b (pull #7903) included a comma in the "Notes" field
of four files, which instead of being enclosed in quotes, overflowed
into the "Needs Update" field.  So if those files are updated,
update_copyrights would clobber part of the notes.

Commit 1ecd4f4d599c (pull #8195) updated the "Date" field but didn't
clear "Needs Update" after update_copyrights set "Needs Update" and
"MD5" for data/core/images/units/monsters/raven/harbinger.png.

Make update_copyrights check for and warn about "Needs Update" instead
of clobbering it.  This should trigger CI failures if someone forgets
to update a row or accidentally puts into the "Needs Update" field
important information that shouldn't be clobbered on future updates.
2024-01-30 21:20:10 -06:00
Steve Cotton
441a2cf5e4 Check that every file in copyrights.csv has a license and author
Improve the error messages about the input file needing sorting,
to avoid confusion when successfully creating a sorted output
from an unsorted input.
2024-01-07 15:22:37 +01:00
Steve Cotton
e07acf71dc Check that copyrights.csv is sorted by filename
When the tool finds new or changed files, it puts them at the top of
the output .csv file for easy editing. However, this means that those
lines move when update_copyrights is run again. It also means that any
two PRs touching images are likely to have merge conflicts, as they'll
change line 2 of copyrights.csv.

Make the CI fail unless the file has been sorted again after editing.
2023-12-28 13:01:11 +01:00
pentarctagon
b46f9c7acc update_copyrights - improve performance a lot 2023-10-02 19:43:24 -05:00
pentarctagon
97c8feb8ca add image copyright tracking 2023-09-25 11:47:07 -05:00