diff -Nru distro-info-0.18/debian/changelog distro-info-0.20/debian/changelog --- distro-info-0.18/debian/changelog 2018-02-04 19:42:26.000000000 +0000 +++ distro-info-0.20/debian/changelog 2018-10-12 10:00:35.000000000 +0000 @@ -1,3 +1,40 @@ +distro-info (0.20) unstable; urgency=medium + + * Fix build failure with LC_ALL=POSIX by explicitly opening + debian/changelog as UTF-8 in setup.py. + + -- Benjamin Drung Fri, 12 Oct 2018 12:00:35 +0200 + +distro-info (0.19) unstable; urgency=medium + + [ Stefano Rivera ] + * Migrate VCS to salsa.debian.org. + + [ Ondřej Nový ] + * d/control: Remove ancient X-Python-Version field + * d/control: Remove ancient X-Python3-Version field + + [ Iain Lane ] + * Fix pylint issues (Closes: #909987): + + Allow useless-object-inheritance so we can stay PY2/3 bilingual. + - This is correctly an unknown option when linting python 2, so we need + to whitelist unknown overrides too. + + Refactor a useless if/return/elif... chain into a sequence of `if`s + instead. + + Use chained comparison x <= y <= z instead of x <= y and y <= z. + + [ Benjamin Drung ] + * Update pylint/flake8 unittests to latest version from + https://github.com/bdrung/snippets + * Support running tests against installed binaries and libraries + * Add autopkgtest test suite + * Set Rules-Requires-Root: no + * Bump Standards-Version to 4.2.1 + * Do not install distro_info_test into Python libraries + * Do not install test-*-distro-info scripts + + -- Benjamin Drung Fri, 12 Oct 2018 01:30:13 +0200 + distro-info (0.18) unstable; urgency=medium * Update Python unittests to support pylint 1.8 (Closes: #889537) diff -Nru distro-info-0.18/debian/control distro-info-0.20/debian/control --- distro-info-0.18/debian/control 2018-02-04 19:33:03.000000000 +0000 +++ distro-info-0.20/debian/control 2018-10-12 09:10:36.000000000 +0000 @@ -16,11 +16,10 @@ python3-flake8, python3-setuptools, shunit2 (>= 2.1.6) -Standards-Version: 4.1.3 -X-Python-Version: >= 2.6 -X-Python3-Version: >= 3.0 -Vcs-Git: https://anonscm.debian.org/git/collab-maint/distro-info.git -Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/distro-info.git +Standards-Version: 4.2.1 +Rules-Requires-Root: no +Vcs-Git: https://salsa.debian.org/debian/distro-info.git +Vcs-Browser: https://salsa.debian.org/debian/distro-info Package: distro-info Architecture: any diff -Nru distro-info-0.18/debian/distro-info.install distro-info-0.20/debian/distro-info.install --- distro-info-0.18/debian/distro-info.install 2012-04-13 13:57:52.000000000 +0000 +++ distro-info-0.20/debian/distro-info.install 2018-10-12 09:10:36.000000000 +0000 @@ -1,3 +1,2 @@ usr/bin -usr/share/distro-info usr/share/man diff -Nru distro-info-0.18/debian/tests/control distro-info-0.20/debian/tests/control --- distro-info-0.18/debian/tests/control 1970-01-01 00:00:00.000000000 +0000 +++ distro-info-0.20/debian/tests/control 2018-10-12 09:10:36.000000000 +0000 @@ -0,0 +1,17 @@ +Test-Command: COMMAND=/usr/bin/debian-distro-info ./test-debian-distro-info +Depends: distro-info, shunit2 (>= 2.1.6) +Features: test-name=test-debian-distro-info + +Test-Command: COMMAND=/usr/bin/ubuntu-distro-info ./test-ubuntu-distro-info +Depends: distro-info, shunit2 (>= 2.1.6) +Features: test-name=test-ubuntu-distro-info + +Test-Command: cp -r python/distro_info_test python/*-distro-info python/setup.py "$AUTOPKGTEST_TMP"; for py in $(py3versions -r 2>/dev/null); do cd "$AUTOPKGTEST_TMP"; echo "Testing with $py:"; $py -m unittest discover -v; done +Depends: pylint3, python3-all, python3-distro-info, python3-flake8 +Restrictions: allow-stderr +Features: test-name=python3-unittest + +Test-Command: cp -r python/distro_info_test python/*-distro-info python/setup.py "$AUTOPKGTEST_TMP"; for py in $(pyversions -r 2>/dev/null); do cd "$AUTOPKGTEST_TMP"; echo "Testing with $py:"; $py -m unittest discover -v; done +Depends: pylint, python-all, python-distro-info, python-flake8 +Restrictions: allow-stderr +Features: test-name=python-unittest diff -Nru distro-info-0.18/Makefile distro-info-0.20/Makefile --- distro-info-0.18/Makefile 2017-04-30 19:43:03.000000000 +0000 +++ distro-info-0.20/Makefile 2018-10-12 09:10:36.000000000 +0000 @@ -20,11 +20,6 @@ install -d $(DESTDIR)$(PREFIX)/bin install -m 755 $^ $(DESTDIR)$(PREFIX)/bin ln -s $(VENDOR)-distro-info $(DESTDIR)$(PREFIX)/bin/distro-info - install -d $(DESTDIR)$(PREFIX)/share/distro-info - install -m 644 shunit2-helper-functions.sh $(DESTDIR)$(PREFIX)/share/distro-info - $(foreach distro,debian ubuntu,sed -e 's@^\(COMMAND=\"\).*/\(.*-distro-info\"\)$$@\1\2@' \ - test-$(distro)-distro-info > $(DESTDIR)$(PREFIX)/share/distro-info/test-$(distro)-distro-info$(\n) \ - chmod 755 $(DESTDIR)$(PREFIX)/share/distro-info/test-$(distro)-distro-info$(\n)) install -d $(DESTDIR)$(PREFIX)/share/man/man1 install -m 644 $(wildcard doc/*.1) $(DESTDIR)$(PREFIX)/share/man/man1 install -d $(DESTDIR)$(PREFIX)/share/perl5/Debian diff -Nru distro-info-0.18/python/distro_info.py distro-info-0.20/python/distro_info.py --- distro-info-0.18/python/distro_info.py 2018-01-08 21:17:54.000000000 +0000 +++ distro-info-0.20/python/distro_info.py 2018-10-12 09:10:36.000000000 +0000 @@ -130,15 +130,15 @@ """Format a given distribution entry.""" if format_string == "object": return release - elif format_string == "codename": + if format_string == "codename": return release.series - elif format_string == "fullname": + if format_string == "fullname": return self._distro + " " + release.version + ' "' + release.codename + '"' - elif format_string == "release": + if format_string == "release": return release.version - else: - raise ValueError("Only codename, fullname, object, and release are allowed " - "result values, but not '" + format_string + "'.") + + raise ValueError("Only codename, fullname, object, and release are allowed " + "result values, but not '" + format_string + "'.") def stable(self, date=None, result="codename"): """Get latest stable distribution based on the given date.""" @@ -246,7 +246,7 @@ if date is None: date = self._date distros = [x for x in self._releases if x.version.find("LTS") >= 0 and - date >= x.release and date <= x.eol] + x.release <= date <= x.eol] if not distros: raise DistroDataOutdated() return self._format(result, distros[-1]) diff -Nru distro-info-0.18/python/distro_info_test/__init__.py distro-info-0.20/python/distro_info_test/__init__.py --- distro-info-0.18/python/distro_info_test/__init__.py 2018-02-04 19:33:03.000000000 +0000 +++ distro-info-0.20/python/distro_info_test/__init__.py 2018-10-12 09:10:36.000000000 +0000 @@ -16,6 +16,7 @@ import inspect import os +import site import sys import unittest @@ -29,15 +30,19 @@ files = [] for code_file in scripts + modules + py_files: is_script = code_file in scripts - if not os.path.exists(code_file): - # The alternative path is needed for Debian's pybuild - alternative = os.path.join(os.environ.get("OLDPWD", ""), code_file) - code_file = alternative if os.path.exists(alternative) else code_file + if not os.path.exists(code_file): # pragma: no cover + # The alternative path in the OLDPWD environment is needed for Debian's pybuild + # Use installed files as fallback + for alternative_path in [os.environ.get("OLDPWD", "")] + site.getsitepackages(): + alternative = os.path.join(alternative_path, code_file) + if os.path.exists(alternative): + code_file = alternative + break if is_script: with open(code_file, "rb") as script_file: shebang = script_file.readline().decode("utf-8") - if ((sys.version_info[0] == 3 and "python3" in shebang) or - ("python" in shebang and "python3" not in shebang)): + if ((sys.version_info[0] == 3 and "python3" in shebang) + or ("python" in shebang and "python3" not in shebang)): files.append(code_file) else: files.append(code_file) @@ -54,4 +59,4 @@ if isinstance(self, unittest.TestProgram): return self.verbosity frame = frame.f_back - return None + return None # pragma: no cover diff -Nru distro-info-0.18/python/distro_info_test/pylint.conf distro-info-0.20/python/distro_info_test/pylint.conf --- distro-info-0.18/python/distro_info_test/pylint.conf 2018-02-04 19:20:22.000000000 +0000 +++ distro-info-0.20/python/distro_info_test/pylint.conf 2018-10-12 09:10:36.000000000 +0000 @@ -1,3 +1,9 @@ +[MASTER] + +# Pickle collected data for later comparisons. +persistent=no + + [MESSAGES CONTROL] # Disable the message, report, category or checker with the given id(s). You @@ -9,7 +15,7 @@ # --enable=similarities". If you want to run only the classes checker, but have # no Warning level messages displayed, use"--disable=all --enable=classes # --disable=W" -disable=invalid-name,locally-disabled,missing-docstring +disable=bad-option-value,invalid-name,locally-disabled,missing-docstring,useless-object-inheritance [REPORTS] diff -Nru distro-info-0.18/python/distro_info_test/test_distro_info.py distro-info-0.20/python/distro_info_test/test_distro_info.py --- distro-info-0.18/python/distro_info_test/test_distro_info.py 2017-04-30 19:43:03.000000000 +0000 +++ distro-info-0.20/python/distro_info_test/test_distro_info.py 2018-10-12 09:10:36.000000000 +0000 @@ -17,8 +17,8 @@ """Test suite for distro_info""" import datetime +import unittest -from distro_info_test import unittest from distro_info import DebianDistroInfo, UbuntuDistroInfo diff -Nru distro-info-0.18/python/distro_info_test/test_flake8.py distro-info-0.20/python/distro_info_test/test_flake8.py --- distro-info-0.18/python/distro_info_test/test_flake8.py 2018-02-04 19:11:56.000000000 +0000 +++ distro-info-0.20/python/distro_info_test/test_flake8.py 2018-10-12 09:10:36.000000000 +0000 @@ -31,16 +31,14 @@ def test_flake8(self): """Test: Run flake8 on Python source code""" - with open("/proc/self/cmdline", "r") as cmdline_file: - python_binary = cmdline_file.read().split("\0")[0] - cmd = [python_binary, "-m", "flake8", "--max-line-length=99"] + get_source_files() + cmd = [sys.executable, "-m", "flake8", "--max-line-length=99"] + get_source_files() if unittest_verbosity() >= 2: sys.stderr.write("Running following command:\n{}\n".format(" ".join(cmd))) process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) out, err = process.communicate() - if process.returncode != 0: + if process.returncode != 0: # pragma: no cover msgs = [] if err: msgs.append("flake8 exited with code {} and has unexpected output on stderr:\n{}" diff -Nru distro-info-0.18/python/distro_info_test/test_pylint.py distro-info-0.20/python/distro_info_test/test_pylint.py --- distro-info-0.18/python/distro_info_test/test_pylint.py 2018-02-04 19:11:56.000000000 +0000 +++ distro-info-0.20/python/distro_info_test/test_pylint.py 2018-10-12 09:10:36.000000000 +0000 @@ -37,18 +37,14 @@ def test_pylint(self): """Test: Run pylint on Python source code""" - with open("/proc/self/cmdline", "r") as cmdline_file: - python_binary = cmdline_file.read().split("\0")[0] - cmd = [python_binary, "-m", "pylint", "--rcfile=" + CONFIG, "--"] + get_source_files() - env = os.environ.copy() - env["PYLINTHOME"] = ".pylint.d" + cmd = [sys.executable, "-m", "pylint", "--rcfile=" + CONFIG, "--"] + get_source_files() if unittest_verbosity() >= 2: sys.stderr.write("Running following command:\n{}\n".format(" ".join(cmd))) - process = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, + process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) out, err = process.communicate() - if process.returncode != 0: + if process.returncode != 0: # pragma: no cover # Strip trailing summary (introduced in pylint 1.7). This summary might look like: # # ------------------------------------ diff -Nru distro-info-0.18/python/setup.py distro-info-0.20/python/setup.py --- distro-info-0.18/python/setup.py 2018-02-04 19:33:03.000000000 +0000 +++ distro-info-0.20/python/setup.py 2018-10-12 09:52:54.000000000 +0000 @@ -6,7 +6,7 @@ from setuptools import setup -PACKAGES = ['distro_info_test'] +PACKAGES = [] PY_MODULES = ['distro_info'] SCRIPTS = [ 'debian-distro-info', @@ -19,7 +19,7 @@ version = None changelog = "../debian/changelog" if os.path.exists(changelog): - head = open(changelog).readline() + head = open(changelog, "rb").readline().decode("utf-8") match = re.compile(r".*\((.*)\).*").match(head) if match: version = match.group(1) diff -Nru distro-info-0.18/.spyproject/codestyle.ini distro-info-0.20/.spyproject/codestyle.ini --- distro-info-0.18/.spyproject/codestyle.ini 1970-01-01 00:00:00.000000000 +0000 +++ distro-info-0.20/.spyproject/codestyle.ini 2017-04-28 09:31:18.000000000 +0000 @@ -0,0 +1,6 @@ +[codestyle] +indentation = True + +[main] +version = 0.1.0 + diff -Nru distro-info-0.18/.spyproject/encoding.ini distro-info-0.20/.spyproject/encoding.ini --- distro-info-0.18/.spyproject/encoding.ini 1970-01-01 00:00:00.000000000 +0000 +++ distro-info-0.20/.spyproject/encoding.ini 2017-04-28 09:31:18.000000000 +0000 @@ -0,0 +1,6 @@ +[encoding] +text_encoding = utf-8 + +[main] +version = 0.1.0 + diff -Nru distro-info-0.18/.spyproject/vcs.ini distro-info-0.20/.spyproject/vcs.ini --- distro-info-0.18/.spyproject/vcs.ini 1970-01-01 00:00:00.000000000 +0000 +++ distro-info-0.20/.spyproject/vcs.ini 2017-04-28 09:31:18.000000000 +0000 @@ -0,0 +1,7 @@ +[vcs] +version_control_system = +use_version_control = False + +[main] +version = 0.1.0 + diff -Nru distro-info-0.18/.spyproject/workspace.ini distro-info-0.20/.spyproject/workspace.ini --- distro-info-0.18/.spyproject/workspace.ini 1970-01-01 00:00:00.000000000 +0000 +++ distro-info-0.20/.spyproject/workspace.ini 2017-07-21 15:53:48.000000000 +0000 @@ -0,0 +1,10 @@ +[workspace] +save_history = True +save_non_project_files = False +restore_data_on_startup = True +save_data_on_exit = True + +[main] +version = 0.1.0 +recent_files = ['/home/bdrung/projects/distro-info/distro-info/python/setup.py', '/home/bdrung/projects/distro-info/distro-info/python/debian-distro-info', '/home/bdrung/projects/distro-info/distro-info/python/distro_info_test/test_pylint.py', '/home/bdrung/projects/distro-info/distro-info/python/distro_info_test/pylint.conf', '/home/bdrung/projects/distro-info/distro-info/python/distro_info_test/__init__.py', '/home/bdrung/projects/distro-info/distro-info/python/distro_info_test/test_flake8.py', '/home/bdrung/projects/distro-info/distro-info/python/distro_info.py', '/home/bdrung/projects/distro-info/distro-info/python/distro_info_test/test_help.py'] + diff -Nru distro-info-0.18/test-debian-distro-info distro-info-0.20/test-debian-distro-info --- distro-info-0.18/test-debian-distro-info 2017-04-30 19:43:03.000000000 +0000 +++ distro-info-0.20/test-debian-distro-info 2018-10-12 09:10:36.000000000 +0000 @@ -14,7 +14,7 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -COMMAND="${0%/*}/debian-distro-info" +COMMAND="${COMMAND:-${0%/*}/debian-distro-info}" . "${0%/*}/shunit2-helper-functions.sh" diff -Nru distro-info-0.18/test-ubuntu-distro-info distro-info-0.20/test-ubuntu-distro-info --- distro-info-0.18/test-ubuntu-distro-info 2014-05-10 18:53:16.000000000 +0000 +++ distro-info-0.20/test-ubuntu-distro-info 2018-10-12 09:10:36.000000000 +0000 @@ -14,7 +14,7 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -COMMAND="${0%/*}/ubuntu-distro-info" +COMMAND="${COMMAND:-${0%/*}/ubuntu-distro-info}" . "${0%/*}/shunit2-helper-functions.sh"