Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-textfsm for openSUSE:Factory checked in at 2026-11-13 18:31:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-textfsm (Old) and /work/SRC/openSUSE:Factory/.python-textfsm.new.1251 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-textfsm" Fri Nov 13 18:31:58 2026 rev:14 rq:1397067 version:2.1.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-textfsm/python-textfsm.changes 2026-06-18 18:41:50.324072217 +0200 +++ /work/SRC/openSUSE:Factory/.python-textfsm.new.1251/python-textfsm.changes 2026-11-13 18:35:57.804905427 +0100 @@ -1,0 +2,11 @@ +Tue Nov 10 17:23:15 UTC 2026 - Martin Hauke <[email protected]> + +- Update to version 2.1.1 + * fix: check exact header names when adding columns. + * fix: preserve data when parsing headerless CSV. + * fix: isolate headers in derived tables. + * fix: stop CSV header scanning at end of input. + * Raise TextFSMTemplateError for a Value line with no regex. + * Handle whitespace-only cells when formatting text tables. + +------------------------------------------------------------------- Old: ---- textfsm-2.1.0.tar.gz New: ---- textfsm-2.1.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-textfsm.spec ++++++ --- /var/tmp/diff_new_pack.v9aj4w/_old 2026-11-13 18:35:59.452975203 +0100 +++ /var/tmp/diff_new_pack.v9aj4w/_new 2026-11-13 18:35:59.453975245 +0100 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-textfsm -Version: 2.1.0 +Version: 2.1.1 Release: 0 Summary: Python module for parsing semi-structured text into python tables License: Apache-2.0 @@ -53,6 +53,7 @@ %python_expand rm -f %{buildroot}%{_bindir}/textfsm # or the testdata %python_expand rm -r %{buildroot}%{$python_sitelib}/testdata +%python_expand rm -r %{buildroot}%{$python_sitelib}/tests %python_expand %fdupes %{buildroot}%{$python_sitelib} %check ++++++ textfsm-2.1.0.tar.gz -> textfsm-2.1.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/textfsm-2.1.0/.github/workflows/python-publish.yml new/textfsm-2.1.1/.github/workflows/python-publish.yml --- old/textfsm-2.1.0/.github/workflows/python-publish.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/textfsm-2.1.1/.github/workflows/python-publish.yml 2026-11-10 08:36:19.000000000 +0100 @@ -0,0 +1,69 @@ +# This workflow will upload a Python Package to PyPI when a release is created +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Upload Python Package + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + release-build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.x" + + - name: Build release distributions + run: | + python3 -m pip install --upgrade build + python3 -m build + + - name: Upload distributions + uses: actions/upload-artifact@v4 + with: + name: release-dists + path: dist/ + + pypi-publish: + runs-on: ubuntu-latest + needs: + - release-build + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write + + # Dedicated environments with protections for publishing are strongly recommended. + # For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules + environment: + name: pypi + # OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status: + url: https://pypi.org/p/textfsm + # + # ALTERNATIVE: if your GitHub Release name is the PyPI project version string + # ALTERNATIVE: exactly, uncomment the following line instead: + # url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }} + + steps: + - name: Retrieve release distributions + uses: actions/download-artifact@v4 + with: + name: release-dists + path: dist/ + + - name: Publish release distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: dist/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/textfsm-2.1.0/pyproject.toml new/textfsm-2.1.1/pyproject.toml --- old/textfsm-2.1.0/pyproject.toml 1970-01-01 01:00:00.000000000 +0100 +++ new/textfsm-2.1.1/pyproject.toml 2026-11-10 08:36:19.000000000 +0100 @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools>=61", "wheel"] +build-backend = "setuptools.build_meta" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/textfsm-2.1.0/setup.cfg new/textfsm-2.1.1/setup.cfg --- old/textfsm-2.1.0/setup.cfg 2025-04-17 06:03:29.000000000 +0200 +++ new/textfsm-2.1.1/setup.cfg 2026-11-10 08:36:19.000000000 +0100 @@ -1,5 +1,6 @@ [metadata] description-file = README.md +version = attr: textfsm.__version__ [aliases] test=pytest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/textfsm-2.1.0/setup.py new/textfsm-2.1.1/setup.py --- old/textfsm-2.1.0/setup.py 2025-04-17 06:03:29.000000000 +0200 +++ new/textfsm-2.1.1/setup.py 2026-11-10 08:36:19.000000000 +0100 @@ -1,6 +1,6 @@ -#!/usr/bin/python +#!/usr/bin/env python3 # -# Copyright 2017 Google Inc. All Rights Reserved. +# Copyright 2026 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,23 +16,29 @@ """Setup script.""" +import re # To use a consistent encoding from codecs import open from os import path +from pathlib import Path from setuptools import find_packages, setup -import textfsm -here = path.abspath(path.dirname(__file__)) +here = Path(__file__).resolve().parent +init_py = (here / "textfsm" / "__init__.py").read_text(encoding="utf-8") +match = re.search(r'^__version__\s*=\s*[\'"]([^\'"]+)[\'"]', init_py, re.M) +if not match: + raise RuntimeError("Unable to find __version__") +version = match.group(1) # Get the long description from the README file with open(path.join(here, 'README.md'), encoding='utf8') as f: - long_description = f.read() + long_description = f.read() setup( name='textfsm', maintainer='Google', maintainer_email='[email protected]', - version=textfsm.__version__, + version=version, description=( 'Python module for parsing semi-structured text into python tables.' ), @@ -48,7 +54,7 @@ 'Programming Language :: Python :: 3', 'Topic :: Software Development :: Libraries', ], - packages=['textfsm'], + packages=find_packages(), entry_points={'console_scripts': ['textfsm=textfsm.parser:main']}, include_package_data=True, package_data={'textfsm': ['../testdata/*']}, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/textfsm-2.1.0/tests/textfsm_test.py new/textfsm-2.1.1/tests/textfsm_test.py --- old/textfsm-2.1.0/tests/textfsm_test.py 2025-04-17 06:03:29.000000000 +0200 +++ new/textfsm-2.1.1/tests/textfsm_test.py 2026-11-10 08:36:19.000000000 +0100 @@ -75,6 +75,12 @@ textfsm.TextFSMTemplateError, v.Parse, r'Value beer (boo)hoo\)' ) + # A missing regex is a template error, not an IndexError. + v = textfsm.TextFSMValue(options_class=textfsm.TextFSMOptions) + self.assertRaises( + textfsm.TextFSMTemplateError, v.Parse, 'Value Required beer' + ) + # Unbalanced parenthesis can exist if within square "[]" braces. v = textfsm.TextFSMValue(options_class=textfsm.TextFSMOptions) v.Parse('Value beer (boo[(]hoo)') @@ -265,6 +271,9 @@ buf = 'Value filldown,Required Wine ((c|C)laret)' f = io.StringIO(buf) self.assertRaises(textfsm.TextFSMTemplateError, t._ParseFSMVariables, f) + buf = 'Value Required Beer' + f = io.StringIO(buf) + self.assertRaises(textfsm.TextFSMTemplateError, t._ParseFSMVariables, f) # Values that look bad but are OK. buf = ( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/textfsm-2.1.0/tests/texttable_test.py new/textfsm-2.1.1/tests/texttable_test.py --- old/textfsm-2.1.0/tests/texttable_test.py 2025-04-17 06:03:29.000000000 +0200 +++ new/textfsm-2.1.1/tests/texttable_test.py 2026-11-10 08:36:19.000000000 +0100 @@ -16,6 +16,7 @@ """Unittest for text table.""" +import copy import io import unittest from textfsm import terminal @@ -177,6 +178,24 @@ function=lambda row: row['a'] == '10') self.assertEqual(1, filtered_table.size) + def testDerivedTableHeadersAreIndependent(self): + operations = ( + ('copy', copy.copy), + ('filter', lambda table: table.Filter()), + ('map', lambda table: table.Map(lambda row: row)), + ('add', lambda table: table + self.BasicTable()), + ) + for name, operation in operations: + with self.subTest(operation=name): + original = self.BasicTable() + derived = operation(original) + derived.AddColumn('extra', default='value') + self.assertEqual(['a', 'b', 'c'], original.header.values) + self.assertEqual(['1', '2', '3'], original[1].values) + self.assertEqual(['a', 'b', 'c', 'extra'], derived.header.values) + original.AddColumn('original_only') + self.assertNotIn('original_only', derived.header) + def testFilterNone(self): t = texttable.TextTable() t.header = ('a', 'b', 'c') @@ -316,11 +335,41 @@ self.assertEqual(['5', '6', '7', '8'], t[2].values) self.assertEqual(2, t.size) + def testCsvToTableWithoutHeaderContent(self): + for content in ('', '\n \n', '# comment\n # another comment\n'): + for buffer_class, value in ( + (io.StringIO, content), (io.BytesIO, content.encode('utf-8'))): + with self.subTest(content=content, buffer=buffer_class): + table = self.BasicTable() + self.assertEqual(0, table.CsvToTable(buffer_class(value))) + self.assertEqual(0, table.size) + self.assertEqual([], list(table.header)) + def testHeaderIndex(self): t = self.BasicTable() self.assertEqual('c', t.header[2]) self.assertEqual('a', t.header[0]) + def testCsvWithoutHeaderPreservesFirstRow(self): + for source in ('1,2\n', '# comment\n1,2\n3,4\n'): + for buf in (io.StringIO(source), io.BytesIO(source.encode('utf-8'))): + with self.subTest(source=source, buffer_type=type(buf)): + t = texttable.TextTable() + t.CsvToTable(buf, header=False) + expected = [['1', '2']] + if '3,4' in source: + expected.append(['3', '4']) + self.assertEqual(expected, [row.values for row in t]) + self.assertEqual([0, 1], t.header.values) + self.assertEqual(0, t.header.row) + self.assertEqual(list(range(1, t.size + 1)), [row.row for row in t]) + + def testCsvHeaderKeepsZeroRowIndex(self): + t = texttable.TextTable() + t.CsvToTable(io.StringIO('a,b\n1,2\n3,4\n')) + self.assertEqual(0, t.header.row) + self.assertEqual([1, 2], [row.row for row in t]) + def testAppend(self): t = self.BasicTable() t.Append(['10', '20', '30']) @@ -391,6 +440,18 @@ self.assertRaises(IndexError, t.AddColumn, 'x', col_index=-7) self.assertRaises(texttable.TableError, t.AddColumn, 'b') + def testAddColumnChecksExactHeaderNames(self): + for column, col_index in [('name', -1), ('10', 0)]: + with self.subTest(column=column): + t = texttable.TextTable() + t.header = ['hostname'] + t.Append(['10']) + t.AddColumn(column, default='new', col_index=col_index) + self.assertIn(column, t.header) + self.assertEqual('10', t[1]['hostname']) + self.assertEqual('new', t[1][column]) + self.assertRaises(texttable.TableError, t.AddColumn, column) + def testAddTable(self): t = self.BasicTable() t2 = self.BasicTable() @@ -508,6 +569,27 @@ self.assertEqual( 3, t._SmallestColSize('bbb ' + terminal.AnsiText('bb', ['red']))) + def testSmallestColSizeWithoutVisibleWords(self): + t = texttable.TextTable() + for value in (' ', '\t', '\n', '\r\n', ' \t\n ', + terminal.AnsiText('', ['red']), + terminal.AnsiText(' \t ', ['red'])): + with self.subTest(value=value): + self.assertEqual(0, t._SmallestColSize(value)) + + def testFormattedTableWhitespaceCells(self): + for value in (' ', '\t', '\n', '\r\n', ' \t\n '): + with self.subTest(value=value): + t = texttable.TextTable() + t.header = ('name', 'note') + t.Append(('router', value)) + t.Append(('switch', 'online')) + rendered = t.FormattedTable() + self.assertIn('router', rendered) + self.assertIn('switch', rendered) + self.assertIn('online', rendered) + self.assertEqual(['router', value], t[1].values) + def testFormattedTableColor(self): # Test to specify the color defined in terminal.FG_COLOR_WORDS t = texttable.TextTable() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/textfsm-2.1.0/textfsm/__init__.py new/textfsm-2.1.1/textfsm/__init__.py --- old/textfsm-2.1.0/textfsm/__init__.py 2025-04-17 06:03:29.000000000 +0200 +++ new/textfsm-2.1.1/textfsm/__init__.py 2026-11-10 08:36:19.000000000 +0100 @@ -10,4 +10,4 @@ """ from textfsm.parser import * -__version__ = '2.1.0' +__version__ = '2.1.1' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/textfsm-2.1.0/textfsm/parser.py new/textfsm-2.1.1/textfsm/parser.py --- old/textfsm-2.1.0/textfsm/parser.py 2025-04-17 06:03:29.000000000 +0200 +++ new/textfsm-2.1.1/textfsm/parser.py 2026-11-10 08:36:19.000000000 +0100 @@ -305,7 +305,12 @@ "Invalid Value name '%s' or name too long." % self.name ) - if self.regex[0] != '(' or self.regex[-1] != ')' or self.regex[-2] == '\\': + if ( + not self.regex + or self.regex[0] != '(' + or self.regex[-1] != ')' + or self.regex[-2] == '\\' + ): raise TextFSMTemplateError( "Value '%s' must be contained within a '()' pair." % self.regex ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/textfsm-2.1.0/textfsm/texttable.py new/textfsm-2.1.1/textfsm/texttable.py --- old/textfsm-2.1.0/textfsm/texttable.py 2025-04-17 06:03:29.000000000 +0200 +++ new/textfsm-2.1.1/textfsm/texttable.py 2026-11-10 08:36:19.000000000 +0100 @@ -370,7 +370,7 @@ new_table = self.__class__() # pylint: disable=protected-access - new_table._table = [self.header] + new_table._table = [copy.deepcopy(self.header)] for row in self[1:]: new_table.Append(row) return new_table @@ -394,7 +394,7 @@ new_table = self.__class__() # pylint: disable=protected-access - new_table._table = [self.header] + new_table._table = [copy.deepcopy(self.header)] for row in self: if function(row): new_table.Append(row) @@ -415,7 +415,7 @@ """ new_table = self.__class__() # pylint: disable=protected-access - new_table._table = [self.header] + new_table._table = [copy.deepcopy(self.header)] for row in self: filtered_row = function(row) if filtered_row: @@ -632,7 +632,7 @@ if not text: return 0 stripped = terminal.StripAnsiText(text) - return max(len(word) for word in stripped.split()) + return max((len(word) for word in stripped.split()), default=0) def _TextJustify(self, text, col_size): """Formats text within column with white space padding. @@ -971,7 +971,7 @@ Raises: TableError: Column name already exists. """ - if column in self.table: + if column in self.header: raise TableError('Column %r already in table.' % column) if col_index == -1: self._table[0][column] = column @@ -1037,6 +1037,8 @@ line = buf.readline() header_str = '' while not header_str: + if not line: + return self.size if not isinstance(line, str): line = line.decode('utf-8') # Remove comments. @@ -1072,16 +1074,14 @@ if not header: header_row = self.row_class() header_length = len(lst) - header_row.values = dict( - zip(range(header_length), range(header_length)) - ) + for index in range(header_length): + header_row[index] = index + header_row.row = 0 self._table[0] = header_row header = True - continue new_row = self.NewRow() new_row.values = lst - header_row.row = self.size + 1 self._table.append(new_row) return self.size
