Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-gTTS for openSUSE:Factory checked in at 2024-01-03 12:24:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-gTTS (Old) and /work/SRC/openSUSE:Factory/.python-gTTS.new.28375 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-gTTS" Wed Jan 3 12:24:51 2024 rev:13 rq:1135656 version:2.5.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-gTTS/python-gTTS.changes 2023-12-12 19:32:09.332296053 +0100 +++ /work/SRC/openSUSE:Factory/.python-gTTS.new.28375/python-gTTS.changes 2024-01-03 12:24:56.491375366 +0100 @@ -1,0 +2,6 @@ +Fri Dec 29 12:46:13 UTC 2023 - Dirk Müller <[email protected]> + +- update to 2.5.0: + * Add connection timeout + misc improvements (#440) + +------------------------------------------------------------------- Old: ---- gTTS-2.4.0.tar.gz New: ---- gTTS-2.5.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-gTTS.spec ++++++ --- /var/tmp/diff_new_pack.qmkG7z/_old 2024-01-03 12:24:57.767421990 +0100 +++ /var/tmp/diff_new_pack.qmkG7z/_new 2024-01-03 12:24:57.787422721 +0100 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-gTTS -Version: 2.4.0 +Version: 2.5.0 Release: 0 Summary: Python module to create MP3 files from spoken text via the Google TTS API License: MIT @@ -79,5 +79,5 @@ %license LICENSE %python_alternative %{_bindir}/gtts-cli %{python_sitelib}/gtts -%{python_sitelib}/gTTS-%{version}*-info +%{python_sitelib}/gTTS-%{version}.dist-info ++++++ gTTS-2.4.0.tar.gz -> gTTS-2.5.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gTTS-2.4.0/.github/workflows/autolock.yml new/gTTS-2.5.0/.github/workflows/autolock.yml --- old/gTTS-2.4.0/.github/workflows/autolock.yml 2023-10-03 18:50:36.000000000 +0200 +++ new/gTTS-2.5.0/.github/workflows/autolock.yml 2023-12-20 05:16:08.000000000 +0100 @@ -9,7 +9,7 @@ lock: runs-on: ubuntu-latest steps: - - uses: dessant/lock-threads@v4 + - uses: dessant/lock-threads@v5 with: github-token: ${{ github.token }} issue-inactive-days: '15' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gTTS-2.4.0/.github/workflows/codecov.yml new/gTTS-2.5.0/.github/workflows/codecov.yml --- old/gTTS-2.4.0/.github/workflows/codecov.yml 2023-10-03 18:50:36.000000000 +0200 +++ new/gTTS-2.5.0/.github/workflows/codecov.yml 2023-12-20 05:16:08.000000000 +0100 @@ -21,7 +21,7 @@ steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.12" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gTTS-2.4.0/.github/workflows/release.yml new/gTTS-2.5.0/.github/workflows/release.yml --- old/gTTS-2.4.0/.github/workflows/release.yml 2023-10-03 18:50:36.000000000 +0200 +++ new/gTTS-2.5.0/.github/workflows/release.yml 2023-12-20 05:16:08.000000000 +0100 @@ -22,11 +22,8 @@ steps: - name: Release Please - uses: google-github-actions/release-please-action@v3 + uses: google-github-actions/release-please-action@v4 id: release - with: - release-type: python - package-name: gTTS # Only do the rest (package build/push) if a release was created - name: Checkout @@ -34,7 +31,7 @@ uses: actions/checkout@v4 - name: Setup Python if: ${{ steps.release.outputs.release_created }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.12" - name: Install build dependencies @@ -47,7 +44,7 @@ run: python -m build - name: Publish package if: ${{ steps.release.outputs.release_created }} - uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e + uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf # References: # * Release Please: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gTTS-2.4.0/.github/workflows/test.yml new/gTTS-2.5.0/.github/workflows/test.yml --- old/gTTS-2.4.0/.github/workflows/test.yml 2023-10-03 18:50:36.000000000 +0200 +++ new/gTTS-2.5.0/.github/workflows/test.yml 2023-12-20 05:16:08.000000000 +0100 @@ -29,7 +29,7 @@ steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gTTS-2.4.0/.github/workflows/update_langs.yml new/gTTS-2.5.0/.github/workflows/update_langs.yml --- old/gTTS-2.4.0/.github/workflows/update_langs.yml 2023-10-03 18:50:36.000000000 +0200 +++ new/gTTS-2.5.0/.github/workflows/update_langs.yml 2023-12-20 05:16:08.000000000 +0100 @@ -23,7 +23,7 @@ - name: Checkout uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.12" - name: Install gTTS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gTTS-2.4.0/.release-please-manifest.json new/gTTS-2.5.0/.release-please-manifest.json --- old/gTTS-2.4.0/.release-please-manifest.json 1970-01-01 01:00:00.000000000 +0100 +++ new/gTTS-2.5.0/.release-please-manifest.json 2023-12-20 05:16:08.000000000 +0100 @@ -0,0 +1 @@ +{".":"2.5.0"} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gTTS-2.4.0/CHANGELOG.md new/gTTS-2.5.0/CHANGELOG.md --- old/gTTS-2.4.0/CHANGELOG.md 2023-10-03 18:50:36.000000000 +0200 +++ new/gTTS-2.5.0/CHANGELOG.md 2023-12-20 05:16:08.000000000 +0100 @@ -1,5 +1,12 @@ # Changelog +## [2.5.0](https://github.com/pndurette/gTTS/compare/v2.4.0...v2.5.0) (2023-12-20) + + +### Features + +* Add connection timeout + misc improvements ([#440](https://github.com/pndurette/gTTS/issues/440)) ([bcdb79d](https://github.com/pndurette/gTTS/commit/bcdb79df41e76c5c1e4fea6388d0eeb3f0c009f6)) + ## [2.4.0](https://github.com/pndurette/gTTS/compare/v2.3.2...v2.4.0) (2023-10-03) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gTTS-2.4.0/gtts/__init__.py new/gTTS-2.5.0/gtts/__init__.py --- old/gTTS-2.4.0/gtts/__init__.py 2023-10-03 18:50:36.000000000 +0200 +++ new/gTTS-2.5.0/gtts/__init__.py 2023-12-20 05:16:08.000000000 +0100 @@ -2,4 +2,4 @@ from .version import __version__ # noqa: F401 from .tts import gTTS, gTTSError -__all__ = ["gTTS", "gTTSError"] +__all__ = ["__version__", "gTTS", "gTTSError"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gTTS-2.4.0/gtts/lang.py new/gTTS-2.5.0/gtts/lang.py --- old/gTTS-2.4.0/gtts/lang.py 2023-10-03 18:50:36.000000000 +0200 +++ new/gTTS-2.5.0/gtts/lang.py 2023-12-20 05:16:08.000000000 +0100 @@ -38,7 +38,7 @@ """Define extra languages. Returns: - dict: A dictionnary of extra languages manually defined. + dict: A dictionary of extra languages manually defined. Variations of the ones generated in `_main_langs`, observed to provide different dialects or accents or @@ -64,7 +64,7 @@ Returns: string: The language tag, as-is if not deprecated, - or a fallack if it exits. + or a fallback if it exits. Example: ``en-GB`` returns ``en``. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gTTS-2.4.0/gtts/tests/test_tts.py new/gTTS-2.5.0/gtts/tests/test_tts.py --- old/gTTS-2.4.0/gtts/tests/test_tts.py 2023-10-03 18:50:36.000000000 +0200 +++ new/gTTS-2.5.0/gtts/tests/test_tts.py 2023-12-20 05:16:08.000000000 +0100 @@ -10,7 +10,7 @@ # Testing all languages takes some time. # Set TEST_LANGS envvar to choose languages to test. # * 'main': Languages extracted from the Web -# * 'extra': Languagee set in Languages.EXTRA_LANGS +# * 'extra': Language set in Languages.EXTRA_LANGS # * 'all': All of the above # * <csv>: Languages tags list to test # Unset TEST_LANGS to test everything ('all') @@ -125,7 +125,7 @@ def test_infer_msg(): - """Infer message sucessfully based on context""" + """Infer message successfully based on context""" # Without response: @@ -163,7 +163,7 @@ error500 = gTTSError(tts=tts500, response=response500) assert ( error500.msg - == "500 (ccc) from TTS API. Probable cause: Uptream API error. Try again later." + == "500 (ccc) from TTS API. Probable cause: Upstream API error. Try again later." ) # Unknown (ex. 100) @@ -190,5 +190,23 @@ tts.save(filename) [email protected] +def test_timeout(tmp_path): + # Check default timeout + tts = gTTS(text="test") + assert tts.timeout is None + + # Check passed in timeout + timeout = 1.2 + tts = gTTS(text="test", timeout=timeout) + assert tts.timeout == timeout + + # Make sure an exception is raised when a timeout occurs + tts = gTTS(text="test", timeout=0.000001) + filename = tmp_path / "save.mp3" + with pytest.raises(gTTSError): + tts.save(filename) + + if __name__ == "__main__": pytest.main(["-x", __file__]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gTTS-2.4.0/gtts/tests/test_utils.py new/gTTS-2.5.0/gtts/tests/test_utils.py --- old/gTTS-2.4.0/gtts/tests/test_utils.py 2023-10-03 18:50:36.000000000 +0200 +++ new/gTTS-2.5.0/gtts/tests/test_utils.py 2023-12-20 05:16:08.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- import pytest -from gtts.utils import _minimize, _len, _clean_tokens, _translate_url +from gtts.utils import _minimize, _clean_tokens, _translate_url delim = " " Lmax = 10 @@ -32,12 +32,12 @@ def test_len_ascii(): text = "Bacon ipsum dolor sit amet flank corned beef." - assert _len(text) == 45 + assert len(text) == 45 def test_len_unicode(): text = u"ä½å¨ä¸ä¸ªéè¦çä»»å¡ä¸" - assert _len(text) == 10 + assert len(text) == 10 def test_only_space_and_punc(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gTTS-2.4.0/gtts/tokenizer/core.py new/gTTS-2.5.0/gtts/tokenizer/core.py --- old/gTTS-2.4.0/gtts/tokenizer/core.py 2023-10-03 18:50:36.000000000 +0200 +++ new/gTTS-2.5.0/gtts/tokenizer/core.py 2023-12-20 05:16:08.000000000 +0100 @@ -229,7 +229,7 @@ Args: regex_funcs (list): List of compiled ``regex`` objects. Each - functions's pattern will be joined into a single pattern and + function's pattern will be joined into a single pattern and compiled. flags: ``re`` flag(s) to compile with the final regex. Defaults to ``re.IGNORECASE`` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gTTS-2.4.0/gtts/tokenizer/pre_processors.py new/gTTS-2.5.0/gtts/tokenizer/pre_processors.py --- old/gTTS-2.4.0/gtts/tokenizer/pre_processors.py 2023-10-03 18:50:36.000000000 +0200 +++ new/gTTS-2.5.0/gtts/tokenizer/pre_processors.py 2023-12-20 05:16:08.000000000 +0100 @@ -6,7 +6,7 @@ def tone_marks(text): """Add a space after tone-modifying punctuation. - Because the `tone_marks` tokenizer case will split after a tone-modidfying + Because the `tone_marks` tokenizer case will split after a tone-modifying punctuation mark, make sure there's whitespace after. """ @@ -30,7 +30,7 @@ def abbreviations(text): """Remove periods after an abbreviation from a list of known - abbrevations that can be spoken the same without that period. This + abbreviations that can be spoken the same without that period. This prevents having to handle tokenization of that period. Note: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gTTS-2.4.0/gtts/tokenizer/tokenizer_cases.py new/gTTS-2.5.0/gtts/tokenizer/tokenizer_cases.py --- old/gTTS-2.4.0/gtts/tokenizer/tokenizer_cases.py 2023-10-03 18:50:36.000000000 +0200 +++ new/gTTS-2.5.0/gtts/tokenizer/tokenizer_cases.py 2023-12-20 05:16:08.000000000 +0100 @@ -35,7 +35,7 @@ def colon(): """Colon case. - Match a colon ":" only if not preceeded by a digit. + Match a colon ":" only if not preceded by a digit. Mainly to prevent a cut in the middle of time notations e.g. 10:01 """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gTTS-2.4.0/gtts/tts.py new/gTTS-2.5.0/gtts/tts.py --- old/gTTS-2.4.0/gtts/tts.py 2023-10-03 18:50:36.000000000 +0200 +++ new/gTTS-2.5.0/gtts/tts.py 2023-12-20 05:16:08.000000000 +0100 @@ -9,7 +9,7 @@ from gtts.lang import _fallback_deprecated_lang, tts_langs from gtts.tokenizer import Tokenizer, pre_processors, tokenizer_cases -from gtts.utils import _clean_tokens, _len, _minimize, _translate_url +from gtts.utils import _clean_tokens, _minimize, _translate_url __all__ = ["gTTS", "gTTSError"] @@ -50,7 +50,7 @@ to catch a language error early. If set to ``True``, a ``ValueError`` is raised if ``lang`` doesn't exist. Setting ``lang_check`` to ``False`` skips Web requests - (to validate language) and therefore speeds up instanciation. + (to validate language) and therefore speeds up instantiation. Default is ``True``. pre_processor_funcs (list): A list of zero or more functions that are called to transform (pre-process) text before tokenizing. Those @@ -73,6 +73,10 @@ tokenizer_cases.other_punctuation ]).run + timeout (float or tuple, optional): Seconds to wait for the server to + send data before giving up, as a float, or a ``(connect timeout, + read timeout)`` tuple. ``None`` will wait forever (default). + See Also: :doc:`Pre-processing and tokenizing <tokenizer>` @@ -116,6 +120,7 @@ tokenizer_cases.other_punctuation, ] ).run, + timeout=None, ): # Debug @@ -157,6 +162,8 @@ self.pre_processor_funcs = pre_processor_funcs self.tokenizer_func = tokenizer_func + self.timeout = timeout + def _tokenize(self, text): # Pre-clean text = text.strip() @@ -166,7 +173,7 @@ log.debug("pre-processing: %s", pp) text = pp(text) - if _len(text) <= self.GOOGLE_TTS_MAX_CHARS: + if len(text) <= self.GOOGLE_TTS_MAX_CHARS: return _clean_tokens([text]) # Tokenize @@ -184,7 +191,7 @@ # Filter empty tokens, post-minimize tokens = [t for t in min_tokens if t] - return min_tokens + return tokens def _prepare_requests(self): """Created the TTS API the request(s) without sending them. @@ -233,7 +240,7 @@ """Get TTS API request bodies(s) that would be sent to the TTS API. Returns: - list: A list of TTS API request bodiess to make. + list: A list of TTS API request bodies to make. """ return [pr.body for pr in self._prepare_requests()] @@ -259,7 +266,10 @@ with requests.Session() as s: # Send request r = s.send( - request=pr, proxies=urllib.request.getproxies(), verify=False + request=pr, + verify=False, + proxies=urllib.request.getproxies(), + timeout=self.timeout, ) log.debug("headers-%i: %s", idx, r.request.headers) @@ -372,6 +382,6 @@ % self.tts.lang ) elif status >= 500: - cause = "Uptream API error. Try again later." + cause = "Upstream API error. Try again later." return "{}. Probable cause: {}".format(premise, cause) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gTTS-2.4.0/gtts/utils.py new/gTTS-2.5.0/gtts/utils.py --- old/gTTS-2.4.0/gtts/utils.py 2023-10-03 18:50:36.000000000 +0200 +++ new/gTTS-2.5.0/gtts/utils.py 2023-12-20 05:16:08.000000000 +0100 @@ -36,9 +36,9 @@ # i.e. prevent a recursive infinite loop on `the_string[0:0]` # if `the_string` starts with `delim` and is larger than `max_size` if the_string.startswith(delim): - the_string = the_string[_len(delim) :] + the_string = the_string[len(delim):] - if _len(the_string) > max_size: + if len(the_string) > max_size: try: # Find the highest index of `delim` in `the_string[0:max_size]` # i.e. `the_string` will be cut in half on `delim` index @@ -53,24 +53,6 @@ return [the_string] -def _len(text): - """Same as ``len(text)`` for a string but that decodes - ``text`` first in Python 2.x - - Args: - text (string): String to get the size of. - - Returns: - int: The size of the string. - """ - try: - # Python 2 - return len(unicode(text)) - except NameError: # pragma: no cover - # Python 3 - return len(text) - - def _clean_tokens(tokens): """Clean a list of strings diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gTTS-2.4.0/gtts/version.py new/gTTS-2.5.0/gtts/version.py --- old/gTTS-2.4.0/gtts/version.py 2023-10-03 18:50:36.000000000 +0200 +++ new/gTTS-2.5.0/gtts/version.py 2023-12-20 05:16:08.000000000 +0100 @@ -1 +1 @@ -__version__ = "2.4.0" +__version__ = "2.5.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gTTS-2.4.0/pyproject.toml new/gTTS-2.5.0/pyproject.toml --- old/gTTS-2.4.0/pyproject.toml 2023-10-03 18:50:36.000000000 +0200 +++ new/gTTS-2.5.0/pyproject.toml 2023-12-20 05:16:08.000000000 +0100 @@ -1,6 +1,6 @@ [project] name = "gTTS" -version = "2.4.0" +version = "2.5.0" description = "gTTS (Google Text-to-Speech), a Python library and CLI tool to interface with Google Translate text-to-speech API" authors = [{name = "Pierre Nicolas Durette", email = "[email protected]"}] requires-python = ">=3.7" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gTTS-2.4.0/release-please-config.json new/gTTS-2.5.0/release-please-config.json --- old/gTTS-2.4.0/release-please-config.json 1970-01-01 01:00:00.000000000 +0100 +++ new/gTTS-2.5.0/release-please-config.json 2023-12-20 05:16:08.000000000 +0100 @@ -0,0 +1,8 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "plugins": ["sentence-case"], + "release-type": "python", + "packages": { + ".": {} + } +} \ No newline at end of file
