Skip to content

Commit

Permalink
import registyr repath-script to this repo, with added comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Phaqui committed Jan 27, 2025
1 parent ae71a3d commit e0322e1
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions repath.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env python3

"""
Small script to change the pointed-to-data paths inside the regsitry files
to match the new setup on gtweb-02. Inside the container image, the CWB files
are mounted as /corpora/registry/ and /corpora/data/
The script may need adjusting for the various places it is run. The paths are
different on local machines, as opposed to servers.
"""

# the lines we want to change are like this:
# HOME /corpora/gt_cwb/data/xxx_category_yyyymmdd

import re
from pathlib import Path

cwd = Path(".").resolve()

for path in Path("registry").iterdir():
contents = path.read_text()
name = path.name
contents = re.sub("HOME .*", f"HOME /corpora/data/{name}", contents)
contents = re.sub("INFO .*", f"INFO /corpora/data/{name}/.info", contents)
path.write_text(contents)

print("done")

0 comments on commit e0322e1

Please sign in to comment.