diff options
Diffstat (limited to 'python-awesomeversion.spec')
-rw-r--r-- | python-awesomeversion.spec | 285 |
1 files changed, 285 insertions, 0 deletions
diff --git a/python-awesomeversion.spec b/python-awesomeversion.spec new file mode 100644 index 0000000..b6e7464 --- /dev/null +++ b/python-awesomeversion.spec @@ -0,0 +1,285 @@ +%global _empty_manifest_terminate_build 0 +Name: python-awesomeversion +Version: 22.9.0 +Release: 1 +Summary: One version package to rule them all, One version package to find them, One version package to bring them all, and in the darkness bind them. +License: MIT +URL: https://github.com/ludeeus/awesomeversion +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/58/97/f1ef084dded7d9b4c0b15a7644936384e72f7ba4daa1f30b4e87e98bd739/awesomeversion-22.9.0.tar.gz +BuildArch: noarch + + +%description +`version` | The version string to parse. +`ensure_strategy` | Match the `AwesomeVersion` object against spesific strategies when creating if. If it does not match `AwesomeVersionStrategyException` will be raised +`find_first_match` | If True, the version given will be scanned for the first match of the given `ensure_strategy`. Raises `AwesomeVersionStrategyException` If it is not found for any of the given strategies. +## Example usage +These are some examples of what you can do, more examples can be found in the `tests` directory. +```python +from awesomeversion import AwesomeVersion +current = AwesomeVersion("1.2.2") +upstream = AwesomeVersion("1.2.3") +print(upstream > current) +> True +``` +```python +from awesomeversion import AwesomeVersion +version = AwesomeVersion("1.2.3b0") +print(version.beta) +> True +``` +```python +from awesomeversion import AwesomeVersion +current = AwesomeVersion("2021.1.0") +upstream = AwesomeVersion("2021.1.0b2") +print(upstream > current) +> False +``` +```python +from awesomeversion import AwesomeVersion +current = AwesomeVersion("latest") +upstream = AwesomeVersion("2021.1.0") +print(upstream > current) +> False +``` +```python +from awesomeversion import AwesomeVersion +current = AwesomeVersion("latest") +upstream = AwesomeVersion("dev") +print(upstream > current) +> True +``` +```python +from awesomeversion import AwesomeVersion +with AwesomeVersion("20.12.0") as current: + with AwesomeVersion("20.12.1") as upstream: + print(upstream > current) +> True +``` +```python +from awesomeversion import AwesomeVersion +with AwesomeVersion("20.12.0") as current: + print("2020.12.1" > current) +> True +``` +```python +from awesomeversion import AwesomeVersion +version = AwesomeVersion("2.12.0") +print(version.major) +> 2 +print(version.minor) +> 12 +print(version.patch) +> 0 +``` +## Contribute +**All** contributions are welcome! +1. Fork the repository +2. Clone the repository locally and open the devcontainer or use GitHub codespaces +3. Do your changes +4. Lint the files with `make lint` +5. Ensure all tests passes with `make test` +6. Ensure 100% coverage with `make coverage` +7. Commit your work, and push it to GitHub +8. Create a PR against the `main` branch + +%package -n python3-awesomeversion +Summary: One version package to rule them all, One version package to find them, One version package to bring them all, and in the darkness bind them. +Provides: python-awesomeversion +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-awesomeversion +`version` | The version string to parse. +`ensure_strategy` | Match the `AwesomeVersion` object against spesific strategies when creating if. If it does not match `AwesomeVersionStrategyException` will be raised +`find_first_match` | If True, the version given will be scanned for the first match of the given `ensure_strategy`. Raises `AwesomeVersionStrategyException` If it is not found for any of the given strategies. +## Example usage +These are some examples of what you can do, more examples can be found in the `tests` directory. +```python +from awesomeversion import AwesomeVersion +current = AwesomeVersion("1.2.2") +upstream = AwesomeVersion("1.2.3") +print(upstream > current) +> True +``` +```python +from awesomeversion import AwesomeVersion +version = AwesomeVersion("1.2.3b0") +print(version.beta) +> True +``` +```python +from awesomeversion import AwesomeVersion +current = AwesomeVersion("2021.1.0") +upstream = AwesomeVersion("2021.1.0b2") +print(upstream > current) +> False +``` +```python +from awesomeversion import AwesomeVersion +current = AwesomeVersion("latest") +upstream = AwesomeVersion("2021.1.0") +print(upstream > current) +> False +``` +```python +from awesomeversion import AwesomeVersion +current = AwesomeVersion("latest") +upstream = AwesomeVersion("dev") +print(upstream > current) +> True +``` +```python +from awesomeversion import AwesomeVersion +with AwesomeVersion("20.12.0") as current: + with AwesomeVersion("20.12.1") as upstream: + print(upstream > current) +> True +``` +```python +from awesomeversion import AwesomeVersion +with AwesomeVersion("20.12.0") as current: + print("2020.12.1" > current) +> True +``` +```python +from awesomeversion import AwesomeVersion +version = AwesomeVersion("2.12.0") +print(version.major) +> 2 +print(version.minor) +> 12 +print(version.patch) +> 0 +``` +## Contribute +**All** contributions are welcome! +1. Fork the repository +2. Clone the repository locally and open the devcontainer or use GitHub codespaces +3. Do your changes +4. Lint the files with `make lint` +5. Ensure all tests passes with `make test` +6. Ensure 100% coverage with `make coverage` +7. Commit your work, and push it to GitHub +8. Create a PR against the `main` branch + +%package help +Summary: Development documents and examples for awesomeversion +Provides: python3-awesomeversion-doc +%description help +`version` | The version string to parse. +`ensure_strategy` | Match the `AwesomeVersion` object against spesific strategies when creating if. If it does not match `AwesomeVersionStrategyException` will be raised +`find_first_match` | If True, the version given will be scanned for the first match of the given `ensure_strategy`. Raises `AwesomeVersionStrategyException` If it is not found for any of the given strategies. +## Example usage +These are some examples of what you can do, more examples can be found in the `tests` directory. +```python +from awesomeversion import AwesomeVersion +current = AwesomeVersion("1.2.2") +upstream = AwesomeVersion("1.2.3") +print(upstream > current) +> True +``` +```python +from awesomeversion import AwesomeVersion +version = AwesomeVersion("1.2.3b0") +print(version.beta) +> True +``` +```python +from awesomeversion import AwesomeVersion +current = AwesomeVersion("2021.1.0") +upstream = AwesomeVersion("2021.1.0b2") +print(upstream > current) +> False +``` +```python +from awesomeversion import AwesomeVersion +current = AwesomeVersion("latest") +upstream = AwesomeVersion("2021.1.0") +print(upstream > current) +> False +``` +```python +from awesomeversion import AwesomeVersion +current = AwesomeVersion("latest") +upstream = AwesomeVersion("dev") +print(upstream > current) +> True +``` +```python +from awesomeversion import AwesomeVersion +with AwesomeVersion("20.12.0") as current: + with AwesomeVersion("20.12.1") as upstream: + print(upstream > current) +> True +``` +```python +from awesomeversion import AwesomeVersion +with AwesomeVersion("20.12.0") as current: + print("2020.12.1" > current) +> True +``` +```python +from awesomeversion import AwesomeVersion +version = AwesomeVersion("2.12.0") +print(version.major) +> 2 +print(version.minor) +> 12 +print(version.patch) +> 0 +``` +## Contribute +**All** contributions are welcome! +1. Fork the repository +2. Clone the repository locally and open the devcontainer or use GitHub codespaces +3. Do your changes +4. Lint the files with `make lint` +5. Ensure all tests passes with `make test` +6. Ensure 100% coverage with `make coverage` +7. Commit your work, and push it to GitHub +8. Create a PR against the `main` branch + +%prep +%autosetup -n awesomeversion-22.9.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-awesomeversion -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 22.9.0-1 +- Package Spec generated |