diff options
Diffstat (limited to 'python-onigurumacffi.spec')
| -rw-r--r-- | python-onigurumacffi.spec | 236 |
1 files changed, 236 insertions, 0 deletions
diff --git a/python-onigurumacffi.spec b/python-onigurumacffi.spec new file mode 100644 index 0000000..7ba3471 --- /dev/null +++ b/python-onigurumacffi.spec @@ -0,0 +1,236 @@ +%global _empty_manifest_terminate_build 0 +Name: python-onigurumacffi +Version: 1.2.0 +Release: 1 +Summary: python cffi bindings for the oniguruma regex engine +License: MIT +URL: https://github.com/asottile/onigurumacffi +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/83/3c/c96d657459daea4f65cf8aa7b8c2a2f37b5ad9fbe624f033f6928decbebf/onigurumacffi-1.2.0.tar.gz + + +%description +python cffi bindings for the oniguruma regex engine +### installation +```bash +pip install onigurumacffi +``` +- wheels should be available on pypi in most cases +- to build from source, `libonig-dev` must be installed prior to installation +### api +the api is currently *very limited* (basically just enough to support what I +needed). +#### `compile(pattern: str) -> _Pattern` +make a compiled pattern +#### `compile_regset(*patterns: str) -> _RegSet` +make a compiled RegSet +#### `OnigSearchOption` +an enum listing the search-time options for oniguruma +the current set of options are: +```python +class OnigSearchOption(enum.IntEnum): + NONE = ... + NOTBOL = ... + NOTEOL = ... + POSIX_REGION = ... + CHECK_VALIDITY_OF_STRING = ... + NOT_BEGIN_STRING = ... + NOT_BEGIN_POSITION = ... +``` +#### `_Pattern.match(s: str, start: int = 0, flags: OnigSearchOption = OnigSearchOption.NONE) -> Optional[_Match]` +match a string using the pattern. optionally set `start` to adjust the offset +which is searched from +#### `_Pattern.search(s: str, start: int = 0, flags: OnigSearchOption = OnigSearchOption.NONE) -> Optional[_Match]` +search a string using the pattern. optionally set `start` to adjust the offset +which is searched from +#### `_Pattern.number_of_captures() -> int` +return the number of captures in the regex +#### `_RegSet.search(s: str, start: int = 0, flags: OnigSearchOption = OnigSearchOption.NONE) -> Tuple[int, Optional[_Match]]` +search a string using the RegSet. optionally set `start` to adjust the offset +which is searched from +the leftmost regex index and match is returned or `(-1, None)` if there is no +match +#### `_Match.group(n: int = 0) -> str` +return the string of the matched group, defaults to 0 (the whole match) +#### `_Match[n: int] -> str` +a shorthand alias for `_Match.group(...)` +#### `_Match.start(n: int = 0) -> int` +return the character position of the start of the matched group, defaults to 0 +(the whole match) +#### `_Match.end(n: int = 0) -> int` +return the character position of the end of the matched group, defaults to 0 +(the whole match) +#### `_Match.span(n: int = 0) -> int` +return `(start, end)` character position of the matched group, defaults to 0 +(the whole match) +#### `_Match.expand(s: str) -> str` +expand numeric groups in `s` via the groups in the match + +%package -n python3-onigurumacffi +Summary: python cffi bindings for the oniguruma regex engine +Provides: python-onigurumacffi +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +BuildRequires: python3-cffi +BuildRequires: gcc +BuildRequires: gdb +%description -n python3-onigurumacffi +python cffi bindings for the oniguruma regex engine +### installation +```bash +pip install onigurumacffi +``` +- wheels should be available on pypi in most cases +- to build from source, `libonig-dev` must be installed prior to installation +### api +the api is currently *very limited* (basically just enough to support what I +needed). +#### `compile(pattern: str) -> _Pattern` +make a compiled pattern +#### `compile_regset(*patterns: str) -> _RegSet` +make a compiled RegSet +#### `OnigSearchOption` +an enum listing the search-time options for oniguruma +the current set of options are: +```python +class OnigSearchOption(enum.IntEnum): + NONE = ... + NOTBOL = ... + NOTEOL = ... + POSIX_REGION = ... + CHECK_VALIDITY_OF_STRING = ... + NOT_BEGIN_STRING = ... + NOT_BEGIN_POSITION = ... +``` +#### `_Pattern.match(s: str, start: int = 0, flags: OnigSearchOption = OnigSearchOption.NONE) -> Optional[_Match]` +match a string using the pattern. optionally set `start` to adjust the offset +which is searched from +#### `_Pattern.search(s: str, start: int = 0, flags: OnigSearchOption = OnigSearchOption.NONE) -> Optional[_Match]` +search a string using the pattern. optionally set `start` to adjust the offset +which is searched from +#### `_Pattern.number_of_captures() -> int` +return the number of captures in the regex +#### `_RegSet.search(s: str, start: int = 0, flags: OnigSearchOption = OnigSearchOption.NONE) -> Tuple[int, Optional[_Match]]` +search a string using the RegSet. optionally set `start` to adjust the offset +which is searched from +the leftmost regex index and match is returned or `(-1, None)` if there is no +match +#### `_Match.group(n: int = 0) -> str` +return the string of the matched group, defaults to 0 (the whole match) +#### `_Match[n: int] -> str` +a shorthand alias for `_Match.group(...)` +#### `_Match.start(n: int = 0) -> int` +return the character position of the start of the matched group, defaults to 0 +(the whole match) +#### `_Match.end(n: int = 0) -> int` +return the character position of the end of the matched group, defaults to 0 +(the whole match) +#### `_Match.span(n: int = 0) -> int` +return `(start, end)` character position of the matched group, defaults to 0 +(the whole match) +#### `_Match.expand(s: str) -> str` +expand numeric groups in `s` via the groups in the match + +%package help +Summary: Development documents and examples for onigurumacffi +Provides: python3-onigurumacffi-doc +%description help +python cffi bindings for the oniguruma regex engine +### installation +```bash +pip install onigurumacffi +``` +- wheels should be available on pypi in most cases +- to build from source, `libonig-dev` must be installed prior to installation +### api +the api is currently *very limited* (basically just enough to support what I +needed). +#### `compile(pattern: str) -> _Pattern` +make a compiled pattern +#### `compile_regset(*patterns: str) -> _RegSet` +make a compiled RegSet +#### `OnigSearchOption` +an enum listing the search-time options for oniguruma +the current set of options are: +```python +class OnigSearchOption(enum.IntEnum): + NONE = ... + NOTBOL = ... + NOTEOL = ... + POSIX_REGION = ... + CHECK_VALIDITY_OF_STRING = ... + NOT_BEGIN_STRING = ... + NOT_BEGIN_POSITION = ... +``` +#### `_Pattern.match(s: str, start: int = 0, flags: OnigSearchOption = OnigSearchOption.NONE) -> Optional[_Match]` +match a string using the pattern. optionally set `start` to adjust the offset +which is searched from +#### `_Pattern.search(s: str, start: int = 0, flags: OnigSearchOption = OnigSearchOption.NONE) -> Optional[_Match]` +search a string using the pattern. optionally set `start` to adjust the offset +which is searched from +#### `_Pattern.number_of_captures() -> int` +return the number of captures in the regex +#### `_RegSet.search(s: str, start: int = 0, flags: OnigSearchOption = OnigSearchOption.NONE) -> Tuple[int, Optional[_Match]]` +search a string using the RegSet. optionally set `start` to adjust the offset +which is searched from +the leftmost regex index and match is returned or `(-1, None)` if there is no +match +#### `_Match.group(n: int = 0) -> str` +return the string of the matched group, defaults to 0 (the whole match) +#### `_Match[n: int] -> str` +a shorthand alias for `_Match.group(...)` +#### `_Match.start(n: int = 0) -> int` +return the character position of the start of the matched group, defaults to 0 +(the whole match) +#### `_Match.end(n: int = 0) -> int` +return the character position of the end of the matched group, defaults to 0 +(the whole match) +#### `_Match.span(n: int = 0) -> int` +return `(start, end)` character position of the matched group, defaults to 0 +(the whole match) +#### `_Match.expand(s: str) -> str` +expand numeric groups in `s` via the groups in the match + +%prep +%autosetup -n onigurumacffi-1.2.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-onigurumacffi -f filelist.lst +%dir %{python3_sitearch}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 1.2.0-1 +- Package Spec generated |
