question about introducing a dependency in a module

Hello everyone!

I’m working on a pull request for the slackpkg module, and I found myself needing to compare version strings. I used packaging.version.parse() for this purpose, thinking that this wouldn’t be a problem since it’s a dependency of setuptools, and that’s installed anyway since ansible needs it.

But of course then I found out that module code is executed on the remote server, and that does not necessarily have setuptools installed. This is really bad, because you can’t even install setuptools via ansible.slackpkg this way.

What would you advise? Should I include the ±300 relevant rules of code from packaging? Should I find a different way of comparing version strings? Does ansible maybe offer a utility for this?

Extra information:
I need to compare version strings because slackpkg upgrade does not do so, resulting in downgraded packages if the installed version is newer than the one found in the repository (this happens fairly often in slackware because of the popularity of slackbuilds).

Thanks for your input in advance, and keep up the good work. I love this project!

Kind regards,
Tamara aka nihlaeth

You can use any libs included with python core, for example we use
distutils's version, in many modules you can see examples of using
LooseVersion and StrictVersion

You can use any libs included with python core, for example we use
distutils’s version, in many modules you can see examples of using
LooseVersion and StrictVersion

That works, thanks. I guess I try to stay away from distutils since it’s marked as legacy, but in this case it makes perfect sense.