-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CI: Transition from s4ext to json #2011
Merged
Merged
Commits on Apr 23, 2024
-
ENH: Convert s4ext to json files
A script like the following was used. Note that "pre-commit run -a" was also executed to reformat the json files afterward. ``` import json import sys from pathlib import Path extensions_index_dir = Path("/home/jcfr/Projects/ExtensionsIndex") updated_extensions_index_dir = extensions_index_dir def parse_s4ext(ext_file_path): """Parse a Slicer extension description file. :param ext_file_path: Path to a Slicer extension description file. """ ext_metadata = {} with open(ext_file_path) as ext_file: for line in ext_file: if not line.strip() or line.startswith("#"): continue fields = [field.strip() for field in line.split(' ', 1)] assert(len(fields) <= 2) ext_metadata[fields[0]] = fields[1] if len(fields) == 2 else None return ext_metadata s4ext_filepaths = list(extensions_index_dir.glob("*.s4ext")) print(f"Found {len(s4ext_filepaths)} extension files (.s4ext)") for index, filepath in enumerate(s4ext_filepaths): metadata = parse_s4ext(filepath) updated_metadata = { "scm_url": metadata["scmurl"], "scm_revision": metadata["scmrevision"], "build_dependencies": [] if metadata.get("depends", "NA") == "NA" else metadata["depends"].split(" "), "category": metadata["category"], "build_subdirectory": metadata["build_subdirectory"], } with open(updated_extensions_index_dir / f"{filepath.stem}.json", 'w') as fileContents: fileContents.write(json.dumps(updated_metadata, sort_keys=True, indent=2)) fileContents.write("\n") print(f"Generated {index + 1} extension files (.json)") from pprint import pprint as pp print(f"\nMetadata of extension #{index + 1} ({filepath.stem}):\n") pp(updated_metadata) ```
Configuration menu - View commit details
-
Copy full SHA for a198447 - Browse repository at this point
Copy the full SHA a198447View commit details -
CI: Update workflows and templates to expect json files
Update GitHub and CircleCI settings to check for json files. Update `check_description_files` CLI to parse json files: * Remove `parse_s4ext` and introduce `parse_json` function along with `ExtensionParseError` exception. * Update list of supported URL schemes. Only `https` and `git` are supported * Remove obsolete `check_scm_notlocal` check
Configuration menu - View commit details
-
Copy full SHA for d68c8e5 - Browse repository at this point
Copy the full SHA d68c8e5View commit details -
Configuration menu - View commit details
-
Copy full SHA for e64a350 - Browse repository at this point
Copy the full SHA e64a350View commit details
Commits on Apr 24, 2024
-
ENH: Update .json files to reference schema
A script like the following was used. Note that "pre-commit run -a" was also executed to reformat the json files afterward. ``` import json import sys from pathlib import Path extensions_index_dir = Path("/home/jcfr/Projects/ExtensionsIndex") json_filepaths = list(extensions_index_dir.glob("*.json")) print(f"Found {len(json_filepaths)} extension files (.json)") for index, filepath in enumerate(json_filepaths): with open(filepath) as fileContents: metadata = json.load(fileContents) metadata["$schema"] = "https://raw.githubusercontent.com/Slicer/Slicer/main/Schemas/slicer-extension-catalog-entry-schema-v1.0.0.json#" with open(extensions_index_dir / filepath, 'w') as fileContents: fileContents.write(json.dumps(metadata, sort_keys=True, indent=2)) fileContents.write("\n") ```
Configuration menu - View commit details
-
Copy full SHA for d5a6233 - Browse repository at this point
Copy the full SHA d5a6233View commit details -
Configuration menu - View commit details
-
Copy full SHA for 80e05b4 - Browse repository at this point
Copy the full SHA 80e05b4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2a00294 - Browse repository at this point
Copy the full SHA 2a00294View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0b4f9cd - Browse repository at this point
Copy the full SHA 0b4f9cdView commit details
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.