Skip to content

Commit

Permalink
Merge pull request #12 from spack/database-creation
Browse files Browse the repository at this point in the history
  • Loading branch information
danlamanna authored Jul 19, 2023
2 parents 0ce1a2d + b3cf0df commit 37f94fc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions generate_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import spack.spec
import spack.binary_distribution

from spack.database import _DB_DIRNAME

here = Path(os.getcwd())
db_root = here / "spack-db"

Expand Down Expand Up @@ -161,15 +163,15 @@ def specs_by_package(name: str, url: str) -> dict[str, list[spack.spec.Spec]]:
index = response.json()

# Write index.json to file
entry_db = os.path.join(db_root, name)
entry_db = os.path.join(db_root, name, _DB_DIRNAME)
if not os.path.exists(entry_db):
os.makedirs(entry_db)

with open(os.path.join(entry_db, "index.json"), "w") as outfile:
outfile.write(json.dumps(index, indent=4))

# yeah this is awkward <--- from @tgamblin :D
db = spack.database.Database(None, entry_db)
db = spack.database.Database(os.path.join(db_root, name))

# Organize specs by package
specs: dict[str, list[spack.spec.Spec]] = defaultdict(list)
Expand Down

0 comments on commit 37f94fc

Please sign in to comment.