find_python_dependencies.py: recursively search for Python modules
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I've just committed some changes to find_python_dependencies.py script
[1] to recursively search import of modules under try... except... and
try... finally... blocks. Source code changes can be seen at [2].
What changed?
Suppose we have this Python file (test/test.py):
#!/usr/bin/python
import os
try:
import gtk
except:
pass
try:
import gobject
finally:
pass
Old version of find_python_dependencies.py returns this:
$ ./OLD_find_python_dependencies.py test
{'os': ('python2.5-minimal', 1)}
{}
$
As you can see, there is no trace of both gtk and gobject modules.
Now let's launch new version:
$ ./find_python_dependencies.py test
{'gobject': ('python-gobject', 1),
'gtk': ('python-gtk2', 1),
'os': ('python2.5-minimal', 1)}
{}
$
New version now lists every module, so chances to miss one are reduced.
One drawback is modules are still listed in a single dictionary, so you
have to grep the code to see if one or more modules are imported under a
try... except... or try... finally... block.
Please report any issue you encouter with this new approach.
Regards,
[1]http://svn.debian.org/viewsvn/python-modules/tools/find_python_dependencies.py
[2]http://svn.debian.org/viewsvn/python-modules/tools/find_python_dependencies.py?r1=6993&r2=9691
- --
.''`.
: :' : Luca Falavigna <dktrkranz@debian.org>
`. `'
`-
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkqlIDgACgkQnXjXEYa8KlDlIwCfcCXB4mbTqSBB9bdR4lxeYj4S
w6UAoI6e7C5MI2yQvA0IefkdKj7wST+d
=EKqi
-----END PGP SIGNATURE-----
Reply to: