diff --git a/create_repository.py b/create_repository.py index fc5bd81..8c01fdd 100644 --- a/create_repository.py +++ b/create_repository.py @@ -34,11 +34,19 @@ def create_pcm_from_color_scheme(path, resulting_file): with ZipFile(resulting_file, 'w', compression=zipfile.ZIP_DEFLATED) as zip: for json_file in path.glob("*.json"): if json_file.name == METADATA_FILEAME: + zip.write(json_file, json_file.name) continue - print(json_file) zip.write(json_file, f"colors/{json_file.name}") +def install_size_of_zip(zip_path): + install_size = 0 + with ZipFile(zip_path, 'r') as zip: + for file in zip.filelist: + install_size += zip.getinfo(file.filename).file_size + return install_size + + def create_and_get_pcm(path): metadata_path = path / METADATA_FILEAME if not metadata_path.exists(): @@ -59,16 +67,10 @@ def create_and_get_pcm(path): create_pcm_from_color_scheme(path, pkg_path) # fill in package data - install_size = 0 - with ZipFile(pkg_path, 'r') as zip: - for file in zip.filelist: - print(file.filename) - install_size += zip.getinfo(file.filename).file_size - metadata_version['download_sha256'] = sha256_of_file(pkg_path) metadata_version['download_size'] = pkg_path.stat().st_size metadata_version['download_url'] = f"{REPOSITORY_BASE_URI}/{path.name}/{pkg_name}" - metadata_version['install_size'] = install_size + metadata_version['install_size'] = install_size_of_zip(pkg_path) return metadata_json diff --git a/packages.json b/packages.json index 068523f..18f1007 100644 --- a/packages.json +++ b/packages.json @@ -28,10 +28,10 @@ "version": "1.0", "status": "stable", "kicad_version": "5.99", - "download_sha256": "ea0496aa0353e9b6e871c0057f1ead27b31738ed9d9dff2f28df766427e9e1ab", - "download_size": 516, + "download_sha256": "1722e017ec4c406e5b83c34d384859aca802ed3c773389423ce245431fc4397f", + "download_size": 922, "download_url": "https://raw.githubusercontent.com/pointhi/kicad-color-schemes/master/solarized-dark/theme-solarized-dark_v1.0_pcm.zip", - "install_size": 1091 + "install_size": 1954 } ] } diff --git a/repository.json b/repository.json index abb567f..211c190 100644 --- a/repository.json +++ b/repository.json @@ -8,9 +8,9 @@ }, "name": "kicad-color-schemes repository by @pointhi", "packages": { - "sha256": "72f613fa99c990ca677e8c351e118b3c6db2a02e3ccc331ff835affe52de88fc", - "update_time_utc": "2021-10-30 15:38:14", - "update_timestamp": 1635608294, + "sha256": "49d1375c2c3161845a6c15dcc4f38558cc541817a91d0fa3358d318b8f007f51", + "update_time_utc": "2021-10-30 15:43:26", + "update_timestamp": 1635608606, "url": "https://raw.githubusercontent.com/pointhi/kicad-color-schemes/master/packages.json" } } \ No newline at end of file diff --git a/solarized-dark/theme-solarized-dark_v1.0_pcm.zip b/solarized-dark/theme-solarized-dark_v1.0_pcm.zip index 50fbcc2..08c889d 100644 Binary files a/solarized-dark/theme-solarized-dark_v1.0_pcm.zip and b/solarized-dark/theme-solarized-dark_v1.0_pcm.zip differ