Add script for updating flags from Wikimedia #721
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It's rudimentary and doesn't do anything beyond updating the flags — it doesn't carry out any actual comparisons and it doesn't prepare a log of changes from the Wikimedia page. IMO the former (comparison) wouldn't actually be useful, since the user can easily use whatever tool they prefer, but the latter (either preparing a digest or maybe just opening the relevant Wikimedia description page in a browser), might. OTOH I'm not sure what's the best way to do the latter, especially when there are many changed flags, so I'm leaving this for now.
The script might end up needing tweaks once I go through the ton of flags apparently needing updates, in case there are any ways to avoid false positives. Some are not easily unavoidable, likely caused by changes to svgo (e.g. the flag of Abkhazia now has the semantically-equivalent
27.97 114instead of27.97L114in one place, almost certainly due to svgo (the current version on Wikimedia hasL, there, so it's not due to tweaks on Wikimedia)).As discussed in the linked issue, it might turn out necessary to pin the svgo version (installing it with npm/yarn etc.), but this won't help much for the now since different svgo versions might have been used for different files, in the past. (I'm also hesitant adding another package manager to our repo, (contributors having to install both python/pipenv and nodejs) though if it's only for this one use-case maybe it's not a major problem.) OTOH if we don't resolve this now (switching to a single svgo version) it'll continue to annoy us in the future, especially if we want an automated/semi-automated workflow. OTOTOH I think we're currently in the exploratory phase (whether the script is actually useful at all), so overcomplicating is probably unwise.
Fix #706.
Edit: Running the script in full, now that its design has been finalised (especially regarding rounding of widths) — I didn't want to hammer Wikimedia unnecessarily — it appears that there are 210 flags to update 😱, and looking at the first several it appears that most are legit (at least to the extent that upstream (Wikimedia) has indeed changed (in one case (Australia) I have doubts about the soundness of the changes)); one (Abkhazia) is due to
svgoand one (Argentina) is due to previous minor conversion issues.