diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-18 06:04:55 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-18 06:04:55 +0000 |
commit | 1be17b17398b0118448bcfdf92c8d2814e07f3b3 (patch) | |
tree | 2baa88abf8f2a85dfdc1749edd65b77506b4a54b | |
parent | afba28ce7046f40bc6371606c1b90ffb981745fc (diff) |
automatic import of python-grailsort
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-grailsort.spec | 314 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 316 insertions, 0 deletions
@@ -0,0 +1 @@ +/GrailSort-1.2.2.tar.gz diff --git a/python-grailsort.spec b/python-grailsort.spec new file mode 100644 index 0000000..2a04b16 --- /dev/null +++ b/python-grailsort.spec @@ -0,0 +1,314 @@ +%global _empty_manifest_terminate_build 0 +Name: python-GrailSort +Version: 1.2.2 +Release: 1 +Summary: Cython wrapper around GrailSort (https://github.com/gaming32/GrailSort-Maintained) +License: License :: OSI Approved :: MIT License +URL: https://github.com/gaming32/grailsort +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/42/f0/9242784eeb26e32c8c5dfaa7d2dcdb968fcc9dd8ed32fca80d9d76c6d0c5/GrailSort-1.2.2.tar.gz + + +%description + + + + + + +<!--  --> +<!--  --> + + +[Join the Discord channel for live tech support!](https://discord.com/channels/673206188825116713/772978855752368149) + + +# GrailSort for Python + +GrailSort for Python is a Python API for the [GrailSort algorithm](https://github.com/Mrrl/GrailSort). + +## Installation + +You can install GrailSort for Python from source: +```shell +$ git clone https://github.com/gaming32/grailsort +$ cd grailsort +$ python setup.py install +``` + +Or you can install it from PyPI: +```shell +$ python -m pip install GrailSort +``` + +## Usage + +GrailSort for Python comes with two modules: a strict one, and a slower one. The strict module (`cGrailSort`) only deals with `array.array('d')` objects, while the slower module (`grailsort`) deals with any Python sequence that contains comparable objects. +It is generally unnescessary to deal with the `grailsort` module, as you might as well use the built-in `list.sort` method or the `sorted` function. However, TimSort is not in-place, while GrailSort is. `cGrailSort` is useful when you need to sort with speed. + +## Example + +### grailsort + +```python +import grailsort +import random + +def print_out_of_order_index(): + index = next((i for i in range(len(l) - 1) if l[i] > l[i + 1]), None) + print('Out of order index:', index) + +l = list(range(1024)) +print_out_of_order_index() + +random.shuffle(l) +print_out_of_order_index() + +grailsort.grailsort(l) +print_out_of_order_index() +``` + +### cGrailSort + +```python +import cGrailSort +import array +import random + +def print_out_of_order_index(): + index = next((i for i in range(len(a) - 1) if a[i] > a[i + 1]), None) + print('Out of order index:', index) + +a = array.array('d', range(1024)) +print_out_of_order_index() + +random.shuffle(a) +print_out_of_order_index() + +cGrailSort.grailsort(a) +print_out_of_order_index() +``` + + + + +%package -n python3-GrailSort +Summary: Cython wrapper around GrailSort (https://github.com/gaming32/GrailSort-Maintained) +Provides: python-GrailSort +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +BuildRequires: python3-cffi +BuildRequires: gcc +BuildRequires: gdb +%description -n python3-GrailSort + + + + + + +<!--  --> +<!--  --> + + +[Join the Discord channel for live tech support!](https://discord.com/channels/673206188825116713/772978855752368149) + + +# GrailSort for Python + +GrailSort for Python is a Python API for the [GrailSort algorithm](https://github.com/Mrrl/GrailSort). + +## Installation + +You can install GrailSort for Python from source: +```shell +$ git clone https://github.com/gaming32/grailsort +$ cd grailsort +$ python setup.py install +``` + +Or you can install it from PyPI: +```shell +$ python -m pip install GrailSort +``` + +## Usage + +GrailSort for Python comes with two modules: a strict one, and a slower one. The strict module (`cGrailSort`) only deals with `array.array('d')` objects, while the slower module (`grailsort`) deals with any Python sequence that contains comparable objects. +It is generally unnescessary to deal with the `grailsort` module, as you might as well use the built-in `list.sort` method or the `sorted` function. However, TimSort is not in-place, while GrailSort is. `cGrailSort` is useful when you need to sort with speed. + +## Example + +### grailsort + +```python +import grailsort +import random + +def print_out_of_order_index(): + index = next((i for i in range(len(l) - 1) if l[i] > l[i + 1]), None) + print('Out of order index:', index) + +l = list(range(1024)) +print_out_of_order_index() + +random.shuffle(l) +print_out_of_order_index() + +grailsort.grailsort(l) +print_out_of_order_index() +``` + +### cGrailSort + +```python +import cGrailSort +import array +import random + +def print_out_of_order_index(): + index = next((i for i in range(len(a) - 1) if a[i] > a[i + 1]), None) + print('Out of order index:', index) + +a = array.array('d', range(1024)) +print_out_of_order_index() + +random.shuffle(a) +print_out_of_order_index() + +cGrailSort.grailsort(a) +print_out_of_order_index() +``` + + + + +%package help +Summary: Development documents and examples for GrailSort +Provides: python3-GrailSort-doc +%description help + + + + + + +<!--  --> +<!--  --> + + +[Join the Discord channel for live tech support!](https://discord.com/channels/673206188825116713/772978855752368149) + + +# GrailSort for Python + +GrailSort for Python is a Python API for the [GrailSort algorithm](https://github.com/Mrrl/GrailSort). + +## Installation + +You can install GrailSort for Python from source: +```shell +$ git clone https://github.com/gaming32/grailsort +$ cd grailsort +$ python setup.py install +``` + +Or you can install it from PyPI: +```shell +$ python -m pip install GrailSort +``` + +## Usage + +GrailSort for Python comes with two modules: a strict one, and a slower one. The strict module (`cGrailSort`) only deals with `array.array('d')` objects, while the slower module (`grailsort`) deals with any Python sequence that contains comparable objects. +It is generally unnescessary to deal with the `grailsort` module, as you might as well use the built-in `list.sort` method or the `sorted` function. However, TimSort is not in-place, while GrailSort is. `cGrailSort` is useful when you need to sort with speed. + +## Example + +### grailsort + +```python +import grailsort +import random + +def print_out_of_order_index(): + index = next((i for i in range(len(l) - 1) if l[i] > l[i + 1]), None) + print('Out of order index:', index) + +l = list(range(1024)) +print_out_of_order_index() + +random.shuffle(l) +print_out_of_order_index() + +grailsort.grailsort(l) +print_out_of_order_index() +``` + +### cGrailSort + +```python +import cGrailSort +import array +import random + +def print_out_of_order_index(): + index = next((i for i in range(len(a) - 1) if a[i] > a[i + 1]), None) + print('Out of order index:', index) + +a = array.array('d', range(1024)) +print_out_of_order_index() + +random.shuffle(a) +print_out_of_order_index() + +cGrailSort.grailsort(a) +print_out_of_order_index() +``` + + + + +%prep +%autosetup -n GrailSort-1.2.2 + +%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-GrailSort -f filelist.lst +%dir %{python3_sitearch}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Thu May 18 2023 Python_Bot <Python_Bot@openeuler.org> - 1.2.2-1 +- Package Spec generated @@ -0,0 +1 @@ +5e04596c5c2f664d6b1ee7645f00f82a GrailSort-1.2.2.tar.gz |