On 22 February 2016 at 13:37, Markus Lehtonen <
[email protected]> wrote:
> As far as I can tell get_gpg_version returns a string. However, you
> compare that with a float. This should give more correct behavior:
> + if gpg_ver > "2.1":
>
Not sure I'd trust that either, version comparison logic is painful.
Something like this might be more resilient to interesting versioning:
dots = versionstring.split('.')
assert len(dots) >2
if int(dots[0]) >= 2 and int(dots[1])>= 1:
Also:
+ job = subprocess.Popen([self.gpg_bin, "--version"],
stdout=subprocess.PIPE)
+ (stdout, _) = job.communicate()
+
+ if job.returncode:
+ raise bb.build.FuncFailed("Could not get gpg version (is %s
installed?)" %
+ self.gpg_bin)
+ return stdout.split()[2]
That's a long-winded way of saying:
try:
return subprocess.check_output((self.gpg_bin, "version")).split()[2]
except CalledProcessExceptionOrWhateverThisExceptionIsCalled:
raise bb.build.FuncFailed("Could not get gpg version (%s). Called %s,
output %s" % (e, e.cmd, e.output))
Ross
--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel