I have a set of python scripts that I run frequently on different machines that depend on a few external libraries as well as some other applications spawned via subprocess.Popen
.
As expected depending on the version of the installed modules and applications the output varies. To address this I would like to keep track of which versions were in use at runtime.
In order to do this I've considered the following steps:
- Using modulefinder to collect dependencies.
- Try to call
module.__version__
,module.get_version()
or other common ways to store version information on each collected module. - Collect all calls to
subprocess.Popen
and try to get a version number by parsing the output with different arguments such as -version, -v, -?, -h, ...
Steps 2 and 3 could be greatly improved by the use of distribution specific (Debian in my case) tools such as dpkg to get versions of installed packages. The downside is that it becomes not only OS but also distribution specific, however I do realize that the initial approach is extremely inefficient and error-prone, if functional at all.
So my question is if there is any package out there to address this or if anyone has a better suggestion on how to implement it?