Revision e1c0be02 image_creator/util.py

b/image_creator/util.py
115 115

  
116 116
        return checksum
117 117

  
118
    def check_guestfs_version(ghandler, major, minor, release):
119
        """Checks if the version of the used libguestfs is smaller, equal or
120
        greater than the one specified by the major, minor and release triplet
121

  
122
        Returns:
123
            < 0 if the installed version is smaller than the specified one
124
            = 0 if they are equal
125
            > 0 if the installed one is greater than the specified one
126
        """
127

  
128
        ver = ghandler.version()
129

  
130
        for (a, b) in (ver['major'], major), (ver['minor'], minor), \
131
                (ver['release'], release):
132
            if a != b:
133
                return a - b
134

  
135
        return 0
136

  
118 137
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :

Also available in: Unified diff