Add metadata.json to themes created by me

This commit is contained in:
Thomas Pointhuber 2021-10-30 18:05:06 +02:00
parent d7424486a4
commit 80ef42a1e8
7 changed files with 146 additions and 6 deletions

View file

@ -3,6 +3,7 @@
import datetime
import hashlib
import json
import ntpath
import zipfile
from pathlib import Path
@ -57,6 +58,8 @@ def create_and_get_pcm(path):
if not metadata_path.exists():
return
print(f"* create schema for: {path}")
with metadata_path.open("rb") as f:
metadata_json = json.load(f)
@ -69,6 +72,7 @@ def create_and_get_pcm(path):
if not pkg_path.exists():
# create new package as it does not exist yet (new version)
print(f" * create package: {pkg_path}")
create_pcm_from_color_scheme(path, pkg_path)
# fill in package data
@ -113,7 +117,15 @@ def write_repository_json():
json.dump(repository_data, f, indent=4)
schema = create_and_get_pcm(ROOT_PATH / "solarized-dark")
if __name__ == "__main__":
# create all package zip files and return the full schema of each one
schemas = []
for path in ROOT_PATH.iterdir():
if path.is_dir():
schema = create_and_get_pcm(path)
if schema:
schemas.append(schema)
write_packages_json([schema])
write_repository_json()
# write packages.json and repository.json
write_packages_json(schemas)
write_repository_json()

View file

@ -1,5 +1,75 @@
{
"packages": [
{
"$schema": "https://gitlab.com/qu1ck/kicad/-/raw/pcm/kicad/pcm/schemas/pcm.v1.schema.json#",
"name": "black/white theme",
"description": "black-white color theme",
"description_full": "black-white color theme",
"identifier": "theme-black-white",
"type": "colortheme",
"author": {
"name": "Thomas Pointhuber",
"contact": {
"web": "https://github.com/pointhi/kicad-color-schemes/"
}
},
"maintainer": {
"name": "Thomas Pointhuber",
"contact": {
"web": "https://github.com/pointhi/kicad-color-schemes/"
}
},
"license": "CC0-1.0",
"resources": {
"Github": "https://github.com/pointhi/kicad-color-schemes"
},
"versions": [
{
"version": "1.0",
"status": "stable",
"kicad_version": "5.99",
"download_sha256": "8d0a7b4d6df84ef9aac98ce5426f6ccf8375b85f4fd03b6907d7ace3727bf789",
"download_size": 426,
"download_url": "https://raw.githubusercontent.com/pointhi/kicad-color-schemes/master/sw/theme-black-white_v1.0_pcm.zip",
"install_size": 851
}
]
},
{
"$schema": "https://gitlab.com/qu1ck/kicad/-/raw/pcm/kicad/pcm/schemas/pcm.v1.schema.json#",
"name": "solarized-light theme",
"description": "solarized-light color theme",
"description_full": "solarized-light color theme",
"identifier": "theme-solarized-light",
"type": "colortheme",
"author": {
"name": "Thomas Pointhuber",
"contact": {
"web": "https://github.com/pointhi/kicad-color-schemes/"
}
},
"maintainer": {
"name": "Thomas Pointhuber",
"contact": {
"web": "https://github.com/pointhi/kicad-color-schemes/"
}
},
"license": "CC0-1.0",
"resources": {
"Github": "https://github.com/pointhi/kicad-color-schemes"
},
"versions": [
{
"version": "1.0",
"status": "stable",
"kicad_version": "5.99",
"download_sha256": "69b95828244851185058788f105a38d9e0f4bf88b5365bc480cac2cfc52d7687",
"download_size": 930,
"download_url": "https://raw.githubusercontent.com/pointhi/kicad-color-schemes/master/solarized-light/theme-solarized-light_v1.0_pcm.zip",
"install_size": 1964
}
]
},
{
"$schema": "https://gitlab.com/qu1ck/kicad/-/raw/pcm/kicad/pcm/schemas/pcm.v1.schema.json#",
"name": "solarized-dark theme",

View file

@ -8,9 +8,9 @@
},
"name": "kicad-color-schemes repository by @pointhi",
"packages": {
"sha256": "49d1375c2c3161845a6c15dcc4f38558cc541817a91d0fa3358d318b8f007f51",
"update_time_utc": "2021-10-30 15:43:26",
"update_timestamp": 1635608606,
"sha256": "3b9af21722a9e6fbd5383499a6b489960627f384f879afd57fe55cb614510636",
"update_time_utc": "2021-10-30 16:03:13",
"update_timestamp": 1635609793,
"url": "https://raw.githubusercontent.com/pointhi/kicad-color-schemes/master/packages.json"
}
}

View file

@ -0,0 +1,29 @@
{
"$schema": "https://gitlab.com/qu1ck/kicad/-/raw/pcm/kicad/pcm/schemas/pcm.v1.schema.json#",
"name": "solarized-light theme",
"description": "solarized-light color theme",
"description_full": "solarized-light color theme",
"identifier": "theme-solarized-light",
"type": "colortheme",
"author": {
"name": "Thomas Pointhuber",
"contact": {
"web": "https://github.com/pointhi/kicad-color-schemes/"
}
},
"maintainer": {
"name": "Thomas Pointhuber",
"contact": {
"web": "https://github.com/pointhi/kicad-color-schemes/"
}
},
"license": "CC0-1.0",
"resources": {
"Github": "https://github.com/pointhi/kicad-color-schemes"
},
"versions": [{
"version": "1.0",
"status": "stable",
"kicad_version": "5.99"
}]
}

Binary file not shown.

29
sw/metadata.json Normal file
View file

@ -0,0 +1,29 @@
{
"$schema": "https://gitlab.com/qu1ck/kicad/-/raw/pcm/kicad/pcm/schemas/pcm.v1.schema.json#",
"name": "black/white theme",
"description": "black-white color theme",
"description_full": "black-white color theme",
"identifier": "theme-black-white",
"type": "colortheme",
"author": {
"name": "Thomas Pointhuber",
"contact": {
"web": "https://github.com/pointhi/kicad-color-schemes/"
}
},
"maintainer": {
"name": "Thomas Pointhuber",
"contact": {
"web": "https://github.com/pointhi/kicad-color-schemes/"
}
},
"license": "CC0-1.0",
"resources": {
"Github": "https://github.com/pointhi/kicad-color-schemes"
},
"versions": [{
"version": "1.0",
"status": "stable",
"kicad_version": "5.99"
}]
}

Binary file not shown.