15
0
forked from pool/python-exrex

- Update to version 0.11.0:

- Add support for \w and \W 
 - fix utf-8
 - Fix: Import error sre_parse: sre_parse module was moved in py3.11

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-exrex?expand=0&rev=17
This commit is contained in:
2023-03-12 08:38:07 +00:00
committed by Git OBS Bridge
parent f5fb4fa3cc
commit 1e85fc3497
6 changed files with 16 additions and 84 deletions

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d1609b4ec492b916838bdd107bb3ca0d69460c87d622a17e59121a0440bcf975
size 25571

3
exrex-0.11.0.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2df167ef3beed2f41d9e539de763332e6d357fd214a06294ac5f4302cc6609f4
size 25577

View File

@@ -1,46 +0,0 @@
From 44712bfb1350a509581a5834d9fa8aebcd9434db Mon Sep 17 00:00:00 2001
From: Michael Souza <119819695+sumslogs@users.noreply.github.com>
Date: Sat, 10 Dec 2022 21:52:13 -0800
Subject: [PATCH] Fix: Import error sre_parse
sre_parse module was moved in py3.11
---
exrex.py | 6 +++++-
tests.py | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/exrex.py b/exrex.py
index 24c0de9..be74f92 100644
--- a/exrex.py
+++ b/exrex.py
@@ -22,7 +22,11 @@
from future_builtins import map, range
except:
pass
-from re import match, sre_parse, U
+from re import match, U
+try:
+ import re._parser as sre_parse
+except ImportError: # Python < 3.11
+ from re import sre_parse
from itertools import tee
from random import choice, randint
from types import GeneratorType
diff --git a/tests.py b/tests.py
index 8a8a63e..ef0d42c 100644
--- a/tests.py
+++ b/tests.py
@@ -20,8 +20,12 @@
from exrex import generate, count, getone, CATEGORIES, simplify
import re
-import sre_parse
+try:
+ import re._parser as sre_parse
+except ImportError: # Python < 3.11
+ from re import sre_parse
from sys import exit, version_info
+
IS_PY3 = version_info[0] == 3
RS = {

View File

@@ -1,23 +0,0 @@
From 09a1ef0962268460f66084a992fee1aff77dc141 Mon Sep 17 00:00:00 2001
From: Sebastian Wagner <wagner@cert.at>
Date: Thu, 25 Feb 2021 21:03:56 +0100
Subject: [PATCH] setup.py: declare encoding as utf-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
the ellipsis (…) causes troubles otherwise on "old" python versions as
3.6
---
setup.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/setup.py b/setup.py
index 29c5a87..475a86f 100644
--- a/setup.py
+++ b/setup.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
import io
import os
import sys

View File

@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Sun Mar 12 08:36:45 UTC 2023 - Sebastian Wagner <sebix@sebix.at>
- Update to version 0.11.0:
- Add support for \w and \W
- fix utf-8
- Fix: Import error sre_parse: sre_parse module was moved in py3.11
-------------------------------------------------------------------
Mon Feb 27 19:06:55 UTC 2023 - Sebastian Wagner <sebix@sebix.at>

View File

@@ -16,21 +16,16 @@
#
%define revision fd1e21ffc7c16fd5637a5c440224766417e840f9
%define skip_python2 1
Name: python-exrex
Version: 0.10.5+git119
Version: 0.11.0
Release: 0
Summary: Irregular methods for regular expressions
License: AGPL-3.0-or-later
Group: Development/Languages/Python
URL: https://github.com/asciimoo/exrex
#Source: https://files.pythonhosted.org/packages/source/e/exrex/exrex-%%{version}.tar.gz
Source: https://github.com/asciimoo/exrex/archive/%{revision}.tar.gz#/exrex-%{version}.tar.gz
# PATCH-FIX-UPSTREAM fix-setup-encoding.patch
Patch0: https://github.com/asciimoo/exrex/pull/53.patch#/fix-setup-encoding.patch
# PATCH-FIX-UPSTREAM fix-python-3.11.patch
Patch1: https://github.com/asciimoo/exrex/pull/65.patch#/fix-python-3.11.patch
# pypi has no tests
Source: https://github.com/asciimoo/exrex/archive/v%{version}.tar.gz#/exrex-%{version}.tar.gz
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -44,10 +39,8 @@ BuildArch: noarch
A command line tool and python module that generates all or random matching strings to a given regular expression and more.
%prep
%setup -q -n exrex-%{revision}
%setup -q -n exrex-%{version}
sed -i '1s/^#!.*//' exrex.py
%patch0 -p1
%patch1 -p1
%build
%python_build
@@ -71,7 +64,7 @@ LANG=C.UTF-8 PYTHONPATH=%{buildroot}%{$python_sitelib} $python ./tests.py}
%files %{python_files}
%{python_sitelib}/exrex*
%{python_sitelib}/__pycache__/exrex.*
%{python_sitelib}/exrex-0.10.6*-info
%{python_sitelib}/exrex-%{version}*-info
%license COPYING
%doc README.md doc/
%python_alternative %{_bindir}/exrex