Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-matrix_common for
openSUSE:Factory checked in at 2022-02-25 21:25:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-matrix_common (Old)
and /work/SRC/openSUSE:Factory/.python-matrix_common.new.1958 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-matrix_common"
Fri Feb 25 21:25:18 2022 rev:2 rq:957623 version:1.1.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-matrix_common/python-matrix_common.changes
2022-01-24 23:10:53.786387899 +0100
+++
/work/SRC/openSUSE:Factory/.python-matrix_common.new.1958/python-matrix_common.changes
2022-02-25 21:25:51.199646677 +0100
@@ -1,0 +2,6 @@
+Tue Feb 22 12:13:35 UTC 2022 - Marcus Rueckert <[email protected]>
+
+- Update to 1.1.0
+ - Port get_version_string from Synapse.
+
+-------------------------------------------------------------------
Old:
----
matrix_common-1.0.0.tar.gz
New:
----
matrix_common-1.1.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-matrix_common.spec ++++++
--- /var/tmp/diff_new_pack.v8AxWL/_old 2022-02-25 21:25:51.731646772 +0100
+++ /var/tmp/diff_new_pack.v8AxWL/_new 2022-02-25 21:25:51.739646773 +0100
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python39 1
Name: python-matrix_common
-Version: 1.0.0
+Version: 1.1.0
Release: 0
Summary: Common utilities for Synapse, Sydent and Sygnal
License: MIT
++++++ matrix_common-1.0.0.tar.gz -> matrix_common-1.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/matrix_common-1.0.0/MANIFEST.in
new/matrix_common-1.1.0/MANIFEST.in
--- old/matrix_common-1.0.0/MANIFEST.in 1970-01-01 01:00:00.000000000 +0100
+++ new/matrix_common-1.1.0/MANIFEST.in 2022-02-10 19:37:15.000000000 +0100
@@ -0,0 +1,2 @@
+# Include tests in the source distribution
+recursive-include tests *.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/matrix_common-1.0.0/PKG-INFO
new/matrix_common-1.1.0/PKG-INFO
--- old/matrix_common-1.0.0/PKG-INFO 2021-12-03 17:11:22.217134700 +0100
+++ new/matrix_common-1.1.0/PKG-INFO 2022-02-11 22:08:37.808282100 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: matrix_common
-Version: 1.0.0
+Version: 1.1.0
Summary: Common utilities for Synapse, Sydent and Sygnal
Home-page: https://github.com/matrix-org/matrix-python-common
License: UNKNOWN
@@ -8,6 +8,7 @@
Classifier: License :: OSI Approved :: Apache Software License
Requires-Python: >=3.6
Description-Content-Type: text/markdown
+Provides-Extra: test
Provides-Extra: dev
License-File: LICENSE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/matrix_common-1.0.0/matrix_common/versionstring.py
new/matrix_common-1.1.0/matrix_common/versionstring.py
--- old/matrix_common-1.0.0/matrix_common/versionstring.py 1970-01-01
01:00:00.000000000 +0100
+++ new/matrix_common-1.1.0/matrix_common/versionstring.py 2022-02-11
22:03:02.000000000 +0100
@@ -0,0 +1,93 @@
+# Copyright 2016 OpenMarket Ltd
+# Copyright 2021-2022 The Matrix.org Foundation C.I.C.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+import functools
+import logging
+import subprocess
+
+try:
+ from importlib.metadata import distribution
+except ImportError:
+ from importlib_metadata import distribution # type: ignore
+
+__all__ = ["get_distribution_version_string"]
+
+logger = logging.getLogger(__name__)
+
+
[email protected]_cache()
+def get_distribution_version_string(distribution_name: str) -> str:
+ """Calculate a git-aware version string for a distribution package.
+
+ A "distribution package" is a thing that you can e.g. install and manage
with pip.
+ It can contain modules, an "import package" of multiple modules, and
arbitrary
+ resource data. See the glossary at
+
+
https://packaging.python.org/en/latest/glossary/#term-Distribution-Package
+
+ for all your taxonomic needs. Often a distribution package contains
exactly import
+ package---possibly with _different_ names. For example, one can install the
+ "matrix-sydent" distribution package from PyPI using pip, and doing so
makes the
+ "sydent" import package available to import.
+
+ Args:
+ distribution_name: The name of the distribution package to check the
version of
+
+ Raises:
+ importlib.metadata.PackageNotFoundError if the given distribution name
doesn't
+ exist.
+
+ Returns:
+ The module version, possibly with git version information included.
+ """
+
+ dist = distribution(distribution_name)
+ version_string = dist.version
+ cwd = dist.locate_file(".")
+
+ try:
+
+ def _run_git_command(prefix: str, *params: str) -> str:
+ try:
+ result = (
+ subprocess.check_output(
+ ["git", *params], stderr=subprocess.DEVNULL, cwd=cwd
+ )
+ .strip()
+ .decode("ascii")
+ )
+ return prefix + result
+ except (subprocess.CalledProcessError, FileNotFoundError):
+ return ""
+
+ git_branch = _run_git_command("b=", "rev-parse", "--abbrev-ref",
"HEAD")
+ git_tag = _run_git_command("t=", "describe", "--exact-match")
+ git_commit = _run_git_command("", "rev-parse", "--short", "HEAD")
+
+ dirty_string = "-this_is_a_dirty_checkout"
+ is_dirty = _run_git_command("", "describe", "--dirty=" +
dirty_string).endswith(
+ dirty_string
+ )
+ git_dirty = "dirty" if is_dirty else ""
+
+ if git_branch or git_tag or git_commit or git_dirty:
+ git_version = ",".join(
+ s for s in (git_branch, git_tag, git_commit, git_dirty) if s
+ )
+
+ version_string = f"{version_string} ({git_version})"
+ except Exception as e:
+ logger.info("Failed to check for git repository: %s", e)
+
+ return version_string
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/matrix_common-1.0.0/matrix_common.egg-info/PKG-INFO
new/matrix_common-1.1.0/matrix_common.egg-info/PKG-INFO
--- old/matrix_common-1.0.0/matrix_common.egg-info/PKG-INFO 2021-12-03
17:11:22.000000000 +0100
+++ new/matrix_common-1.1.0/matrix_common.egg-info/PKG-INFO 2022-02-11
22:08:37.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: matrix-common
-Version: 1.0.0
+Version: 1.1.0
Summary: Common utilities for Synapse, Sydent and Sygnal
Home-page: https://github.com/matrix-org/matrix-python-common
License: UNKNOWN
@@ -8,6 +8,7 @@
Classifier: License :: OSI Approved :: Apache Software License
Requires-Python: >=3.6
Description-Content-Type: text/markdown
+Provides-Extra: test
Provides-Extra: dev
License-File: LICENSE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/matrix_common-1.0.0/matrix_common.egg-info/SOURCES.txt
new/matrix_common-1.1.0/matrix_common.egg-info/SOURCES.txt
--- old/matrix_common-1.0.0/matrix_common.egg-info/SOURCES.txt 2021-12-03
17:11:22.000000000 +0100
+++ new/matrix_common-1.1.0/matrix_common.egg-info/SOURCES.txt 2022-02-11
22:08:37.000000000 +0100
@@ -1,12 +1,17 @@
LICENSE
+MANIFEST.in
README.md
pyproject.toml
setup.cfg
matrix_common/__init__.py
matrix_common/py.typed
matrix_common/regex.py
+matrix_common/versionstring.py
matrix_common.egg-info/PKG-INFO
matrix_common.egg-info/SOURCES.txt
matrix_common.egg-info/dependency_links.txt
matrix_common.egg-info/requires.txt
-matrix_common.egg-info/top_level.txt
\ No newline at end of file
+matrix_common.egg-info/top_level.txt
+tests/__init__.py
+tests/test_regex.py
+tests/test_versionstring.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/matrix_common-1.0.0/matrix_common.egg-info/requires.txt
new/matrix_common-1.1.0/matrix_common.egg-info/requires.txt
--- old/matrix_common-1.0.0/matrix_common.egg-info/requires.txt 2021-12-03
17:11:22.000000000 +0100
+++ new/matrix_common-1.1.0/matrix_common.egg-info/requires.txt 2022-02-11
22:08:37.000000000 +0100
@@ -1,5 +1,8 @@
attrs
+[:python_version < "3.8"]
+importlib_metadata>=1.4
+
[dev]
tox
twisted
@@ -8,3 +11,8 @@
black==21.9b0
flake8==4.0.1
isort==5.9.3
+
+[test]
+tox
+twisted
+aiounittest
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/matrix_common-1.0.0/setup.cfg
new/matrix_common-1.1.0/setup.cfg
--- old/matrix_common-1.0.0/setup.cfg 2021-12-03 17:11:22.217134700 +0100
+++ new/matrix_common-1.1.0/setup.cfg 2022-02-11 22:08:37.808282100 +0100
@@ -4,7 +4,7 @@
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/matrix-org/matrix-python-common
-version = 1.0.0
+version = 1.1.0
classifiers =
License :: OSI Approved :: Apache Software License
@@ -14,15 +14,18 @@
python_requires = >= 3.6
install_requires =
attrs
+ importlib_metadata >= 1.4; python_version < '3.8'
[options.package_data]
matrix_common = py.typed
[options.extras_require]
-dev =
+test =
tox
twisted
aiounittest
+dev =
+ %(test)s
mypy == 0.910
black == 21.9b0
flake8 == 4.0.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/matrix_common-1.0.0/tests/test_regex.py
new/matrix_common-1.1.0/tests/test_regex.py
--- old/matrix_common-1.0.0/tests/test_regex.py 1970-01-01 01:00:00.000000000
+0100
+++ new/matrix_common-1.1.0/tests/test_regex.py 2022-02-10 19:37:15.000000000
+0100
@@ -0,0 +1,102 @@
+# Copyright 2021 The Matrix.org Foundation C.I.C.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+import re
+from unittest import TestCase
+
+from matrix_common.regex import glob_to_regex, to_word_pattern
+
+
+class GlobToRegexTestCase(TestCase):
+ def test_literal_match(self) -> None:
+ """Tests matching against a literal."""
+ pattern = glob_to_regex("foobaz")
+ self.assertRegex(
+ "FoobaZ", pattern, "patterns should match and be case-insensitive"
+ )
+ self.assertNotRegex(
+ "x foobaz", pattern, "pattern should not match at word boundaries"
+ )
+
+ def test_wildcard_match(self) -> None:
+ """Tests matching with wildcards."""
+ pattern = glob_to_regex("f?o*baz")
+
+ self.assertRegex(
+ "FoobarbaZ",
+ pattern,
+ "* should match string and pattern should be case-insensitive",
+ )
+ self.assertRegex("foobaz", pattern, "* should match 0 characters")
+ self.assertNotRegex("fooxaz", pattern, "the character after * must
match")
+ self.assertNotRegex("fobbaz", pattern, "? should not match 0
characters")
+ self.assertNotRegex("fiiobaz", pattern, "? should not match 2
characters")
+
+ def test_multi_wildcard(self) -> None:
+ """Tests matching with multiple wildcards in a row."""
+ pattern = glob_to_regex("**baz")
+ self.assertRegex("agsgsbaz", pattern, "** should match any string")
+ self.assertRegex("baz", pattern, "** should match the empty string")
+ self.assertEqual(pattern.pattern, r"\A(.{0,}baz)\Z")
+
+ pattern = glob_to_regex("*?baz")
+ self.assertRegex("agsgsbaz", pattern, "*? should match any string")
+ self.assertRegex("abaz", pattern, "*? should match a single char")
+ self.assertNotRegex("baz", pattern, "*? should not match the empty
string")
+ self.assertEqual(pattern.pattern, r"\A(.{1,}baz)\Z")
+
+ pattern = glob_to_regex("a?*?*?baz")
+ self.assertRegex("a g baz", pattern, "?*?*? should match 3 chars")
+ self.assertNotRegex("a..baz", pattern, "?*?*? should not match 2
chars")
+ self.assertRegex("a.gg.baz", pattern, "?*?*? should match 4 chars")
+ self.assertEqual(pattern.pattern, r"\A(a.{3,}baz)\Z")
+
+ def test_ignore_case(self) -> None:
+ """Tests case sensitivity."""
+ pattern = glob_to_regex("foobaz", ignore_case=False)
+ self.assertEqual(pattern.flags & re.IGNORECASE, 0)
+
+ pattern = glob_to_regex("foobaz", ignore_case=True)
+ self.assertEqual(pattern.flags & re.IGNORECASE, re.IGNORECASE)
+
+
+class WordPatternTestCase(TestCase):
+ def test_whole_word(self) -> None:
+ """Tests matching on whole words."""
+ pattern = to_word_pattern("foo bar")
+
+ self.assertRegex("foo bar", pattern)
+ self.assertRegex(" foo bar ", pattern)
+ self.assertRegex("baz foo bar baz", pattern)
+ self.assertNotRegex("foo bar??", pattern, "?? should be seen as part
of a word")
+ self.assertNotRegex("bar foo", pattern, "Pattern should match words in
order")
+
+ def test_ends_with_non_letter(self) -> None:
+ """Tests matching on whole words when the pattern ends with a space."""
+ pattern = to_word_pattern("foo ")
+
+ self.assertRegex(
+ "foo bar",
+ pattern,
+ "Pattern should be able to end its match on a word boundary",
+ )
+ self.assertRegex(
+ "foo ",
+ pattern,
+ "Pattern should be able to end its match at the end of a string",
+ )
+ self.assertRegex(
+ "foo ",
+ pattern,
+ "Pattern should be able to end its match anywhere",
+ )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/matrix_common-1.0.0/tests/test_versionstring.py
new/matrix_common-1.1.0/tests/test_versionstring.py
--- old/matrix_common-1.0.0/tests/test_versionstring.py 1970-01-01
01:00:00.000000000 +0100
+++ new/matrix_common-1.1.0/tests/test_versionstring.py 2022-02-11
22:03:02.000000000 +0100
@@ -0,0 +1,27 @@
+# Copyright 2022 The Matrix.org Foundation C.I.C.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+from unittest import TestCase
+
+from matrix_common.versionstring import get_distribution_version_string
+
+
+class TestVersionString(TestCase):
+ def test_our_own_version_string(self) -> None:
+ """Sanity check that we get the version string for our own package.
+
+ Check that it's a nonempty string.
+ """
+ version = get_distribution_version_string("matrix-common")
+ self.assertIsInstance(version, str)
+ self.assertTrue(version)