本文整理汇总了Python中portage.util.writemsg函数的典型用法代码示例。如果您正苦于以下问题:Python writemsg函数的具体用法?Python writemsg怎么用?Python writemsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了writemsg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, depgraph, mylist, favorites, verbosity):
frozen_config = depgraph._frozen_config
dynamic_config = depgraph._dynamic_config
self.mylist = mylist
self.favorites = InternalPackageSet(favorites, allow_repo=True)
self.verbosity = verbosity
if self.verbosity is None:
self.verbosity = ("--quiet" in frozen_config.myopts and 1 or \
"--verbose" in frozen_config.myopts and 3 or 2)
self.oneshot = "--oneshot" in frozen_config.myopts or \
"--onlydeps" in frozen_config.myopts
self.columns = "--columns" in frozen_config.myopts
self.tree_display = "--tree" in frozen_config.myopts
self.alphabetical = "--alphabetical" in frozen_config.myopts
self.quiet = "--quiet" in frozen_config.myopts
self.all_flags = self.verbosity == 3 or self.quiet
self.print_use_string = self.verbosity != 1 or "--verbose" in frozen_config.myopts
self.changelog = "--changelog" in frozen_config.myopts
self.edebug = frozen_config.edebug
self.unordered_display = "--unordered-display" in frozen_config.myopts
mywidth = 130
if "COLUMNWIDTH" in frozen_config.settings:
try:
mywidth = int(frozen_config.settings["COLUMNWIDTH"])
except ValueError as e:
writemsg("!!! %s\n" % str(e), noiselevel=-1)
writemsg("!!! Unable to parse COLUMNWIDTH='%s'\n" % \
frozen_config.settings["COLUMNWIDTH"], noiselevel=-1)
del e
self.columnwidth = mywidth
if "--quiet-repo-display" in frozen_config.myopts:
self.repo_display = _RepoDisplay(frozen_config.roots)
self.trees = frozen_config.trees
self.pkgsettings = frozen_config.pkgsettings
self.target_root = frozen_config.target_root
self.running_root = frozen_config._running_root
self.roots = frozen_config.roots
# Create a single merged user set for each root
self.user_sets = {}
for root_name, root in self.roots.items():
self.user_sets[root_name] = InternalPackageSet(initial_atoms= \
chain.from_iterable(pkgset.getAtoms() \
for pkgset in root.sets.values() \
if pkgset.user_set))
self.blocker_parents = dynamic_config._blocker_parents
self.reinstall_nodes = dynamic_config._reinstall_nodes
self.digraph = dynamic_config.digraph
self.blocker_uninstalls = dynamic_config._blocker_uninstalls
self.package_tracker = dynamic_config._package_tracker
self.set_nodes = dynamic_config._set_nodes
self.pkg_use_enabled = depgraph._pkg_use_enabled
self.pkg = depgraph._pkg
开发者ID:austin987,项目名称:portage,代码行数:60,代码来源:output_helpers.py
示例2: load_unpack_dependencies_configuration
def load_unpack_dependencies_configuration(repositories):
repo_dict = {}
for repo in repositories.repos_with_profiles():
for eapi in _supported_eapis:
if eapi_has_automatic_unpack_dependencies(eapi):
file_name = os.path.join(repo.location, "profiles", "unpack_dependencies", eapi)
lines = grabfile(file_name, recursive=True)
for line in lines:
elements = line.split()
suffix = elements[0].lower()
if len(elements) == 1:
writemsg(_("--- Missing unpack dependencies for '%s' suffix in '%s'\n") % (suffix, file_name))
depend = " ".join(elements[1:])
try:
use_reduce(depend, eapi=eapi)
except InvalidDependString as e:
writemsg(_("--- Invalid unpack dependencies for '%s' suffix in '%s': '%s'\n" % (suffix, file_name, e)))
else:
repo_dict.setdefault(repo.name, {}).setdefault(eapi, {})[suffix] = depend
ret = {}
for repo in repositories.repos_with_profiles():
for repo_name in [x.name for x in repo.masters] + [repo.name]:
for eapi in repo_dict.get(repo_name, {}):
for suffix, depend in repo_dict.get(repo_name, {}).get(eapi, {}).items():
ret.setdefault(repo.name, {}).setdefault(eapi, {})[suffix] = depend
return ret
开发者ID:Spencerx,项目名称:portage,代码行数:28,代码来源:unpack_dependencies.py
示例3: process
def process(mysettings, key, logentries, fulltext):
if "PORTAGE_ELOG_MAILURI" in mysettings:
myrecipient = mysettings["PORTAGE_ELOG_MAILURI"].split()[0]
else:
myrecipient = "[email protected]"
myfrom = mysettings["PORTAGE_ELOG_MAILFROM"]
myfrom = myfrom.replace("${HOST}", socket.getfqdn())
mysubject = mysettings["PORTAGE_ELOG_MAILSUBJECT"]
mysubject = mysubject.replace("${PACKAGE}", key)
mysubject = mysubject.replace("${HOST}", socket.getfqdn())
# look at the phases listed in our logentries to figure out what action was performed
action = _("merged")
for phase in logentries:
# if we found a *rm phase assume that the package was unmerged
if phase in ["postrm", "prerm"]:
action = _("unmerged")
# if we think that the package was unmerged, make sure there was no unexpected
# phase recorded to avoid misinformation
if action == _("unmerged"):
for phase in logentries:
if phase not in ["postrm", "prerm", "other"]:
action = _("unknown")
mysubject = mysubject.replace("${ACTION}", action)
mymessage = portage.mail.create_message(myfrom, myrecipient, mysubject, fulltext)
try:
portage.mail.send_mail(mysettings, mymessage)
except PortageException as e:
writemsg("%s\n" % str(e), noiselevel=-1)
return
开发者ID:TommyD,项目名称:gentoo-portage-multilib,代码行数:34,代码来源:mod_mail.py
示例4: load_profiles
def load_profiles(self, repositories, known_repository_paths):
known_repository_paths = set(os.path.realpath(x)
for x in known_repository_paths)
known_repos = []
for x in known_repository_paths:
try:
layout_data = {"profile-formats":
repositories.get_repo_for_location(x).profile_formats}
except KeyError:
layout_data = parse_layout_conf(x)[0]
# force a trailing '/' for ease of doing startswith checks
known_repos.append((x + '/', layout_data))
known_repos = tuple(known_repos)
if self.config_profile_path is None:
self.config_profile_path = \
os.path.join(self.config_root, PROFILE_PATH)
if os.path.isdir(self.config_profile_path):
self.profile_path = self.config_profile_path
else:
self.config_profile_path = \
os.path.join(self.config_root, 'etc', 'make.profile')
if os.path.isdir(self.config_profile_path):
self.profile_path = self.config_profile_path
else:
self.profile_path = None
else:
# NOTE: repoman may pass in an empty string
# here, in order to create an empty profile
# for checking dependencies of packages with
# empty KEYWORDS.
self.profile_path = self.config_profile_path
# The symlink might not exist or might not be a symlink.
self.profiles = []
self.profiles_complex = []
if self.profile_path:
try:
self._addProfile(os.path.realpath(self.profile_path),
repositories, known_repos)
except ParseError as e:
writemsg(_("!!! Unable to parse profile: '%s'\n") % \
self.profile_path, noiselevel=-1)
writemsg("!!! ParseError: %s\n" % str(e), noiselevel=-1)
self.profiles = []
self.profiles_complex = []
if self._user_config and self.profiles:
custom_prof = os.path.join(
self.config_root, CUSTOM_PROFILE_PATH)
if os.path.exists(custom_prof):
self.user_profile_dir = custom_prof
self.profiles.append(custom_prof)
self.profiles_complex.append(_profile_node(custom_prof, True))
del custom_prof
self.profiles = tuple(self.profiles)
self.profiles_complex = tuple(self.profiles_complex)
开发者ID:devurandom,项目名称:portage,代码行数:60,代码来源:LocationsManager.py
示例5: _initialize
def _initialize(self):
"""Initialize the plug-in module
@rtype: boolean
"""
self.valid = False
try:
mod_name = ".".join([self._namepath, self.name])
self._module = __import__(mod_name, [], [], ["not empty"])
self.valid = True
except ImportError as e:
print("MODULE; failed import", mod_name, " error was:", e)
return False
self.module_spec = self._module.module_spec
for submodule in self.module_spec['provides']:
kid = self.module_spec['provides'][submodule]
kidname = kid['name']
try:
kid['module_name'] = '.'.join([mod_name, kid['sourcefile']])
except KeyError:
kid['module_name'] = '.'.join([mod_name, self.name])
msg = ("%s module's module_spec is old, missing attribute: "
"'sourcefile'. Backward compatibility may be "
"removed in the future.\nFile: %s\n")
writemsg(_(msg) % (self.name, self._module.__file__))
kid['is_imported'] = False
self.kids[kidname] = kid
self.kids_names.append(kidname)
return True
开发者ID:aeroniero33,项目名称:portage,代码行数:29,代码来源:module.py
示例6: _post_phase_exit
def _post_phase_exit(self, post_phase):
self._assert_current(post_phase)
log_path = None
if self.settings.get("PORTAGE_BACKGROUND") != "subprocess":
log_path = self.settings.get("PORTAGE_LOG_FILE")
if post_phase.logfile is not None and \
post_phase.logfile != log_path:
# We were logging to a temp file (see above), so append
# temp file to main log and remove temp file.
self._append_temp_log(post_phase.logfile, log_path)
if self._final_exit(post_phase) != os.EX_OK:
writemsg("!!! post %s failed; exiting.\n" % self.phase,
noiselevel=-1)
self._die_hooks()
return
if self.phase == "install":
out = io.StringIO()
_post_src_install_soname_symlinks(self.settings, out)
msg = out.getvalue()
if msg:
self.scheduler.output(msg, log_path=log_path)
self._current_task = None
self.wait()
return
开发者ID:palmer-dabbelt,项目名称:portage,代码行数:30,代码来源:EbuildPhase.py
示例7: set_root_override
def set_root_override(self, root_overwrite=None):
# Allow ROOT setting to come from make.conf if it's not overridden
# by the constructor argument (from the calling environment).
if self.target_root is None and root_overwrite is not None:
self.target_root = root_overwrite
if not self.target_root.strip():
self.target_root = None
self.target_root = self.target_root or os.sep
self.target_root = normalize_path(os.path.abspath(
self.target_root)).rstrip(os.path.sep) + os.path.sep
if self.sysroot != "/" and self.sysroot != self.target_root:
writemsg(_("!!! Error: SYSROOT (currently %s) must "
"equal / or ROOT (currently %s).\n") %
(self.sysroot, self.target_root),
noiselevel=-1)
raise InvalidLocation(self.sysroot)
ensure_dirs(self.target_root)
self._check_var_directory("ROOT", self.target_root)
self.eroot = self.target_root.rstrip(os.sep) + self.eprefix + os.sep
self.global_config_path = GLOBAL_CONFIG_PATH
if portage.const.EPREFIX:
self.global_config_path = os.path.join(portage.const.EPREFIX,
GLOBAL_CONFIG_PATH.lstrip(os.sep))
开发者ID:gentoo,项目名称:portage,代码行数:28,代码来源:LocationsManager.py
示例8: _start
def _start(self):
pkg = self.pkg
settings = self.settings
if not self.opts.fetchonly:
rval = _check_temp_dir(settings)
if rval != os.EX_OK:
self.returncode = rval
self._current_task = None
self._async_wait()
return
root_config = pkg.root_config
tree = "porttree"
self._tree = tree
portdb = root_config.trees[tree].dbapi
settings.setcpv(pkg)
settings.configdict["pkg"]["EMERGE_FROM"] = "ebuild"
if self.opts.buildpkgonly:
settings.configdict["pkg"]["MERGE_TYPE"] = "buildonly"
else:
settings.configdict["pkg"]["MERGE_TYPE"] = "source"
ebuild_path = portdb.findname(pkg.cpv, myrepo=pkg.repo)
if ebuild_path is None:
raise AssertionError("ebuild not found for '%s'" % pkg.cpv)
self._ebuild_path = ebuild_path
portage.doebuild_environment(ebuild_path, 'setup',
settings=self.settings, db=portdb)
# Check the manifest here since with --keep-going mode it's
# currently possible to get this far with a broken manifest.
if not self._check_manifest():
self.returncode = 1
self._current_task = None
self._async_wait()
return
prefetcher = self.prefetcher
if prefetcher is None:
pass
elif prefetcher.isAlive() and \
prefetcher.poll() is None:
waiting_msg = "Fetching files " + \
"in the background. " + \
"To view fetch progress, run `tail -f %s` in another terminal." \
% (_emerge.emergelog._emerge_log_dir)
msg_prefix = colorize("GOOD", " * ")
from textwrap import wrap
waiting_msg = "".join("%s%s\n" % (msg_prefix, line) \
for line in wrap(waiting_msg, 65))
if not self.background:
writemsg(waiting_msg, noiselevel=-1)
self._current_task = prefetcher
prefetcher.addExitListener(self._prefetch_exit)
return
self._prefetch_exit(prefetcher)
开发者ID:nullishzero,项目名称:portage-1,代码行数:60,代码来源:EbuildBuild.py
示例9: _parse_file_to_dict
def _parse_file_to_dict(self, file_name, juststrings=False, recursive=True, eapi_filter=None):
ret = {}
location_dict = {}
file_dict = grabdict_package(file_name, recursive=recursive, verify_eapi=True)
eapi = read_corresponding_eapi_file(file_name)
if eapi_filter is not None and not eapi_filter(eapi):
if file_dict:
writemsg(_("--- EAPI '%s' does not support '%s': '%s'\n") %
(eapi, os.path.basename(file_name), file_name),
noiselevel=-1)
return ret
useflag_re = _get_useflag_re(eapi)
for k, v in file_dict.items():
useflags = []
for prefixed_useflag in v:
if prefixed_useflag[:1] == "-":
useflag = prefixed_useflag[1:]
else:
useflag = prefixed_useflag
if useflag_re.match(useflag) is None:
writemsg(_("--- Invalid USE flag for '%s' in '%s': '%s'\n") %
(k, file_name, prefixed_useflag), noiselevel=-1)
else:
useflags.append(prefixed_useflag)
location_dict.setdefault(k, []).extend(useflags)
for k, v in location_dict.items():
if juststrings:
v = " ".join(v)
else:
v = tuple(v)
ret.setdefault(k.cp, {})[k] = v
return ret
开发者ID:devurandom,项目名称:portage,代码行数:32,代码来源:UseManager.py
示例10: trace_event
def trace_event(self, frame, event, arg):
writemsg("%s line=%d name=%s event=%s %slocals=%s\n" % \
(self.trim_filename(frame.f_code.co_filename),
frame.f_lineno,
frame.f_code.co_name,
event,
self.arg_repr(frame, event, arg),
self.locals_repr(frame, event, arg)))
开发者ID:Neuvoo,项目名称:legacy-portage,代码行数:8,代码来源:debug.py
示例11: _create_pty_or_pipe
def _create_pty_or_pipe(copy_term_size=None):
"""
Try to create a pty and if then fails then create a normal
pipe instead.
@param copy_term_size: If a tty file descriptor is given
then the term size will be copied to the pty.
@type copy_term_size: int
@rtype: tuple
@returns: A tuple of (is_pty, master_fd, slave_fd) where
is_pty is True if a pty was successfully allocated, and
False if a normal pipe was allocated.
"""
got_pty = False
global _disable_openpty, _fbsd_test_pty
if _fbsd_test_pty and not _disable_openpty:
# Test for python openpty breakage after freebsd7 to freebsd8
# upgrade, which results in a 'Function not implemented' error
# and the process being killed.
pid = os.fork()
if pid == 0:
pty.openpty()
os._exit(os.EX_OK)
pid, status = os.waitpid(pid, 0)
if (status & 0xff) == 140:
_disable_openpty = True
_fbsd_test_pty = False
if _disable_openpty:
master_fd, slave_fd = os.pipe()
else:
try:
master_fd, slave_fd = pty.openpty()
got_pty = True
except EnvironmentError as e:
_disable_openpty = True
writemsg("openpty failed: '%s'\n" % str(e),
noiselevel=-1)
del e
master_fd, slave_fd = os.pipe()
if got_pty:
# Disable post-processing of output since otherwise weird
# things like \n -> \r\n transformations may occur.
mode = termios.tcgetattr(slave_fd)
mode[1] &= ~termios.OPOST
termios.tcsetattr(slave_fd, termios.TCSANOW, mode)
if got_pty and \
copy_term_size is not None and \
os.isatty(copy_term_size):
rows, columns = get_term_size()
set_term_size(rows, columns, slave_fd)
return (got_pty, master_fd, slave_fd)
开发者ID:zy-sunshine,项目名称:easymgc,代码行数:58,代码来源:_pty.py
示例12: __init__
def __init__(self, config_root=None, eprefix=None, config_profile_path=None, local_config=True, \
target_root=None):
self.user_profile_dir = None
self._local_repo_conf_path = None
self.eprefix = eprefix
self.config_root = config_root
self.target_root = target_root
self._user_config = local_config
if self.eprefix is None:
self.eprefix = ""
if self.config_root is None:
self.config_root = self.eprefix + os.sep
self.config_root = normalize_path(os.path.abspath(
self.config_root)).rstrip(os.path.sep) + os.path.sep
self._check_var_directory("PORTAGE_CONFIGROOT", self.config_root)
self.abs_user_config = os.path.join(self.config_root, USER_CONFIG_PATH)
if not config_profile_path:
config_profile_path = \
os.path.join(self.config_root, PROFILE_PATH)
if os.path.isdir(config_profile_path):
self.profile_path = config_profile_path
else:
config_profile_path = \
os.path.join(self.abs_user_config, 'make.profile')
if os.path.isdir(config_profile_path):
self.profile_path = config_profile_path
else:
self.profile_path = None
else:
self.profile_path = config_profile_path
# The symlink might not exist or might not be a symlink.
self.profiles = []
if self.profile_path is not None:
try:
self._addProfile(os.path.realpath(self.profile_path))
except ParseError as e:
writemsg(_("!!! Unable to parse profile: '%s'\n") % \
self.profile_path, noiselevel=-1)
writemsg("!!! ParseError: %s\n" % str(e), noiselevel=-1)
self.profiles = []
if self._user_config and self.profiles:
custom_prof = os.path.join(
self.config_root, CUSTOM_PROFILE_PATH)
if os.path.exists(custom_prof):
self.user_profile_dir = custom_prof
self.profiles.append(custom_prof)
del custom_prof
self.profiles = tuple(self.profiles)
开发者ID:Neuvoo,项目名称:legacy-portage,代码行数:57,代码来源:LocationsManager.py
示例13: _post_phase_exit
def _post_phase_exit(self, post_phase):
if self._final_exit(post_phase) != os.EX_OK:
writemsg("!!! post %s failed; exiting.\n" % self.phase,
noiselevel=-1)
self._die_hooks()
return
self._current_task = None
self.wait()
return
开发者ID:fastinetserver,项目名称:portage-idfetch,代码行数:9,代码来源:EbuildPhase.py
示例14: parse_args
def parse_args():
argv = sys.argv[:]
if sys.hexversion >= 0x3000000:
# We can't trust that the filesystem encoding (locale dependent)
# correctly matches the arguments, so use surrogateescape to
# pass through the original argv bytes for Python 3.
fs_encoding = sys.getfilesystemencoding()
argv = [x.encode(fs_encoding, 'surrogateescape') for x in argv]
for x, arg in enumerate(argv):
try:
argv[x] = _unicode_decode(arg, errors='strict')
except UnicodeDecodeError:
writemsg('dohtml: argument is not encoded as UTF-8: %s\n' %
_unicode_decode(arg), noiselevel=-1)
sys.exit(1)
options = OptionsClass()
args = []
x = 1
while x < len(argv):
arg = argv[x]
if arg in ["-h","-r","-V"]:
if arg == "-h":
print_help()
sys.exit(0)
elif arg == "-r":
options.recurse = True
elif arg == "-V":
options.verbose = True
elif argv[x] in ["-A","-a","-f","-x","-p"]:
x += 1
if x == len(argv):
print_help()
sys.exit(0)
elif arg == "-p":
options.doc_prefix = argv[x]
if options.doc_prefix:
options.doc_prefix = normalize_path(options.doc_prefix)
else:
values = argv[x].split(",")
if arg == "-A":
options.allowed_exts.extend(values)
elif arg == "-a":
options.allowed_exts = values
elif arg == "-f":
options.allowed_files = values
elif arg == "-x":
options.disallowed_dirs = values
else:
args.append(argv[x])
x += 1
return (options, args)
开发者ID:aeroniero33,项目名称:portage,代码行数:56,代码来源:dohtml.py
示例15: _start
def _start(self):
pkg = self.pkg
settings = self.settings
rval = _check_temp_dir(settings)
if rval != os.EX_OK:
self.returncode = rval
self._current_task = None
self.wait()
return
root_config = pkg.root_config
tree = "porttree"
self._tree = tree
portdb = root_config.trees[tree].dbapi
settings.setcpv(pkg)
settings.configdict["pkg"]["EMERGE_FROM"] = pkg.type_name
ebuild_path = portdb.findname(pkg.cpv)
if ebuild_path is None:
raise AssertionError("ebuild not found for '%s'" % pkg.cpv)
self._ebuild_path = ebuild_path
# Check the manifest here since with --keep-going mode it's
# currently possible to get this far with a broken manifest.
if not self._check_manifest():
self.returncode = 1
self._current_task = None
self.wait()
return
prefetcher = self.prefetcher
if prefetcher is None:
pass
elif not prefetcher.isAlive():
prefetcher.cancel()
elif prefetcher.poll() is None:
waiting_msg = "Fetching files " + \
"in the background. " + \
"To view fetch progress, run `tail -f " + \
"/var/log/emerge-fetch.log` in another " + \
"terminal."
msg_prefix = colorize("GOOD", " * ")
from textwrap import wrap
waiting_msg = "".join("%s%s\n" % (msg_prefix, line) \
for line in wrap(waiting_msg, 65))
if not self.background:
writemsg(waiting_msg, noiselevel=-1)
self._current_task = prefetcher
prefetcher.addExitListener(self._prefetch_exit)
return
self._prefetch_exit(prefetcher)
开发者ID:Neuvoo,项目名称:legacy-portage,代码行数:55,代码来源:EbuildBuild.py
示例16: _start
def _start(self):
pkg = self.pkg
settings = self.settings
settings.setcpv(pkg)
self._tree = "bintree"
self._bintree = self.pkg.root_config.trees[self._tree]
self._verify = not self.opts.pretend
dir_path = os.path.join(settings["PORTAGE_TMPDIR"],
"portage", pkg.category, pkg.pf)
self._build_dir = EbuildBuildDir(dir_path=dir_path,
pkg=pkg, settings=settings)
self._image_dir = os.path.join(dir_path, "image")
self._infloc = os.path.join(dir_path, "build-info")
self._ebuild_path = os.path.join(self._infloc, pkg.pf + ".ebuild")
settings["EBUILD"] = self._ebuild_path
debug = settings.get("PORTAGE_DEBUG") == "1"
portage.doebuild_environment(self._ebuild_path, "setup",
settings["ROOT"], settings, debug, 1, self._bintree.dbapi)
settings.configdict["pkg"]["EMERGE_FROM"] = pkg.type_name
# The prefetcher has already completed or it
# could be running now. If it's running now,
# wait for it to complete since it holds
# a lock on the file being fetched. The
# portage.locks functions are only designed
# to work between separate processes. Since
# the lock is held by the current process,
# use the scheduler and fetcher methods to
# synchronize with the fetcher.
prefetcher = self.prefetcher
if prefetcher is None:
pass
elif not prefetcher.isAlive():
prefetcher.cancel()
elif prefetcher.poll() is None:
waiting_msg = ("Fetching '%s' " + \
"in the background. " + \
"To view fetch progress, run `tail -f " + \
"/var/log/emerge-fetch.log` in another " + \
"terminal.") % prefetcher.pkg_path
msg_prefix = colorize("GOOD", " * ")
from textwrap import wrap
waiting_msg = "".join("%s%s\n" % (msg_prefix, line) \
for line in wrap(waiting_msg, 65))
if not self.background:
writemsg(waiting_msg, noiselevel=-1)
self._current_task = prefetcher
prefetcher.addExitListener(self._prefetch_exit)
return
self._prefetch_exit(prefetcher)
开发者ID:Neuvoo,项目名称:legacy-portage,代码行数:55,代码来源:Binpkg.py
示例17: _read_dirVirtuals
def _read_dirVirtuals(self, profiles):
"""
Read the 'virtuals' file in all profiles.
"""
virtuals_list = []
for x in profiles:
virtuals_file = os.path.join(x, "virtuals")
virtuals_dict = grabdict(virtuals_file)
atoms_dict = {}
for k, v in virtuals_dict.items():
try:
virt_atom = Atom(k)
except InvalidAtom:
virt_atom = None
else:
if virt_atom.blocker or \
str(virt_atom) != str(virt_atom.cp):
virt_atom = None
if virt_atom is None:
writemsg(_("--- Invalid virtuals atom in %s: %s\n") % \
(virtuals_file, k), noiselevel=-1)
continue
providers = []
for atom in v:
atom_orig = atom
if atom[:1] == '-':
# allow incrementals
atom = atom[1:]
try:
atom = Atom(atom)
except InvalidAtom:
atom = None
else:
if atom.blocker:
atom = None
if atom is None:
writemsg(_("--- Invalid atom in %s: %s\n") % \
(virtuals_file, atom_orig), noiselevel=-1)
else:
if atom_orig == str(atom):
# normal atom, so return as Atom instance
providers.append(atom)
else:
# atom has special prefix, so return as string
providers.append(atom_orig)
if providers:
atoms_dict[virt_atom] = providers
if atoms_dict:
virtuals_list.append(atoms_dict)
self._dirVirtuals = stack_dictlist(virtuals_list, incremental=True)
for virt in self._dirVirtuals:
# Preference for virtuals decreases from left to right.
self._dirVirtuals[virt].reverse()
开发者ID:Acidburn0zzz,项目名称:portage-funtoo,代码行数:55,代码来源:VirtualsManager.py
示例18: _check_locations
def _check_locations(self):
"""Check if repositories location are correct and show a warning message if not"""
for (name, r) in self.prepos.items():
if name != 'DEFAULT':
if r.location is None:
writemsg(_("!!! Location not set for repository %s\n") % name, noiselevel=-1)
else:
if not isdir_raise_eaccess(r.location) and not portage._sync_mode:
self.prepos_order.remove(name)
writemsg(_("!!! Invalid Repository Location"
" (not a dir): '%s'\n") % r.location, noiselevel=-1)
开发者ID:palmer-dabbelt,项目名称:portage,代码行数:11,代码来源:config.py
示例19: _parse_repository_packageusealiases
def _parse_repository_packageusealiases(self, repositories):
ret = {}
for repo in repositories.repos_with_profiles():
file_name = os.path.join(repo.location, "profiles", "package.use.aliases")
eapi = read_corresponding_eapi_file(file_name)
useflag_re = _get_useflag_re(eapi)
lines = grabfile(file_name, recursive=True)
file_dict = {}
for line in lines:
elements = line.split()
atom = elements[0]
try:
atom = Atom(atom, eapi=eapi)
except InvalidAtom:
writemsg(_("--- Invalid atom in '%s': '%s'\n") % (file_name, atom))
continue
if len(elements) == 1:
writemsg(_("--- Missing real USE flag for '%s' in '%s'\n") % (atom, file_name), noiselevel=-1)
continue
real_flag = elements[1]
if useflag_re.match(real_flag) is None:
writemsg(
_("--- Invalid real USE flag for '%s' in '%s': '%s'\n") % (atom, file_name, real_flag),
noiselevel=-1,
)
else:
for alias in elements[2:]:
if useflag_re.match(alias) is None:
writemsg(
_("--- Invalid USE flag alias for '%s' real USE flag for '%s' in '%s': '%s'\n")
% (real_flag, atom, file_name, alias),
noiselevel=-1,
)
else:
# Duplicated USE flag aliases in entries for different atoms
# matching the same package version are detected in getUseAliases().
if any(
alias in v
for k, v in file_dict.get(atom.cp, {}).get(atom, {}).items()
if k != real_flag
):
writemsg(
_("--- Duplicated USE flag alias for '%s' in '%s': '%s'\n")
% (atom, file_name, alias),
noiselevel=-1,
)
else:
file_dict.setdefault(atom.cp, {}).setdefault(atom, {}).setdefault(real_flag, []).append(
alias
)
ret[repo.name] = file_dict
return ret
开发者ID:rafaelmartins,项目名称:portage,代码行数:52,代码来源:UseManager.py
示例20: __init__
def __init__(self, depgraph, mylist, favorites, verbosity):
frozen_config = depgraph._frozen_config
dynamic_config = depgraph._dynamic_config
self.mylist = mylist
self.favorites = InternalPackageSet(favorites, allow_repo=True)
self.verbosity = verbosity
if self.verbosity is None:
self.verbosity = ("--quiet" in frozen_config.myopts and 1 or \
"--verbose" in frozen_config.myopts and 3 or 2)
self.oneshot = "--oneshot" in frozen_config.myopts or \
"--onlydeps" in frozen_config.myopts
self.columns = "--columns" in frozen_config.myopts
self.tree_display = "--tree" in frozen_config.myopts
self.alphabetical = "--alphabetical" in frozen_config.myopts
self.quiet = "--quiet" in frozen_config.myopts
self.all_flags = self.verbosity == 3 or self.quiet
self.print_use_string = self.verbosity != 1 or "--verbose" in frozen_config.myopts
self.changelog = "--changelog" in frozen_config.myopts
self.edebug = frozen_config.edebug
self.no_restart = frozen_config._opts_no_restart.intersection(frozen_config.myopts)
self.unordered_display = "--unordered-display" in frozen_config.myopts
mywidth = 130
if "COLUMNWIDTH" in frozen_config.settings:
try:
mywidth = int(frozen_config.settings["COLUMNWIDTH"])
except ValueError as e:
writemsg("!!! %s\n" % str(e), noiselevel=-1)
writemsg("!!! Unable to parse COLUMNWIDTH='%s'\n" % \
frozen_config.settings["COLUMNWIDTH"], noiselevel=-1)
del e
self.columnwidth = mywidth
self.repo_display = _RepoDisplay(frozen_config.roots)
self.trees = frozen_config.trees
self.pkgsettings = frozen_config.pkgsettings
self.target_root = frozen_config.target_root
self.running_root = frozen_config._running_root
self.roots = frozen_config.roots
self.blocker_parents = dynamic_config._blocker_parents
self.reinstall_nodes = dynamic_config._reinstall_nodes
self.digraph = dynamic_config.digraph
self.blocker_uninstalls = dynamic_config._blocker_uninstalls
self.slot_pkg_map = dynamic_config._slot_pkg_map
self.set_nodes = dynamic_config._set_nodes
self.pkg_use_enabled = depgraph._pkg_use_enabled
self.pkg = depgraph._pkg
开发者ID:Acidburn0zzz,项目名称:portage-funtoo,代码行数:52,代码来源:output_helpers.py
注:本文中的portage.util.writemsg函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论