Skip to content

Commit

Permalink
Merge pull request #137 from kostrykin/update-deprecated-and-rename
Browse files Browse the repository at this point in the history
Update deprecated and rename
  • Loading branch information
kostrykin authored Oct 4, 2024
2 parents 2266053 + e1acdbe commit 5bf3d88
Show file tree
Hide file tree
Showing 36 changed files with 34 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 or the name of a tool suite.

```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)}'
)

0 comments on commit 5bf3d88

Please sign in to comment.