1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
3 NAMEBASE= python-libversion
7 SDESC[py37]= Python bindings for libversion (PY37)
8 SDESC[py38]= Python bindings for libversion (PY38)
9 HOMEPAGE= https://github.com/repology/py-libversion
10 CONTACT= Python_Automaton[python@ironwolf.systems]
13 SITES[main]= PYPI/l/libversion
14 DISTFILE[1]= libversion-1.2.1.tar.gz:main
19 OPTIONS_AVAILABLE= PY38 PY37
20 OPTIONS_STANDARD= none
21 VOPTS[py37]= PY38=OFF PY37=ON
22 VOPTS[py38]= PY38=ON PY37=OFF
24 BUILDRUN_DEPENDS= libversion:single:standard
28 DISTNAME= libversion-1.2.1
31 LICENSE_FILE= MIT:{{WRKSRC}}/LICENSE
36 [PY37].USES_ON= python:py37
38 [PY38].USES_ON= python:py38
40 [FILE:3643:descriptions/desc.single]
41 # Python bindings for libversion
49 [Github commits (since latest release)]
53 Python bindings for libversion, which provides **fast**, **powerful**
54 and **correct** generic version string comparison algorithm.
56 See [libversion] repository for
57 more details on the algorithm.
61 **libversion** is 10x to 100x faster than other version comparison
62 facilities widely used in Python world.
64 | Facility | comps/sec |
65 |-------------------------------------|----------:|
66 | **libversion.version_compare2** | 3492.81K |
67 | **libversion.version_compare** | 3219.02K |
68 | **libversion.Version** | 374.08K |
69 | tuple(map(int, (v.split('.')))) | 206.02K |
70 | cmp_version.cmp_version | 189.15K |
71 | cmp_version.VersionString | 156.42K |
72 | distutils.version.StrictVersion | 75.00K |
73 | version.Version | 71.39K |
74 | distutils.version.LooseVersion | 51.38K |
75 | pkg_resources.parse_version | 22.26K |
79 **libversion** handles certain complex version cases better than other
80 version comparison facilities. Here are some example cases where others
83 | Test case | libversion | tuple | StrictVersion |
84 LooseVersion | parse_version | cmp_version |
85 |-------------------------|------------|---------------|---------------|---------------|---------------|---------------|
86 | 1.0 == 1.0.0 | ok | incorrect (<) | ok |
87 incorrect (<) | ok | ok |
88 | 1.2_3 == 1.2-3 | ok | fail | fail |
89 incorrect (>) | incorrect (<) | ok |
90 | 1.2.3 == 1.2-3 | ok | fail | fail |
91 fail | incorrect (>) | incorrect (<) |
92 | 1.0alpha1 == 1.0.alpha1 | ok | fail | fail | ok
93 | ok | incorrect (>) |
94 | 1.0rc1 < 1.0 | ok | fail | fail |
95 incorrect (>) | ok | incorrect (>) |
96 | 1.0 < 1.0patch1 | ok | fail | fail | ok
97 | incorrect (>) | ok |
98 | 1.0.2a < 1.0.2g | ok | fail | fail | ok
99 | incorrect (>) | ok |
101 Note 1: **fail** means that attempt to compare versions has thrown
102 an exception, usually bacause a library cannot parse specific version
105 Note 2: **version** module was not able to complete any tests as it's
106 a strict semantic version implementation which require 3 version
107 components. Also, it does not support Python 3 without modification.
109 ## Python wrapper features
111 - Provides API similar to C library, `version_compare(a, b)` function
112 - Provides more pythonic (but slower) `Version` class with overloaded
119 - [libversion] 2.7.0+
124 from libversion import Version, version_compare
126 assert(version_compare("0.9", "1.1") < 0)
127 assert(version_compare("1.0", "1.0.0") == 0)
128 assert(version_compare("1.1", "0.9") > 0)
130 assert(Version("0.9") < Version("1.1"))
131 assert(Version("1.0") == Version("1.0.0"))
132 assert(Version("1.1") > Version("0.9"))
134 assert(Version("0.999") < Version("1.0alpha1"))
135 assert(Version("1.0alpha1") < Version("1.0alpha2"))
136 assert(Version("1.0alpha2") < Version("1.0beta1"))
137 assert(Version("1.0beta1") < Version("1.0pre1"))
138 assert(Version("1.0pre1") < Version("1.0rc1"))
139 assert(Version("1.0rc1") < Version("1.0"))
140 assert(Version("1.0") < Version("1.0patch1"))
144 01b3fdfd7ed957d615251d1efe1a41fa0ff1391f1cd260881b20e24c1f4c1dc1 11162 libversion-1.2.1.tar.gz