makerdao / spells-mainnet

Staging repo for MakerDAO weekly executive spells
GNU Affero General Public License v3.0
107 stars 43 forks source link

Maintenance: make time conversion script platform-independent #373

Closed SidestreamColdMelon closed 6 months ago

SidestreamColdMelon commented 7 months ago

This PR replaces time.sh script with the equivalent time.py script. The functionality and the interface of the new script stays exactly the same, but now it can be run across platforms. In comparison, the previous script didn't work on macOS and after a trial to fix it (see d623861) I decided to rewrite it in python to avoid inconsistencies.

amusingaxl commented 7 months ago

Looks like there's a good way to parse ISO8601 dates in Python 3: https://stackoverflow.com/a/49784038/1798341

SidestreamColdMelon commented 7 months ago

That was actually my undocumented intention to make script less smart and more strict with parsing. But supporting a single standard like ISO8601 is also a good choice. I've updated the script!

amusingaxl commented 7 months ago

LGTM. Should we also port this to Goerli? It will be deprecated soon, and we don't have many uses for it there, but it's fairly a small change. https://github.com/makerdao/spells-goerli/blob/master/scripts/time.sh