diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-04-11 20:04:06 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-04-11 20:04:06 +0000 |
| commit | 9dfad90ce59b66db9120a41d90856f65e45ebc80 (patch) | |
| tree | a1336dea56c2565819d88fee1701834d63b11402 /python-esmre.spec | |
| parent | f285bf38a3429446b8c602659b84c5f34c7fe3a2 (diff) | |
automatic import of python-esmre
Diffstat (limited to 'python-esmre.spec')
| -rw-r--r-- | python-esmre.spec | 186 |
1 files changed, 186 insertions, 0 deletions
diff --git a/python-esmre.spec b/python-esmre.spec new file mode 100644 index 0000000..a7a2841 --- /dev/null +++ b/python-esmre.spec @@ -0,0 +1,186 @@ +%global _empty_manifest_terminate_build 0 +Name: python-esmre +Version: 1.0 +Release: 1 +Summary: Regular expression accelerator +License: GNU LGPL +URL: https://github.com/wharris/esmre +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/b2/e6/d5faf9881a91bda0ae85b210df399d19a74babf3f53edbf653b454cb93fe/esmre-1.0.tar.gz +BuildArch: noarch + + +%description +esmre is a Python module that can be used to speed up the execution of a large +collection of regular expressions. It works by building a index of compulsory +substrings from a collection of regular expressions, which it uses to quickly +exclude those expressions which trivially do not match each input. +Here is some example code that uses esmre: +```pycon +>>> import esmre +>>> index = esmre.Index() +>>> index.enter(r"Major-General\W*$", "savoy opera") +>>> index.enter(r"\bway\W+haye?\b", "sea shanty") +>>> index.query("I am the very model of a modern Major-General.") +['savoy opera'] +>>> index.query("Way, hay up she rises,") +['sea shanty'] +>>> +``` +The esmre module builds on the simpler string matching facilities of the esm +module, which wraps a C implementation some of the algorithms described in +Aho's and Corasick's paper on efficient string matching [Aho, A.V, and +Corasick, M. J. Efficient String Matching: An Aid to Bibliographic Search. +Comm. ACM 18:6 (June 1975), 333-340]. Some minor modifications have been made +to the algorithms in the paper and one algorithm is missing (for now), but +there is enough to implement a quick string matching index. +Here is some example code that uses esm directly: +```pycon +>>> import esm +>>> index = esm.Index() +>>> index.enter("he") +>>> index.enter("she") +>>> index.enter("his") +>>> index.enter("hers") +>>> index.fix() +>>> index.query("this here is history") +[((1, 4), 'his'), ((5, 7), 'he'), ((13, 16), 'his')] +>>> index.query("Those are his sheep!") +[((10, 13), 'his'), ((14, 17), 'she'), ((15, 17), 'he')] +>>> +``` +You can see more usage examples in the tests. + +%package -n python3-esmre +Summary: Regular expression accelerator +Provides: python-esmre +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-esmre +esmre is a Python module that can be used to speed up the execution of a large +collection of regular expressions. It works by building a index of compulsory +substrings from a collection of regular expressions, which it uses to quickly +exclude those expressions which trivially do not match each input. +Here is some example code that uses esmre: +```pycon +>>> import esmre +>>> index = esmre.Index() +>>> index.enter(r"Major-General\W*$", "savoy opera") +>>> index.enter(r"\bway\W+haye?\b", "sea shanty") +>>> index.query("I am the very model of a modern Major-General.") +['savoy opera'] +>>> index.query("Way, hay up she rises,") +['sea shanty'] +>>> +``` +The esmre module builds on the simpler string matching facilities of the esm +module, which wraps a C implementation some of the algorithms described in +Aho's and Corasick's paper on efficient string matching [Aho, A.V, and +Corasick, M. J. Efficient String Matching: An Aid to Bibliographic Search. +Comm. ACM 18:6 (June 1975), 333-340]. Some minor modifications have been made +to the algorithms in the paper and one algorithm is missing (for now), but +there is enough to implement a quick string matching index. +Here is some example code that uses esm directly: +```pycon +>>> import esm +>>> index = esm.Index() +>>> index.enter("he") +>>> index.enter("she") +>>> index.enter("his") +>>> index.enter("hers") +>>> index.fix() +>>> index.query("this here is history") +[((1, 4), 'his'), ((5, 7), 'he'), ((13, 16), 'his')] +>>> index.query("Those are his sheep!") +[((10, 13), 'his'), ((14, 17), 'she'), ((15, 17), 'he')] +>>> +``` +You can see more usage examples in the tests. + +%package help +Summary: Development documents and examples for esmre +Provides: python3-esmre-doc +%description help +esmre is a Python module that can be used to speed up the execution of a large +collection of regular expressions. It works by building a index of compulsory +substrings from a collection of regular expressions, which it uses to quickly +exclude those expressions which trivially do not match each input. +Here is some example code that uses esmre: +```pycon +>>> import esmre +>>> index = esmre.Index() +>>> index.enter(r"Major-General\W*$", "savoy opera") +>>> index.enter(r"\bway\W+haye?\b", "sea shanty") +>>> index.query("I am the very model of a modern Major-General.") +['savoy opera'] +>>> index.query("Way, hay up she rises,") +['sea shanty'] +>>> +``` +The esmre module builds on the simpler string matching facilities of the esm +module, which wraps a C implementation some of the algorithms described in +Aho's and Corasick's paper on efficient string matching [Aho, A.V, and +Corasick, M. J. Efficient String Matching: An Aid to Bibliographic Search. +Comm. ACM 18:6 (June 1975), 333-340]. Some minor modifications have been made +to the algorithms in the paper and one algorithm is missing (for now), but +there is enough to implement a quick string matching index. +Here is some example code that uses esm directly: +```pycon +>>> import esm +>>> index = esm.Index() +>>> index.enter("he") +>>> index.enter("she") +>>> index.enter("his") +>>> index.enter("hers") +>>> index.fix() +>>> index.query("this here is history") +[((1, 4), 'his'), ((5, 7), 'he'), ((13, 16), 'his')] +>>> index.query("Those are his sheep!") +[((10, 13), 'his'), ((14, 17), 'she'), ((15, 17), 'he')] +>>> +``` +You can see more usage examples in the tests. + +%prep +%autosetup -n esmre-1.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-esmre -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0-1 +- Package Spec generated |
