rpm-vercmp
raw JSON → 0.1.2 verified Sat May 09 auth: no python
A pure Python implementation of the RPM version comparison algorithm (rpmvercmp). Current version 0.1.2, no regular release cadence observed.
pip install rpm-vercmp Common errors
error ModuleNotFoundError: No module named 'rpm_vercmp' ↓
cause Incorrect import path; the module uses underscore, not hyphen.
fix
Use
from rpm_vercmp import rpmvercmp (note underscore). error AttributeError: module 'rpm_vercmp' has no attribute 'rpmvercmp' ↓
cause Trying to import the module directly and then call it incorrectly.
fix
Correct import:
from rpm_vercmp import rpmvercmp then use rpmvercmp(ver1, ver2). Warnings
gotcha The function returns integers (1, -1, 0) for comparison results, not True/False or a boolean. Be careful in conditional checks. ↓
fix Use `rpmvercmp(a, b) > 0` instead of `rpmvercmp(a, b)` in boolean contexts.
gotcha Version strings must be valid RPM version strings. Non-standard characters or malformed input may cause unexpected results or errors. ↓
fix Ensure input strings follow RPM version format (e.g., '1.2.3', '1.2.3-1').
Imports
- rpmvercmp
from rpm_vercmp import rpmvercmp
Quickstart
from rpm_vercmp import rpmvercmp
result = rpmvercmp('1.2.3', '1.2.4')
print(result) # 1 if first > second, -1 if first < second, 0 if equal