# Copyright (c) 2004-2011 Jeremy Stanley <fungi@yuggoth.org>. Permission
# to use, copy, modify, and distribute this software is granted under
# Copyright (c) 2004-2011 Jeremy Stanley <fungi@yuggoth.org>. Permission
# to use, copy, modify, and distribute this software is granted under
self.modified = False
if os.access(self.filename, os.R_OK):
self.data.read(self.filename)
self.modified = False
if os.access(self.filename, os.R_OK):
self.data.read(self.filename)
- os.path.join(x, u"__init__.mpy") for x in makelist(
- self.data.get(u"__control__", u"include_dirs")
+ os.path.join(x, "__init__.mpy") for x in makelist(
+ self.data.get("__control__", "include_dirs")
self.universe.default_origins[key] = origins[key]
if key not in self.universe.categories:
self.universe.categories[key] = {}
self.universe.default_origins[key] = origins[key]
if key not in self.universe.categories:
self.universe.categories[key] = {}
if item not in self.universe.private_files:
self.universe.private_files.append(item)
for section in self.data.sections():
if item not in self.universe.private_files:
self.universe.private_files.append(item)
for section in self.data.sections():
misc.Element(section, self.universe, self.filename)
for include_file in includes:
if not os.path.isabs(include_file):
misc.Element(section, self.universe, self.filename)
for include_file in includes:
if not os.path.isabs(include_file):
if os.path.exists(self.filename) and max_count:
backups = []
for candidate in os.listdir(os.path.dirname(self.filename)):
if re.match(
os.path.basename(self.filename) +
if os.path.exists(self.filename) and max_count:
backups = []
for candidate in os.listdir(os.path.dirname(self.filename)):
if re.match(
os.path.basename(self.filename) +
- self.filename + u"." + unicode(old_backup),
- self.filename + u"." + unicode(old_backup + 1)
+ self.filename + "." + old_backup,
+ self.filename + "." + old_backup + 1
- if not os.path.exists(self.filename + u".0"):
- os.rename(self.filename, self.filename + u".0")
+ if not os.path.exists(self.filename + ".0"):
+ os.rename(self.filename, self.filename + ".0")
# if it's marked private, chmod it appropriately
if self.filename in self.universe.private_files and oct(
# if it's marked private, chmod it appropriately
if self.filename in self.universe.private_files and oct(
- u"contents"
- ) and u"internal:storage" in universe.contents:
- storage = universe.categories[u"internal"][u"storage"]
+ "contents"
+ ) and "internal:storage" in universe.contents:
+ storage = universe.categories["internal"]["storage"]
universe.files
) == 1 and not universe.files[universe.files.keys()[0]].is_writeable():
data_file = universe.files[universe.files.keys()[0]].data
# try for a fallback default directory
if not default_dir and data_file.has_option(
universe.files
) == 1 and not universe.files[universe.files.keys()[0]].is_writeable():
data_file = universe.files[universe.files.keys()[0]].data
# try for a fallback default directory
if not default_dir and data_file.has_option(
- data_file.get(u"internal:storage",
- u"search_path").strip(u"\"'")
+ data_file.get("internal:storage",
+ "search_path").strip("\"'")
if not os.path.isabs(each_path):
each_path = os.path.realpath(os.path.join(root_path, each_path))
if each_path not in clean_search_path:
if not os.path.isabs(each_path):
each_path = os.path.realpath(os.path.join(root_path, each_path))
if each_path not in clean_search_path: