Hello community, here is the log from the commit of package python-pyxdg for openSUSE:Factory checked in at 2020-12-04 21:27:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pyxdg (Old) and /work/SRC/openSUSE:Factory/.python-pyxdg.new.5913 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pyxdg" Fri Dec 4 21:27:24 2020 rev:11 rq:852844 version:0.27 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pyxdg/python-pyxdg.changes 2020-10-29 09:46:35.936071859 +0100 +++ /work/SRC/openSUSE:Factory/.python-pyxdg.new.5913/python-pyxdg.changes 2020-12-04 21:27:25.246032946 +0100 @@ -1,0 +2,13 @@ +Thu Dec 3 02:30:45 UTC 2020 - Benjamin Greiner <[email protected]> + +- Update to version 0.27 + * Menu: Fix compatibility with Python >= 3.8.4 + * Menu: Fix several AttributeErrors + * Menu: Fix duplication of menu entries due when Layout is provided + * MenuEditor: Fix fromstring typo + * Certain tests are more independent of external system conditions + * Standardise shebangs to /usr/bin/env python3 +- drop new-api.patch, resource_leak.patch merged upstream +- get example test data from gitlab repository -- pass all tests + +------------------------------------------------------------------- Old: ---- new-api.patch pyxdg-0.26.tar.gz resource_leak.patch New: ---- pyxdg-0.27-test-example.tar.gz pyxdg-0.27.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pyxdg.spec ++++++ --- /var/tmp/diff_new_pack.7VpJp4/_old 2020-12-04 21:27:26.142034232 +0100 +++ /var/tmp/diff_new_pack.7VpJp4/_new 2020-12-04 21:27:26.142034232 +0100 @@ -19,14 +19,14 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define oldpython python Name: python-pyxdg -Version: 0.26 +Version: 0.27 Release: 0 Summary: Implementations of freedesktop.org standards in python License: LGPL-2.1-only URL: https://freedesktop.org/wiki/Software/pyxdg -Source: https://files.pythonhosted.org/packages/source/p/pyxdg/pyxdg-%{version}.tar.gz -Patch0: resource_leak.patch -Patch1: https://gitlab.freedesktop.org/tcallawa/pyxdg/-/commit/b8d3d7b337adeb2fc2ef8a36f3a500e147d7a41b.diff#/new-api.patch +Source0: https://files.pythonhosted.org/packages/source/p/pyxdg/pyxdg-%{version}.tar.gz +# Test data: examples +Source1: https://gitlab.freedesktop.org/xdg/pyxdg/-/archive/rel-%{version}/pyxdg-rel-%{version}.tar.gz?path=test/example#/pyxdg-%{version}-test-example.tar.gz BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -49,8 +49,9 @@ * Shared-MIME-Database Specification 0.13 %prep -%setup -q -n pyxdg-%{version} +%setup -q -n pyxdg-%{version} -b 1 %autopatch -p1 +cp -r ../pyxdg-rel-%{version}-test-example/test/example test/ %build %python_build @@ -60,13 +61,7 @@ %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -# https://gitlab.freedesktop.org/xdg/pyxdg/issues/15 -# test_get_type{,2} both fail but come from s-m-i package for data -# https://gitlab.freedesktop.org/xdg/pyxdg/merge_requests/4 -# RulesTest.test_rule_from_node failure is https://gitlab.freedesktop.org/xdg/pyxdg/-/issues/20 -%{python_expand sed -i "s/Exec=python.*$/Exec=$python/" test/resources.py -PYTHONPATH=%{buildroot}%{$python_sitelib} pytest-%{$python_bin_suffix} test/test-*.py -v -k 'not (test_get_type or test_rule_from_node)' -} +%pytest test/test-*.py -v %files %{python_files} %license COPYING ++++++ pyxdg-0.26.tar.gz -> pyxdg-0.27.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/MANIFEST.in new/pyxdg-0.27/MANIFEST.in --- old/pyxdg-0.26/MANIFEST.in 1970-01-01 01:00:00.000000000 +0100 +++ new/pyxdg-0.27/MANIFEST.in 2016-11-14 02:27:00.000000000 +0100 @@ -0,0 +1,9 @@ +include AUTHORS +include ChangeLog +include COPYING +include INSTALL +include README +include TODO +include setup.py +include test/*.py +include xdg/*.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/PKG-INFO new/pyxdg-0.27/PKG-INFO --- old/pyxdg-0.26/PKG-INFO 2018-02-02 18:44:25.000000000 +0100 +++ new/pyxdg-0.27/PKG-INFO 2020-10-18 16:53:47.767752000 +0200 @@ -1,15 +1,14 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: pyxdg -Version: 0.26 +Version: 0.27 Summary: PyXDG contains implementations of freedesktop.org standards in python. Home-page: http://freedesktop.org/wiki/Software/pyxdg -Author: Freedesktop.org -Author-email: [email protected] +Maintainer: Freedesktop.org +Maintainer-email: [email protected] License: UNKNOWN Description: UNKNOWN Platform: UNKNOWN Classifier: License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2) -Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Desktop Environment diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/pyxdg.egg-info/PKG-INFO new/pyxdg-0.27/pyxdg.egg-info/PKG-INFO --- old/pyxdg-0.26/pyxdg.egg-info/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 +++ new/pyxdg-0.27/pyxdg.egg-info/PKG-INFO 2020-10-18 16:53:47.000000000 +0200 @@ -0,0 +1,14 @@ +Metadata-Version: 1.2 +Name: pyxdg +Version: 0.27 +Summary: PyXDG contains implementations of freedesktop.org standards in python. +Home-page: http://freedesktop.org/wiki/Software/pyxdg +Maintainer: Freedesktop.org +Maintainer-email: [email protected] +License: UNKNOWN +Description: UNKNOWN +Platform: UNKNOWN +Classifier: License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2) +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Topic :: Desktop Environment diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/pyxdg.egg-info/SOURCES.txt new/pyxdg-0.27/pyxdg.egg-info/SOURCES.txt --- old/pyxdg-0.26/pyxdg.egg-info/SOURCES.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/pyxdg-0.27/pyxdg.egg-info/SOURCES.txt 2020-10-18 16:53:47.000000000 +0200 @@ -0,0 +1,37 @@ +AUTHORS +COPYING +ChangeLog +INSTALL +MANIFEST.in +README +TODO +setup.cfg +setup.py +pyxdg.egg-info/PKG-INFO +pyxdg.egg-info/SOURCES.txt +pyxdg.egg-info/dependency_links.txt +pyxdg.egg-info/top_level.txt +test/fuzz-mime.py +test/resources.py +test/test-basedirectory.py +test/test-desktop.py +test/test-icon.py +test/test-inifile.py +test/test-locale.py +test/test-menu-rules.py +test/test-menu.py +test/test-mime.py +test/test-recentfiles.py +xdg/BaseDirectory.py +xdg/Config.py +xdg/DesktopEntry.py +xdg/Exceptions.py +xdg/IconTheme.py +xdg/IniFile.py +xdg/Locale.py +xdg/Menu.py +xdg/MenuEditor.py +xdg/Mime.py +xdg/RecentFiles.py +xdg/__init__.py +xdg/util.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/pyxdg.egg-info/dependency_links.txt new/pyxdg-0.27/pyxdg.egg-info/dependency_links.txt --- old/pyxdg-0.26/pyxdg.egg-info/dependency_links.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/pyxdg-0.27/pyxdg.egg-info/dependency_links.txt 2020-10-18 16:53:47.000000000 +0200 @@ -0,0 +1 @@ + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/pyxdg.egg-info/top_level.txt new/pyxdg-0.27/pyxdg.egg-info/top_level.txt --- old/pyxdg-0.26/pyxdg.egg-info/top_level.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/pyxdg-0.27/pyxdg.egg-info/top_level.txt 2020-10-18 16:53:47.000000000 +0200 @@ -0,0 +1 @@ +xdg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/setup.cfg new/pyxdg-0.27/setup.cfg --- old/pyxdg-0.26/setup.cfg 1970-01-01 01:00:00.000000000 +0100 +++ new/pyxdg-0.27/setup.cfg 2020-10-18 16:53:47.768752000 +0200 @@ -0,0 +1,7 @@ +[bdist_wheel] +universal = 1 + +[egg_info] +tag_build = +tag_date = 0 + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/setup.py new/pyxdg-0.27/setup.py --- old/pyxdg-0.26/setup.py 2018-02-02 18:35:20.000000000 +0100 +++ new/pyxdg-0.27/setup.py 2020-10-18 16:52:29.000000000 +0200 @@ -1,20 +1,19 @@ -#!/usr/bin/python +#!/usr/bin/env python3 -from distutils.core import setup +from setuptools import setup setup( name = "pyxdg", - version = "0.26", + version = "0.27", description = "PyXDG contains implementations of freedesktop.org standards in python.", maintainer = "Freedesktop.org", maintainer_email = "[email protected]", url = "http://freedesktop.org/wiki/Software/pyxdg", packages = ['xdg'], classifiers = [ - "License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)", - "Programming Language :: Python :: 2.6", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Topic :: Desktop Environment", - ], - ) + "License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Topic :: Desktop Environment", + ], +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/test/fuzz-mime.py new/pyxdg-0.27/test/fuzz-mime.py --- old/pyxdg-0.26/test/fuzz-mime.py 2017-03-23 16:15:28.000000000 +0100 +++ new/pyxdg-0.27/test/fuzz-mime.py 2020-10-18 16:44:24.000000000 +0200 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Run this manually to test xdg.Mime.get_type2 against all files in a directory. Syntax: ./fuzz-mime.py /dir/to/test/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/test/resources.py new/pyxdg-0.27/test/resources.py --- old/pyxdg-0.26/test/resources.py 2017-03-23 16:15:28.000000000 +0100 +++ new/pyxdg-0.27/test/resources.py 2020-10-18 16:44:24.000000000 +0200 @@ -4,6 +4,8 @@ """ from __future__ import unicode_literals +import sys + # With additions from firefox.desktop, to test locale & unicode support gedit_desktop = """[Desktop Entry] Name=gedit @@ -75,10 +77,10 @@ python_desktop = """[Desktop Entry] Name=Python Comment=Dynamic programming language -Exec=python -TryExec=python +Exec=%s +TryExec=%s Type=Application -""" +""" % (sys.executable, sys.executable) recently_used = """<?xml version="1.0"?> <RecentFiles> @@ -448,6 +450,46 @@ </Menu> """ +layout_menu = """<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN" + "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd"> +<Menu> + + <Name>Layout</Name> + <DefaultLayout show_empty="true"> + <Merge type="menus"/> + <Merge type="files"/> + <Separator/> + <Menuname>More</Menuname> + </DefaultLayout> + + <Menu> + <Name>More</Name> + </Menu> + + <Menu> + <Name>Games</Name> + <Layout> + <Menuname>Steam</Menuname> + <Separator/> + <Merge type="menus"/> + </Layout> + <Menu> + <Name>Action</Name> + </Menu> + <Menu> + <Name>Steam</Name> + </Menu> + <Menu> + <Name>Arcade</Name> + </Menu> + </Menu> + + <Menu> + <Name>Accessories</Name> + </Menu> +</Menu> +""" + mime_globs2_a = """#globs2 MIME data file 55:text/x-diff:*.patch 50:text/x-c++src:*.C:cs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/test/test-desktop.py new/pyxdg-0.27/test/test-desktop.py --- old/pyxdg-0.26/test/test-desktop.py 2017-03-23 16:17:22.000000000 +0100 +++ new/pyxdg-0.27/test/test-desktop.py 2020-10-18 16:44:24.000000000 +0200 @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 # coding: utf-8 from xdg.DesktopEntry import DesktopEntry from xdg.Exceptions import ValidationError, ParsingError, NoKeyError diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/test/test-icon.py new/pyxdg-0.27/test/test-icon.py --- old/pyxdg-0.26/test/test-icon.py 2017-03-23 16:15:28.000000000 +0100 +++ new/pyxdg-0.27/test/test-icon.py 2020-10-18 16:44:24.000000000 +0200 @@ -1,10 +1,14 @@ -#!/usr/bin/python +#!/usr/bin/env python3 from xdg.IconTheme import IconTheme, getIconPath, getIconData import tempfile, shutil, os import unittest import resources +example_dir = os.path.join(os.path.dirname(__file__), 'example') +def example_file(filename): + return os.path.join(example_dir, filename) + class IconThemeTest(unittest.TestCase): def test_find_icon_exists(self): print("Finding an icon that probably exists:") @@ -16,7 +20,7 @@ def test_validate_icon_theme(self): theme = IconTheme() - theme.parse("/usr/share/icons/hicolor/index.theme") + theme.parse(example_file("index.theme")) theme.validate() class IconDataTest(unittest.TestCase): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/test/test-inifile.py new/pyxdg-0.27/test/test-inifile.py --- old/pyxdg-0.26/test/test-inifile.py 2017-03-23 16:15:28.000000000 +0100 +++ new/pyxdg-0.27/test/test-inifile.py 2020-10-18 16:44:24.000000000 +0200 @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 # coding: utf-8 from xdg import IniFile from xdg.util import u diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/test/test-menu.py new/pyxdg-0.27/test/test-menu.py --- old/pyxdg-0.26/test/test-menu.py 2017-03-23 16:15:28.000000000 +0100 +++ new/pyxdg-0.27/test/test-menu.py 2020-10-18 16:44:24.000000000 +0200 @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 from __future__ import print_function import io @@ -27,35 +27,62 @@ print(depth*"-" + "\x1b[01m" + entry.Name + "\x1b[0m") depth -= 1 +def entry_names(entries): + names = [] + for entry in entries: + if isinstance(entry, xdg.Menu.Menu): + names.append(entry.getName()) + elif isinstance(entry, xdg.Menu.MenuEntry): + names.append(entry.DesktopEntry.getName()) + elif isinstance(entry, xdg.Menu.Separator): + names.append("---") + elif isinstance(entry, xdg.Menu.Header): + names.append(entry.Name) + return names + class MenuTest(unittest.TestCase): def setUp(self): self.tmpdir = tempfile.mkdtemp() self.test_file = os.path.join(self.tmpdir, "applications.menu") with open(self.test_file, "w") as f: f.write(resources.applications_menu) - + def tearDown(self): shutil.rmtree(self.tmpdir) - + def test_parse_menu(self): menu = xdg.Menu.parse(self.test_file) show_menu(menu) - + # Check these don't throw an error menu.getName() menu.getGenericName() menu.getComment() menu.getIcon() - + + def test_parse_layout(self): + test_file = os.path.join(self.tmpdir, "layout.menu") + with io.open(test_file, "w") as f: + f.write(resources.layout_menu) + menu = xdg.Menu.parse(test_file) + show_menu(menu) + + assert len(menu.Entries) == 4 + assert entry_names(menu.Entries) == ["Accessories", "Games", "---", "More"] + + games_menu = menu.getMenu("Games") + assert len(games_menu.Entries) == 4 + assert entry_names(games_menu.Entries) == ["Steam", "---", "Action", "Arcade"] + def test_unicode_menuentry(self): test_file = os.path.join(self.tmpdir, "unicode.desktop") with io.open(test_file, 'w', encoding='utf-8') as f: f.write(resources.unicode_desktop) - + entry = xdg.Menu.MenuEntry(test_file) assert entry == entry assert not entry < entry - + def test_empty_legacy_dirs(self): legacy_dir = os.path.join(self.tmpdir, "applnk") os.mkdir(legacy_dir) @@ -64,22 +91,26 @@ test_file = os.path.join(self.tmpdir, "legacy.menu") with open(test_file, "w") as f: f.write(resources.legacy_menu.replace("legacy_dir", legacy_dir)) - + menu = xdg.Menu.parse(test_file) - + # The menu should be empty besides the root named "Legacy" show_menu(menu) - + assert len(menu.Entries) == 0 - + def test_kde_legacy_dirs(self): """This was failing on systems which didn't have kde-config installed. We just check that parsing doesn't throw an error. - + See fd.o bug #56426. """ test_file = os.path.join(self.tmpdir, "kde_legacy.menu") with open(test_file, "w") as f: f.write(resources.kde_legacy_menu) - + menu = xdg.Menu.parse(test_file) + + +if __name__ == '__main__': + unittest.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/xdg/IniFile.py new/pyxdg-0.27/xdg/IniFile.py --- old/pyxdg-0.26/xdg/IniFile.py 2017-03-23 16:15:28.000000000 +0100 +++ new/pyxdg-0.27/xdg/IniFile.py 2020-10-18 14:42:15.000000000 +0200 @@ -56,38 +56,37 @@ return # parse file - for line in fd: - line = line.strip() - # empty line - if not line: - continue - # comment - elif line[0] == '#': - continue - # new group - elif line[0] == '[': - currentGroup = line.lstrip("[").rstrip("]") - if debug and self.hasGroup(currentGroup): - raise DuplicateGroupError(currentGroup, filename) - else: - content[currentGroup] = {} - # key - else: - try: - key, value = line.split("=", 1) - except ValueError: - raise ParsingError("Invalid line: " + line, filename) - - key = key.strip() # Spaces before/after '=' should be ignored - try: - if debug and self.hasKey(key, currentGroup): - raise DuplicateKeyError(key, currentGroup, filename) + with fd: + for line in fd: + line = line.strip() + # empty line + if not line: + continue + # comment + elif line[0] == '#': + continue + # new group + elif line[0] == '[': + currentGroup = line.lstrip("[").rstrip("]") + if debug and self.hasGroup(currentGroup): + raise DuplicateGroupError(currentGroup, filename) else: - content[currentGroup][key] = value.strip() - except (IndexError, UnboundLocalError): - raise ParsingError("Parsing error on key, group missing", filename) + content[currentGroup] = {} + # key + else: + try: + key, value = line.split("=", 1) + except ValueError: + raise ParsingError("Invalid line: " + line, filename) - fd.close() + key = key.strip() # Spaces before/after '=' should be ignored + try: + if debug and self.hasKey(key, currentGroup): + raise DuplicateKeyError(key, currentGroup, filename) + else: + content[currentGroup][key] = value.strip() + except (IndexError, UnboundLocalError): + raise ParsingError("Parsing error on key, group missing", filename) self.filename = filename self.tainted = False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/xdg/Menu.py new/pyxdg-0.27/xdg/Menu.py --- old/pyxdg-0.26/xdg/Menu.py 2017-03-23 16:15:28.000000000 +0100 +++ new/pyxdg-0.27/xdg/Menu.py 2020-10-18 16:44:24.000000000 +0200 @@ -21,6 +21,7 @@ import locale import subprocess import ast +import sys try: import xml.etree.cElementTree as etree except ImportError: @@ -35,6 +36,17 @@ import xdg.Config +def _ast_const(name): + if sys.version_info >= (3, 4): + name = ast.literal_eval(name) + if sys.version_info >= (3, 8): + return ast.Constant(name) + else: + return ast.NameConstant(name) + else: + return ast.Name(id=name, ctx=ast.Load()) + + def _strxfrm(s): """Wrapper around locale.strxfrm that accepts unicode strings on Python 2. @@ -298,11 +310,11 @@ entry.Show = NO_EXEC self.Visible -= 1 elif xdg.Config.windowmanager: - if (entry.DesktopEntry.OnlyShowIn != [] and ( - xdg.Config.windowmanager not in entry.DesktopEntry.OnlyShowIn + if (entry.DesktopEntry.getOnlyShowIn() != [] and ( + xdg.Config.windowmanager not in entry.DesktopEntry.getOnlyShowIn() ) ) or ( - xdg.Config.windowmanager in entry.DesktopEntry.NotShowIn + xdg.Config.windowmanager in entry.DesktopEntry.getNotShowIn() ): entry.Show = NOT_SHOW_IN self.Visible -= 1 @@ -710,11 +722,12 @@ inline_header=_to_bool(node.attrib.get("inline_header", True)), inline_alias=_to_bool(node.attrib.get("inline_alias", False)) ) + order = [] for child in node: tag, text = child.tag, child.text text = text.strip() if text else None if tag == "Menuname" and text: - layout.order.append([ + order.append([ "Menuname", text, _to_bool(child.attrib.get("show_empty", False)), @@ -724,14 +737,15 @@ _to_bool(child.attrib.get("inline_alias", False)) ]) elif tag == "Separator": - layout.order.append(['Separator']) + order.append(['Separator']) elif tag == "Filename" and text: - layout.order.append(["Filename", text]) + order.append(["Filename", text]) elif tag == "Merge": - layout.order.append([ + order.append([ "Merge", child.attrib.get("type", "all") ]) + layout.order = order return layout def parse_move(self, node): @@ -754,7 +768,7 @@ if expr: tree.body = expr else: - tree.body = ast.Name('False', ast.Load()) + tree.body = _ast_const('False') ast.fix_missing_locations(tree) return Rule(type, tree) @@ -781,7 +795,7 @@ expr = self.parse_bool_op(node, ast.Or()) return ast.UnaryOp(ast.Not(), expr) if expr else None elif tag == 'All': - return ast.Name('True', ast.Load()) + return _ast_const('True') elif tag == 'Category': category = node.text return ast.Compare( @@ -994,8 +1008,8 @@ menuentry = MenuEntry(directory, dir) if not menu.Directory: menu.Directory = menuentry - elif menuentry.Type == MenuEntry.TYPE_SYSTEM: - if menu.Directory.Type == MenuEntry.TYPE_USER: + elif menuentry.getType() == MenuEntry.TYPE_SYSTEM: + if menu.Directory.getType() == MenuEntry.TYPE_USER: menu.Directory.Original = menuentry if menu.Directory: break diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/xdg/MenuEditor.py new/pyxdg-0.27/xdg/MenuEditor.py --- old/pyxdg-0.26/xdg/MenuEditor.py 2017-03-23 16:15:28.000000000 +0100 +++ new/pyxdg-0.27/xdg/MenuEditor.py 2020-10-18 15:03:28.000000000 +0200 @@ -54,7 +54,7 @@ try: self.tree = etree.parse(self.filename) except IOError: - root = etree.fromtring(""" + root = etree.fromstring(""" <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN" "http://standards.freedesktop.org/menu-spec/menu-1.0.dtd"> <Menu> <Name>Applications</Name> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/xdg/Mime.py new/pyxdg-0.27/xdg/Mime.py --- old/pyxdg-0.26/xdg/Mime.py 2017-03-23 16:15:28.000000000 +0100 +++ new/pyxdg-0.27/xdg/Mime.py 2020-10-18 14:42:15.000000000 +0200 @@ -749,14 +749,16 @@ file with the same name (if the contents are different)""" application += '.xml' - new_data = open(package_file).read() + with open(package_file) as f: + new_data = f.read() # See if the file is already installed package_dir = os.path.join('mime', 'packages') resource = os.path.join(package_dir, application) for x in BaseDirectory.load_data_paths(resource): try: - old_data = open(x).read() + with open(x) as f: + old_data = f.read() except: continue if old_data == new_data: @@ -770,7 +772,8 @@ new_file = os.path.join(BaseDirectory.save_data_path(package_dir), application) # Write the file... - open(new_file, 'w').write(new_data) + with open(new_file, 'w') as f: + f.write(new_data) # Update the database... command = 'update-mime-database' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/xdg/RecentFiles.py new/pyxdg-0.27/xdg/RecentFiles.py --- old/pyxdg-0.26/xdg/RecentFiles.py 2017-03-23 16:15:28.000000000 +0100 +++ new/pyxdg-0.27/xdg/RecentFiles.py 2020-10-18 14:42:15.000000000 +0200 @@ -71,28 +71,27 @@ elif not filename: filename = self.filename - f = open(filename, "w") - fcntl.lockf(f, fcntl.LOCK_EX) - f.write('<?xml version="1.0"?>\n') - f.write("<RecentFiles>\n") + with open(filename, "w") as f: + fcntl.lockf(f, fcntl.LOCK_EX) + f.write('<?xml version="1.0"?>\n') + f.write("<RecentFiles>\n") - for r in self.RecentFiles: - f.write(" <RecentItem>\n") - f.write(" <URI>%s</URI>\n" % xml.sax.saxutils.escape(r.URI)) - f.write(" <Mime-Type>%s</Mime-Type>\n" % r.MimeType) - f.write(" <Timestamp>%s</Timestamp>\n" % r.Timestamp) - if r.Private == True: - f.write(" <Private/>\n") - if len(r.Groups) > 0: - f.write(" <Groups>\n") - for group in r.Groups: - f.write(" <Group>%s</Group>\n" % group) - f.write(" </Groups>\n") - f.write(" </RecentItem>\n") + for r in self.RecentFiles: + f.write(" <RecentItem>\n") + f.write(" <URI>%s</URI>\n" % xml.sax.saxutils.escape(r.URI)) + f.write(" <Mime-Type>%s</Mime-Type>\n" % r.MimeType) + f.write(" <Timestamp>%s</Timestamp>\n" % r.Timestamp) + if r.Private == True: + f.write(" <Private/>\n") + if len(r.Groups) > 0: + f.write(" <Groups>\n") + for group in r.Groups: + f.write(" <Group>%s</Group>\n" % group) + f.write(" </Groups>\n") + f.write(" </RecentItem>\n") - f.write("</RecentFiles>\n") - fcntl.lockf(f, fcntl.LOCK_UN) - f.close() + f.write("</RecentFiles>\n") + fcntl.lockf(f, fcntl.LOCK_UN) def getFiles(self, mimetypes=None, groups=None, limit=0): """Get a list of recently used files. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyxdg-0.26/xdg/__init__.py new/pyxdg-0.27/xdg/__init__.py --- old/pyxdg-0.26/xdg/__init__.py 2018-02-02 18:35:20.000000000 +0100 +++ new/pyxdg-0.27/xdg/__init__.py 2020-10-18 16:48:17.000000000 +0200 @@ -1,3 +1,3 @@ __all__ = [ "BaseDirectory", "DesktopEntry", "Menu", "Exceptions", "IniFile", "IconTheme", "Locale", "Config", "Mime", "RecentFiles", "MenuEditor" ] -__version__ = "0.26" +__version__ = "0.27" _______________________________________________ openSUSE Commits mailing list -- [email protected] To unsubscribe, email [email protected] List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/[email protected]
