|
9 | 9 | """ |
10 | 10 |
|
11 | 11 | import re |
| 12 | +import os |
12 | 13 | import shutil |
13 | 14 | import sqlite3 |
14 | 15 | import subprocess |
|
18 | 19 | from typing import Dict, List, Optional, Set, Union |
19 | 20 | from git_bdiff import GitBDiff, GitInfo |
20 | 21 |
|
| 22 | + |
21 | 23 | class SuiteData: |
22 | 24 | """ |
23 | 25 | Class to gather info on a suite |
@@ -188,6 +190,8 @@ def populate_gitinfo(self) -> None: |
188 | 190 | """ |
189 | 191 |
|
190 | 192 | for dependency in self.dependencies: |
| 193 | + print(dependency) |
| 194 | + print(self.temp_directory) |
191 | 195 | self.dependencies[dependency]["gitinfo"] = GitInfo( |
192 | 196 | self.temp_directory / dependency |
193 | 197 | ) |
@@ -283,21 +287,18 @@ def read_rose_conf(self) -> Dict[str, str]: |
283 | 287 |
|
284 | 288 | def find_unknown_dependency(self, dependency: str) -> str: |
285 | 289 | """ |
286 | | - TEMPORARY |
287 | 290 | The primary dependency may be unset in the dependencies file. In this case find |
288 | | - it from the *_SOURCE variable in the rose-suite.conf. |
289 | | - TODO: Once cylc provides the location of the source code itself, this method |
290 | | - should be changed to use that instead, as then the _SOURCE variable will be |
291 | | - removed |
292 | | - """ |
293 | | - |
294 | | - var = f"{dependency.upper()}_SOURCE".replace('"', "") |
295 | | - if var not in self.rose_data: |
296 | | - raise RuntimeError(f"Cant determine source for {dependency}") |
297 | | - rval = self.rose_data[var] |
298 | | - if "$ROSE_ORIG_HOST" in rval: |
299 | | - rval = rval.replace("$ROSE_ORIG_HOST", self.rose_data["ROSE_ORIG_HOST"]) |
300 | | - return rval |
| 291 | + it from the CYLC_WORKFLOW_SRC_DIR variable that gets set in the |
| 292 | + flow-processed.cylc file |
| 293 | + """ |
| 294 | + |
| 295 | + log_file = self.suite_path / "log" / "scheduler" / "log" |
| 296 | + with open(log_file, "r") as f: |
| 297 | + for line in f: |
| 298 | + line = line.strip() |
| 299 | + if re.search(f"{dependency.upper()} SOURCE CLONE=", line): |
| 300 | + return line.split("=")[1].rstrip("/") |
| 301 | + raise RuntimeError(f"Unable to find source for dependency {dependency}") |
301 | 302 |
|
302 | 303 | def read_dependencies(self) -> Dict[str, Dict]: |
303 | 304 | """ |
|
0 commit comments