-
Notifications
You must be signed in to change notification settings - Fork 545
feat: Version Compare To PyPI #4798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Prtm2110
wants to merge
10
commits into
intel:main
Choose a base branch
from
Prtm2110:version_compare_package
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
bda4188
added setup and version_checker package
Prtm2110 40e19ff
fix: setup.py modified
Prtm2110 e61281b
Merge branch 'main' into version_compare_package
Prtm2110 f1d8fb5
fix: flake 8 warning
Prtm2110 42a90b6
chore: 3.13 support
Prtm2110 77e26e7
Merge branch 'main' into version_compare_package
Prtm2110 8acc0f6
chore: import error fix
Prtm2110 a2924c3
Merge branch 'main' into version_compare_package
Prtm2110 6e75293
doc updated
Prtm2110 948bbcb
Merge branch 'main' into version_compare_package
Prtm2110 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright (C) 2025 Intel Corporation | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
# THIS IS A SETUP FILE FOR THE VERSION COMPARE MODULE | ||
|
||
import pathlib | ||
|
||
from setuptools import find_packages, setup | ||
|
||
PACKAGE_ROOT_PATH = pathlib.Path(__file__).parent.resolve() | ||
|
||
with open(PACKAGE_ROOT_PATH / "version_compare" / "README.md", encoding="utf-8") as f: | ||
readme = f.read() | ||
|
||
setup( | ||
name="version_compare", | ||
version="0.1.0", | ||
description="Version checker module for CVE Binary Checker Tool", | ||
long_description=readme, | ||
long_description_content_type="text/markdown", | ||
author="Terri Oda", | ||
author_email="[email protected]", | ||
maintainer="Terri Oda", | ||
maintainer_email="[email protected]", | ||
url="https://github.com/intel/cve-bin-tool", | ||
license="GPL-3.0-or-later", | ||
keywords=["version", "parsers", "checker"], | ||
python_requires=">=3.8", | ||
classifiers=[ | ||
"Development Status :: 3 - Alpha", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: GNU General Public License (GPL)", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Programming Language :: Python :: 3.13", | ||
], | ||
install_requires=[], | ||
packages=find_packages(include=["version_checker", "version_checker.*"]), | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Version Compare Package | ||
|
||
The `version_compare.py` module, originally part of `cve-bin-tool`, is now released as a separate package on PyPI while maintaining the same existing API. You can install it via: | ||
|
||
```sh | ||
pip install version_compare | ||
``` | ||
|
||
## Example Usage | ||
|
||
### Using `version_compare` Directly | ||
```python | ||
from version_compare import version_compare | ||
|
||
print(version_compare("1.2", "1.1")) # Output: 1 (1.2 > 1.1) | ||
print(version_compare("1.2a", "1.2b")) # Output: -1 (1.2a < 1.2b) | ||
``` | ||
|
||
### Using the `Version` Class from `version_compare` | ||
```python | ||
from parsers import Version | ||
|
||
print(Version("1.2") < Version("1.3")) # Output: True | ||
``` | ||
|
||
### Using `Version` from `cve-bin-tool` | ||
```python | ||
from cve_bin_tool.version_compare import Version | ||
|
||
print(Version("1.2") < Version("1.3")) # Output: True | ||
``` | ||
|
||
## Exceptions | ||
|
||
- **`CannotParseVersionException`**: Raised when a version string cannot be parsed. | ||
- **`UnknownVersion`**: Raised if the version is `null` or `unknown`. | ||
|
||
This README serves as documentation for the `parsers` package and its usage within `cve-bin-tool`. | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Copyright (C) 2025 Intel Corporation | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
from .version_compare import * | ||
Prtm2110 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.