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.
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
import glob
|
||||
import os
|
||||
|
||||
|
||||
class Path:
|
||||
def __init__(self, value):
|
||||
self.__path = value
|
||||
self.__namespace = None
|
||||
|
||||
parts = value.split(':')
|
||||
|
||||
if len(parts) != 2:
|
||||
return
|
||||
|
||||
if len(parts[0]) < 3:
|
||||
return
|
||||
|
||||
self.__namespace = parts[0]
|
||||
self.__path = parts[1]
|
||||
|
||||
|
||||
def get_path(self):
|
||||
return self.__path
|
||||
|
||||
|
||||
def remove_root(self):
|
||||
while len(self.__path) > 0 and self.__path[0] == '/':
|
||||
self.__path = self.__path [1:]
|
||||
|
||||
if len(self.__path) == 0:
|
||||
self.__path= '.'
|
||||
|
||||
return self
|
||||
|
||||
|
||||
def expand_path(self, **kwargs):
|
||||
relative_to = None
|
||||
|
||||
if 'relative_to' in kwargs:
|
||||
relative_to = kwargs['relative_to']
|
||||
|
||||
if isinstance(relative_to, dict):
|
||||
if self.__namespace is not None:
|
||||
relative_to = relative_to[self.__namespace]
|
||||
else:
|
||||
relative_to = None
|
||||
|
||||
paths = glob.glob(self.__path, root_dir=relative_to, recursive=True)
|
||||
if len(paths) == 0 and '*' not in self.__path:
|
||||
if relative_to is not None:
|
||||
return [os.path.join(relative_to, self.__path)]
|
||||
return [self.__path]
|
||||
|
||||
if relative_to is not None:
|
||||
abs_paths = []
|
||||
|
||||
for p in paths:
|
||||
abs_paths.append(os.path.join(relative_to, p))
|
||||
|
||||
return abs_paths
|
||||
|
||||
return paths
|
||||
|
||||
|
||||
def expand_all(paths, **kwargs):
|
||||
relative_to = None
|
||||
|
||||
if 'relative_to' in kwargs:
|
||||
relative_to = kwargs['relative_to']
|
||||
|
||||
result = []
|
||||
for p in paths:
|
||||
if not isinstance(p, Path):
|
||||
p = Path(p)
|
||||
r = p.expand_path(relative_to=relative_to)
|
||||
result.extend(r)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def get_namespace(self, **kwargs):
|
||||
if self.__namespace is not None:
|
||||
return self.__namespace
|
||||
|
||||
if 'default' in kwargs:
|
||||
return kwargs['default']
|
||||
|
||||
return None
|
||||
Reference in New Issue
Block a user