Files
rosetta/toolchain/meadow/cache.py
T
wash 1ec33767ab meta: replace cmake mono-build system with a custom build co-ordinator
every system component now has its own self-contained build system, and a
seed file describing the component and its build system and dependencies.

a new tool, meadow, collects and uses these seed files to build the
components into a full system. meadow also manages the target system root
and a host prefix where toolchain tools are installed to.

the build system has also been updated to use a new $ARCH-rosetta-gcc
compiler, and the patches files necessary to build it have been
added to toolchain/cross-compiler.
2026-07-19 13:34:32 +01:00

70 lines
1.4 KiB
Python

import json
import os
cache_path = 'build/meadow-cache.json'
cache_data = None
class Cache:
def load():
global cache_data
if not os.path.exists(cache_path):
cache_data = {}
return
with open(cache_path, mode='r') as f:
cache_data = json.load(f)
def reset():
global cache_data
cache_data = {}
def save():
global cache_data
with open(cache_path, mode='w') as f:
json.dump(cache_data, f, indent=4)
def get(path):
parts = path.split('.')
container = cache_data
for p in parts[:-1]:
if p not in container:
return None
if not isinstance(container[p], dict):
print('Err: element "{}" in cache key "{}" is not a dictionary'.format(p, path))
return
container = container[p]
if parts[-1] in container:
return container[parts[-1]]
return None
def set(path, value):
parts = path.split('.')
container = cache_data
for p in parts[:-1]:
if p not in container:
container[p] = {}
if not isinstance(container[p], dict):
print('Err: element "{}" in cache key "{}" is not a dictionary'.format(p, path))
return
container = container[p]
container[parts[-1]] = value