Skip to content
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

Update deprecated and rename #137

Merged
merged 9 commits into from
Oct 4, 2024
Merged
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions util/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Utility scripts

## Check tool directory names

Verify that the path of all tools contains the name of the corresponding tool shed repository:
kostrykin marked this conversation as resolved.
Show resolved Hide resolved

```bash
./util/check_directory_names.py
```

## Use case: An input TIFF file is too large

Assuming that the TIFF file is an RGB file:
Expand Down
26 changes: 26 additions & 0 deletions util/check_directory_names.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/env python

import glob
import pathlib
import yaml


gia_root_path = pathlib.Path(__file__).resolve().parent.parent
gia_root_dir_names = [gia_root_path.name] + [p.name for p in gia_root_path.parents if p.name != '']


for path_str in glob.glob('./**/.shed.yml', recursive=True):

# Read the .shed.yml file:
shed_file_path = pathlib.Path(path_str).resolve()
with shed_file_path.open('r') as shed_file:
shed = yaml.safe_load(shed_file)
ts_repo_name = shed['name']

# Check that the toolshed repo name corresponds to one of the parent directory names:
parent_dir_names = frozenset(p.name for p in shed_file_path.parents if p.name != '') - frozenset(gia_root_dir_names)
if ts_repo_name not in parent_dir_names:
print(
f'{shed_file_path.relative_to(gia_root_path)}: '
f'{ts_repo_name} not in {", ".join(str(dir_name) for dir_name in parent_dir_names)}'
)
Loading