[Yum-devel] [PATCH 3/3] - add docstrings to properties - return_running_packages method to YumBase to return list of pkgs which currently have a file opened by a running process

Seth Vidal skvidal at fedoraproject.org
Tue Dec 8 22:01:11 UTC 2009



On Tue, 8 Dec 2009, James Antill wrote:

> On Tue, 2009-12-08 at 16:45 -0500, Seth Vidal wrote:
>> ---
>>  yum/__init__.py |   39 ++++++++++++++++++++++++++++++---------
>>  1 files changed, 30 insertions(+), 9 deletions(-)
>>
>> diff --git a/yum/__init__.py b/yum/__init__.py
>> index 2aaa66a..bd16d78 100644
>> --- a/yum/__init__.py
>> +++ b/yum/__init__.py
>> @@ -719,29 +719,39 @@ class YumBase(depsolve.Depsolve):
>>      # properties so they auto-create themselves with defaults
>>      repos = property(fget=lambda self: self._getRepos(),
>>                       fset=lambda self, value: setattr(self, "_repos", value),
>> -                     fdel=lambda self: self._delRepos())
>> +                     fdel=lambda self: self._delRepos(),
>> +                     doc="Repo Storage object - object of yum repositories")
>
> Ahh, that's how you do it ... instant ACK to all docs :)

Yes - dmalcolm pointed out that our pydocs lacked any docs for the 
properties and I said "how do you document a property?", He didn't know 
either so we looked it up. :)


>> @@ -4184,3 +4194,14 @@ class YumBase(depsolve.Depsolve):
>>              return False
>>
>>          return True
>> +
>> +    def return_running_packages(self):
>> +        """returns a list of yum installed package objects which own a file
>> +           that are currently running or in use."""
>> +        pkgs = {}
>> +        for pid in misc.return_running_pids():
>> +            for fn in misc.get_open_files(pid):
>> +                for pkg in self.rpmdb.searchFiles(fn):
>> +                    pkgs[pkg] = 1
>> +
>> +        return sorted(pkgs.keys())
>
> Why not just put this in rpmdb directly?
>

a fair point... It is probably better off there.

-sv



More information about the Yum-devel mailing list