mock.Mock.get_package_rpm_path

Here are the examples of the python api mock.Mock.get_package_rpm_path taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

Example 1

Project: FedoraReview Source File: rpm_file.py
Function: init
    def init(self):
        ''' Lazy init, we have no rpms until they are built. '''
        if self._inited:
            return
        self.filename = Mock.get_package_rpm_path(self)
        fd = os.open(self.filename, os.O_RDONLY)
        self.header = rpm.TransactionSet().hdrFromFdno(fd)
        os.close(fd)
        self._inited = True

Example 2

Project: FedoraReview Source File: spec_file.py
    def _get_packages(self):
        ''' Return list of all packages, except empty or not built. '''

        def check_pkg_path(pkg):
            ''' Check that pkg is available (built or supplied w -p).'''
            nvr = self.get_package_nvr(pkg)
            try:
                return Mock.get_package_rpm_path(nvr)
            except ReviewError:
                self.log.warning("Package %s-%s-%s not built"
                                 % (nvr.name, nvr.version, nvr.release))
                return None

        pkgs = [p.header[rpm.RPMTAG_NAME] for p in self.spec.packages]
        pkgs = [p for p in pkgs if not self.get_files(p) is None]
        return [p for p in pkgs if check_pkg_path(p)]