| 112 | return vercmp |
| 113 | |
| 114 | def _compare(self, other): |
| 115 | if not isinstance(other, (str, NumpyVersion)): |
| 116 | raise ValueError("Invalid object to compare with NumpyVersion.") |
| 117 | |
| 118 | if isinstance(other, str): |
| 119 | other = NumpyVersion(other) |
| 120 | |
| 121 | vercmp = self._compare_version(other) |
| 122 | if vercmp == 0: |
| 123 | # Same x.y.z version, check for alpha/beta/rc |
| 124 | vercmp = self._compare_pre_release(other) |
| 125 | if vercmp == 0: |
| 126 | # Same version and same pre-release, check if dev version |
| 127 | if self.is_devversion is other.is_devversion: |
| 128 | vercmp = 0 |
| 129 | elif self.is_devversion: |
| 130 | vercmp = -1 |
| 131 | else: |
| 132 | vercmp = 1 |
| 133 | |
| 134 | return vercmp |
| 135 | |
| 136 | def __lt__(self, other): |
| 137 | return self._compare(other) < 0 |