Example #1
0
class package(ebuild_src.base):

    """
    built form of an ebuild
    """

    immutable = True
    allow_regen = False

    @property
    def tracked_attributes(self):
        return tuple(super(package, self).tracked_attributes) + \
            ("contents", "use", "environment")

    @property
    def _operations(self):
        return ebd.built_operations

    # hack, not for consumer usage
    _is_from_source = False

    built = True

    __slots__ = (
        'cbuild', 'cflags', 'chost', 'contents', 'ctarget', 'cxxflags',
        'environment', 'ldflags', 'use',
    )

    _get_attr = dict(ebuild_src.package._get_attr)

    _get_attr.update((x, post_curry(passthrough, x))
                     for x in ("contents", "environment", "ebuild"))
    _get_attr.update((x, lambda s:s.data.get(x.upper(), ""))
                     for x in ("cflags", "cxxflags", "ldflags"))
    _get_attr['source_repository'] = passthrough_repo
    _get_attr['iuse_effective'] = lambda s:tuple(
        s.data.get("IUSE_EFFECTIVE", "").split())

    _get_attr['fetchables'] = lambda self:_empty_fetchable

    _get_attr["use"] = lambda s:DelayedInstantiation(frozenset,
        lambda: frozenset(s.data["USE"].split()))

    _get_attr["inherited"] = lambda s:tuple(sorted(
        s.data.get("INHERITED", "").split()))
    _get_attr["eapi_obj"] = generate_eapi_obj

    def __init__(self, *args, **kwargs):
        super(package, self).__init__(*args, **kwargs)
        self._get_attr.update(
            (k, post_curry(wrap_inst,
                        ebuild_src.package._config_wrappables[k],
                        ebuild_src.package._get_attr[k]))
            for k in ebuild_src.package._config_wrappables
            if k in super(package, self).tracked_attributes)

    def _chost_fallback(initial, self):
        o = self.data.get(initial)
        if o is None:
            o = self.data.get("CHOST")
            if o is None:
                return o
        return o.strip()

    _get_attr["cbuild"] = partial(_chost_fallback, 'CBUILD')
    _get_attr["chost"] = partial(_chost_fallback, 'CHOST')
    _get_attr["ctarget"] = partial(_chost_fallback, 'CTARGET')

    def _update_metadata(self, pkg):
        raise NotImplementedError()

    def _repo_install_op(self, domain, observer):
        return self._parent._generate_format_install_op(domain, self,
            observer)

    def _repo_uninstall_op(self, domain, observer):
        return self._parent._generate_format_uninstall_op(domain, self,
            observer)

    def _repo_replace_op(self, domain, old_pkg, observer):
        return self._parent._generate_format_replace_op(domain, old_pkg,
            self, observer)

    def _fetch_metadata(self):
        return self._parent._get_metadata(self)

    def __str__(self):
        return "built ebuild: %s" % (self.cpvstr)

    def build(self, **kwargs):
        return self.repo._generate_buildop(self)

    def add_format_triggers(self, *args, **kwds):
        return self._parent._add_format_triggers(self, *args, **kwds)

    @property
    def ebuild(self):
        o = self.data.get("ebuild")
        if o is not None:
            return o
        return self._parent._get_ebuild_src(self)

    @property
    def _mtime_(self):
        raise AttributeError(self, "_mtime_")
Example #2
0
 def use(self):
     return DelayedInstantiation(
         frozenset, lambda: frozenset(self.data["USE"].split()))
Example #3
0
class package(ebuild_src.base):

    """
    built form of an ebuild
    """

    immutable = True
    allow_regen = False

    @property
    def tracked_attributes(self):
        return tuple(super().tracked_attributes) + ("contents", "use", "environment")

    @property
    def _operations(self):
        return ebd.built_operations

    # hack, not for consumer usage
    _is_from_source = False

    _empty_fetchable = conditionals.DepSet.parse('', fetch.fetchable, operators={})

    built = True

    _get_attr = dict(ebuild_src.package._get_attr)
    _get_attr.update((x, partial(_chost_fallback, x.upper()))
                     for x in ("cbuild", "chost", "ctarget"))
    _get_attr.update((x, post_curry(passthrough, x))
                     for x in ("contents", "environment"))
    _get_attr.update((x, lambda s,x=x: s.data.get(x.upper(), ""))
                     for x in ("cflags", "cxxflags", "ldflags"))
    _get_attr.update((x, lambda s,x=x: tuple(s.data.get(x.upper(), "").split()))
                     for x in ("distfiles", "iuse_effective", "inherited"))
    _get_attr["source_repository"] = passthrough_repo
    _get_attr["fetchables"] = lambda s: s._empty_fetchable
    _get_attr["use"] = lambda s: DelayedInstantiation(
        frozenset, lambda: frozenset(s.data["USE"].split()))
    _get_attr["eapi"] = generate_eapi

    __slots__ = tuple(set(_get_attr.keys()) - set(ebuild_src.package._get_attr.keys()))

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self._get_attr.update(
            (k, post_curry(
                wrap_inst,
                ebuild_src.package._config_wrappables[k],
                ebuild_src.package._get_attr[k]))
            for k in ebuild_src.package._config_wrappables
            if k in super(package, self).tracked_attributes)

    def _update_metadata(self, pkg):
        raise NotImplementedError()

    def _repo_install_op(self, domain, observer):
        return self._parent._generate_format_install_op(domain, self,
            observer)

    def _repo_uninstall_op(self, domain, observer):
        return self._parent._generate_format_uninstall_op(domain, self,
            observer)

    def _repo_replace_op(self, domain, old_pkg, observer):
        return self._parent._generate_format_replace_op(domain, old_pkg,
            self, observer)

    def _fetch_metadata(self):
        return self._parent._get_metadata(self)

    def __str__(self):
        return "built ebuild: %s" % (self.cpvstr)

    def build(self, **kwargs):
        return self.repo._generate_buildop(self)

    def add_format_triggers(self, *args, **kwds):
        return self._parent._add_format_triggers(self, *args, **kwds)

    @property
    def ebuild(self):
        o = self.data.get("ebuild")
        if o is not None:
            return o
        return self._parent._get_ebuild_src(self)

    @property
    def _mtime_(self):
        raise AttributeError(self, "_mtime_")