Extracting python dependencies automatically

Panu Matilainen pmatilai at redhat.com
Wed Aug 15 13:51:06 UTC 2007


Started looking into possibilities of extracting python dependency 
information similarly to perl dependencies...

Initial POC implementation looks like this:

For provides, look into site-packages and turn the dir/filenames found 
into foo.bar type entries in python() namespace, for example:
[pmatilai at localhost ~]$ rpm -ql yum-metadata-parser|./pythondeps.py -P
python(_sqlitecache)
python(sqlitecachec)

For requires, try to locate any python scripts and modules and for each 
found, run them through python's modulefinder which attempts to figure out 
which modules a script/module uses. Then, based on the filenames gotten 
from modulefinder results, turn them into python(<name>) entries, for 
example:
[pmatilai at localhost ~]$ rpm -ql createrepo|./pythondeps.py -R
python(_sqlitecache)
python(abi) = 2.5
python(libxml2)
python(libxml2mod)
python(rpm._rpmmodule)
python(sqlitecachec)

Haven't tested it at all thoroughly, but visual inspection of what I've 
tried would appear to be reasonably sane. That said I'm often blind as a 
bat so there might be severe problems there and I just didn't notice :)

If any python-heads are interested in playing around / testing / 
improving, here's the initial attempt: 
http://laiskiainen.org/rpm/scripts/pythondeps.py

Thoughts / comments?

 	- Panu -




More information about the fedora-devel-list mailing list