From f331958f9225ce6c599766bc03233e23b8a8c92f Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Tue, 3 Sep 2024 16:02:10 +0200 Subject: [PATCH] Move scripts to folder Signed-off-by: Oliver Tale-Yazdi --- Justfile | 8 ++++---- README.md | 16 ++++++++-------- manage.py => scripts/manage.py | 2 ++ requirements.txt => scripts/requirements.txt | 0 update-badges.py => scripts/update-badges.py | 13 +++++++++++-- update-calendar.py => scripts/update-calendar.py | 8 ++++++++ update-readme.py => scripts/update-readme.py | 5 ++--- 7 files changed, 35 insertions(+), 17 deletions(-) rename manage.py => scripts/manage.py (99%) rename requirements.txt => scripts/requirements.txt (100%) rename update-badges.py => scripts/update-badges.py (91%) rename update-calendar.py => scripts/update-calendar.py (94%) rename update-readme.py => scripts/update-readme.py (98%) diff --git a/Justfile b/Justfile index c383b43..e603d13 100644 --- a/Justfile +++ b/Justfile @@ -1,9 +1,9 @@ set quiet default: venv - venv/bin/python3 update-readme.py - venv/bin/python3 update-calendar.py - venv/bin/python3 update-badges.py + venv/bin/python3 scripts/update-readme.py + venv/bin/python3 scripts/update-calendar.py + venv/bin/python3 scripts/update-badges.py venv: #!/bin/bash @@ -12,5 +12,5 @@ venv: if [ ! -d "venv" ]; then # Create virtual environment python3 -m venv venv - venv/bin/pip install -r requirements.txt + venv/bin/pip install -r scripts/requirements.txt fi diff --git a/README.md b/README.md index 1c2861c..e3671d3 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Single source of truth regarding past and future releases of the Polkadot SDK. -This repo contains a [JSON schema](./releases-v1.schema.json) as schema for the [releases.json](./releases-v1.json) file that tracks all SDK releases. +This repo contains a [releases-v1.json](./releases-v1.json) file that tracks all SDK releases and a [JSON schema](./releases-v1.schema.json) to ensure that it is in canonical format. ## Calendar @@ -74,7 +74,7 @@ The two main goals of this repo are to improve: First, check the calendar when about 3 months passed from the publish date of the last release. Then subtract about 1.5 months from that and call the plan command with that date: ```bash -python3 manage.py release plan stable2412 2024-11-06 +python3 scripts/manage.py release plan stable2412 2024-11-06 ``` Then figure out when the first patch date should be; you have to select a Monday for the patching schedule to be calculated (errors if not a Monday). You should select either a week that is empty and has no schedule, or the one where the oldest release is currently being patched. @@ -83,7 +83,7 @@ The script will then count the how many-th monday of the month it is and begin l Example where we want the first patch to be cut off on 24024-07-29: ```bash -python3 manage.py backfill-patches stable2407 --start-date 2024-07-29 +python3 scripts/manage.py backfill-patches stable2407 --start-date 2024-07-29 ``` Then update the README to see the changes by running `just`. @@ -93,7 +93,7 @@ Then update the README to see the changes by running `just`. Run this command to cut off a release: ```bash -python3 manage.py release cutoff stable2407-2 2024-09-02 +python3 scripts/manage.py release cutoff stable2407-2 2024-09-02 ``` With `publish` likewise. @@ -102,10 +102,10 @@ With `publish` likewise. Two scripts are currently in place to: -- [manage.py](./manage.py) - manage the releases json file (plan, cutoff, publish, etc) -- [update-readme.py](./update-readme.py) - updates the README.md file with the data from the releases.json file -- [update-calendar.py](./update-calendar.py) - generates an iCal file from the releases.json file -- [update-badges.py](./update-badges.py) - re-generate the badges in the `badges` folder for downstream use. +- [manage.py](./scripts/manage.py) - manage the releases json file (plan, cutoff, publish, etc) +- [update-readme.py](./scripts/update-readme.py) - updates the README.md file with the data from the releases.json file +- [update-calendar.py](./scripts/update-calendar.py) - generates an iCal file from the releases.json file +- [update-badges.py](./scripts/update-badges.py) - re-generate the badges in the `badges` folder for downstream use. ## Roadmap diff --git a/manage.py b/scripts/manage.py similarity index 99% rename from manage.py rename to scripts/manage.py index ffb6f66..ddc4432 100644 --- a/manage.py +++ b/scripts/manage.py @@ -1,3 +1,5 @@ + + import argparse import json from datetime import datetime, timedelta diff --git a/requirements.txt b/scripts/requirements.txt similarity index 100% rename from requirements.txt rename to scripts/requirements.txt diff --git a/update-badges.py b/scripts/update-badges.py similarity index 91% rename from update-badges.py rename to scripts/update-badges.py index df5cfdd..d11b1ae 100644 --- a/update-badges.py +++ b/scripts/update-badges.py @@ -1,3 +1,12 @@ +""" +This script updates the SVG files in the badges folder. + +Just run it in its stock configuration from the root folder: + + python scripts/update-badges.py + +""" + import json import os import requests @@ -7,11 +16,11 @@ def download(url, filename): response = requests.get(url) - print(f"Downloading SVG from {url}") - + if response.status_code == 200: with open(filename, 'wb') as file: file.write(response.content) + print(f"Downloaded {filename}") else: raise Exception(f"Failed to download SVG. Status code: {response.status_code}") diff --git a/update-calendar.py b/scripts/update-calendar.py similarity index 94% rename from update-calendar.py rename to scripts/update-calendar.py index 27556cf..52b7026 100644 --- a/update-calendar.py +++ b/scripts/update-calendar.py @@ -1,3 +1,11 @@ +""" +Updates the iCal calendar file in the root directory. Just run it in the top level dir in its stock +configuration: + + python scripts/update-calendar.py + +""" + import json from datetime import datetime, timedelta from icalendar import Calendar, Event diff --git a/update-readme.py b/scripts/update-readme.py similarity index 98% rename from update-readme.py rename to scripts/update-readme.py index 8c282b3..55b2ed5 100644 --- a/update-readme.py +++ b/scripts/update-readme.py @@ -1,8 +1,7 @@ """ +Update the README.md from the root directory: -Update the README.md with: - -python3 update-readme.py + python3 scripts/update-readme.py """