includes = []
if "__control__" in self.data:
if "include_files" in self.data["__control__"]:
- for included in makelist(
- self.data["__control__"]["include_files"]):
+ for included in self.data["__control__"]["include_files"]:
included = find_file(
included,
relative=self.filename,
includes.append(included)
if "include_dirs" in self.data["__control__"]:
for included in [
- os.path.join(x, "__init__.mpy") for x in makelist(
+ os.path.join(x, "__init__.yaml") for x in
self.data["__control__"]["include_dirs"]
+ ]:
+ included = find_file(
+ included,
+ relative=self.filename,
+ universe=self.universe
)
+ if included not in includes:
+ includes.append(included)
+ # TODO(fungi): remove this loop after the YAML transition
+ for included in [
+ os.path.join(x, "__init__.mpy") for x in
+ self.data["__control__"]["include_dirs"]
]:
included = find_file(
included,
if included not in includes:
includes.append(included)
if "default_files" in self.data["__control__"]:
- origins = makedict(
- self.data["__control__"]["default_files"]
- )
+ origins = self.data["__control__"]["default_files"]
for key in origins.keys():
origins[key] = find_file(
origins[key],
if key not in self.universe.categories:
self.universe.categories[key] = {}
if "private_files" in self.data["__control__"]:
- for item in makelist(
- self.data["__control__"]["private_files"]
- ):
+ for item in self.data["__control__"]["private_files"]:
item = find_file(
item,
relative=self.filename,
includes.append(included)
if self.data.has_option("__control__", "include_dirs"):
for included in [
+ os.path.join(x, "__init__.yaml") for x in makelist(
+ self.data["__control__"]["include_dirs"]
+ )
+ ]:
+ included = find_file(
+ included,
+ relative=self.filename,
+ universe=self.universe
+ )
+ if included not in includes:
+ includes.append(included)
+ for included in [
os.path.join(x, "__init__.mpy") for x in makelist(
self.data.get("__control__", "include_dirs")
)
# unset the modified flag
self.modified = False
- # TODO(fungi): this should support writing YAML
def is_writeable(self):
"""Returns True if the __control__ read_only is False."""
- return not self.data.has_option(
- "__control__", "read_only"
- ) or not self.data.getboolean(
- "__control__", "read_only"
- )
+ # TODO(fungi): remove this indirection after the YAML transition
+ if self._format == "yaml":
+ try:
+ return not self.data["__control__"].get("read_only", False)
+ except KeyError:
+ return True
+ else:
+ return not self.data.has_option(
+ "__control__", "read_only"
+ ) or not self.data.getboolean(
+ "__control__", "read_only"
+ )
def find_file(