Accepting request 852844 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/852844 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pyxdg?expand=0&rev=11
This commit is contained in:
commit
965612b722
@ -1,30 +0,0 @@
|
|||||||
diff --git a/xdg/Menu.py b/xdg/Menu.py
|
|
||||||
index 1d03cad591668f8297882ad8ff3656fbc8062ff1..c27eee2b054f903ae66727dcaee5563f3bebf8ee 100644
|
|
||||||
--- a/xdg/Menu.py
|
|
||||||
+++ b/xdg/Menu.py
|
|
||||||
@@ -298,11 +298,11 @@ class Menu:
|
|
||||||
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
|
|
||||||
@@ -994,8 +994,8 @@ class XMLMenuBuilder(object):
|
|
||||||
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
|
|
@ -1,3 +1,16 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Dec 3 02:30:45 UTC 2020 - Benjamin Greiner <code@bnavigator.de>
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Oct 5 12:47:20 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
|
Mon Oct 5 12:47:20 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
|
||||||
|
|
||||||
|
@ -19,14 +19,14 @@
|
|||||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||||
%define oldpython python
|
%define oldpython python
|
||||||
Name: python-pyxdg
|
Name: python-pyxdg
|
||||||
Version: 0.26
|
Version: 0.27
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Implementations of freedesktop.org standards in python
|
Summary: Implementations of freedesktop.org standards in python
|
||||||
License: LGPL-2.1-only
|
License: LGPL-2.1-only
|
||||||
URL: https://freedesktop.org/wiki/Software/pyxdg
|
URL: https://freedesktop.org/wiki/Software/pyxdg
|
||||||
Source: https://files.pythonhosted.org/packages/source/p/pyxdg/pyxdg-%{version}.tar.gz
|
Source0: https://files.pythonhosted.org/packages/source/p/pyxdg/pyxdg-%{version}.tar.gz
|
||||||
Patch0: resource_leak.patch
|
# Test data: examples
|
||||||
Patch1: https://gitlab.freedesktop.org/tcallawa/pyxdg/-/commit/b8d3d7b337adeb2fc2ef8a36f3a500e147d7a41b.diff#/new-api.patch
|
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 pytest}
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
@ -49,8 +49,9 @@ PyXDG is a python library to access freedesktop.org standards. Currently support
|
|||||||
* Shared-MIME-Database Specification 0.13
|
* Shared-MIME-Database Specification 0.13
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n pyxdg-%{version}
|
%setup -q -n pyxdg-%{version} -b 1
|
||||||
%autopatch -p1
|
%autopatch -p1
|
||||||
|
cp -r ../pyxdg-rel-%{version}-test-example/test/example test/
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%python_build
|
||||||
@ -60,13 +61,7 @@ PyXDG is a python library to access freedesktop.org standards. Currently support
|
|||||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||||
|
|
||||||
%check
|
%check
|
||||||
# https://gitlab.freedesktop.org/xdg/pyxdg/issues/15
|
%pytest test/test-*.py -v
|
||||||
# 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)'
|
|
||||||
}
|
|
||||||
|
|
||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
%license COPYING
|
%license COPYING
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:fe2928d3f532ed32b39c32a482b54136fe766d19936afc96c8f00645f9da1a06
|
|
||||||
size 57879
|
|
3
pyxdg-0.27-test-example.tar.gz
Normal file
3
pyxdg-0.27-test-example.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:bb8bc64be9d14035d316c0e42fc0acaa47c44d5b6bc8e3e0a9f9cf1bb1fc571b
|
||||||
|
size 8723
|
3
pyxdg-0.27.tar.gz
Normal file
3
pyxdg-0.27.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:80bd93aae5ed82435f20462ea0208fb198d8eec262e831ee06ce9ddb6b91c5a5
|
||||||
|
size 59753
|
@ -1,174 +0,0 @@
|
|||||||
From 73476af1eecb8e29f2a461e003a2d8a735d22306 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Micka=C3=ABl=20Schoentgen?= <contact@tiger-222.fr>
|
|
||||||
Date: Sun, 9 Dec 2018 17:31:24 +0100
|
|
||||||
Subject: Fix several ResourceWarnings: unclosed file
|
|
||||||
|
|
||||||
---
|
|
||||||
xdg/IniFile.py | 61 +++++++++++++++++++++++++++---------------------------
|
|
||||||
xdg/Mime.py | 9 +++++---
|
|
||||||
xdg/RecentFiles.py | 43 +++++++++++++++++++-------------------
|
|
||||||
3 files changed, 57 insertions(+), 56 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/xdg/IniFile.py b/xdg/IniFile.py
|
|
||||||
index 718589f..84be614 100644
|
|
||||||
--- a/xdg/IniFile.py
|
|
||||||
+++ b/xdg/IniFile.py
|
|
||||||
@@ -56,38 +56,37 @@ class IniFile:
|
|
||||||
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)
|
|
||||||
-
|
|
||||||
- fd.close()
|
|
||||||
+ 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)
|
|
||||||
+ 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 --git a/xdg/Mime.py b/xdg/Mime.py
|
|
||||||
index 3bff8b2..886cb42 100644
|
|
||||||
--- a/xdg/Mime.py
|
|
||||||
+++ b/xdg/Mime.py
|
|
||||||
@@ -749,14 +749,16 @@ def install_mime_info(application, package_file):
|
|
||||||
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 @@ def install_mime_info(application, package_file):
|
|
||||||
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 --git a/xdg/RecentFiles.py b/xdg/RecentFiles.py
|
|
||||||
index 3038b57..7ee7ee5 100644
|
|
||||||
--- a/xdg/RecentFiles.py
|
|
||||||
+++ b/xdg/RecentFiles.py
|
|
||||||
@@ -71,28 +71,27 @@ class RecentFiles:
|
|
||||||
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")
|
|
||||||
-
|
|
||||||
- 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()
|
|
||||||
+ 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")
|
|
||||||
+
|
|
||||||
+ 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.
|
|
||||||
--
|
|
||||||
cgit v1.1
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user