changed debian/source/format to native

This commit is contained in:
openKylinBot 2022-05-14 02:49:51 +08:00
parent fc589bebf8
commit de97c22da3
6 changed files with 1 additions and 247 deletions

View File

@ -1,80 +0,0 @@
From: Michael Vogt <michael.vogt@ubuntu.com>
Date: Thu, 8 Oct 2015 13:34:17 -0700
Subject: support Gettext-Domain fields
Support X-GNOME-Gettext-Domain and X-Ubuntu-Gettext-Domain fields
in .desktop files, for dynamic translation support.
.
Currently it's Ubuntu-specific, but it may be implemented in GNOME
later, see https://bugzilla.gnome.org/569829.
Forwarded: not-needed
Last-Update: 2013-03-08
Patch-Name: gettext-support.patch
---
test/test-desktop.py | 4 ++--
xdg/IniFile.py | 14 +++++++++++++-
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/test/test-desktop.py b/test/test-desktop.py
index e73ea5a..49b8cd8 100644
--- a/test/test-desktop.py
+++ b/test/test-desktop.py
@@ -51,9 +51,9 @@ class DesktopEntryTest(unittest.TestCase):
def test_values(self):
entry = DesktopEntry(self.test_file)
self.assertEqual(entry.getName(), 'gedit')
- self.assertEqual(entry.getGenericName(), 'Text Editor')
+ #self.assertEqual(entry.getGenericName(), 'Text Editor')
self.assertEqual(entry.getNoDisplay(), False)
- self.assertEqual(entry.getComment(), 'Edit text files')
+ #self.assertEqual(entry.getComment(), 'Edit text files')
self.assertEqual(entry.getIcon(), 'accessories-text-editor')
self.assertEqual(entry.getHidden(), False)
self.assertEqual(entry.getOnlyShowIn(), [])
diff --git a/xdg/IniFile.py b/xdg/IniFile.py
index 718589f..6d07fe2 100644
--- a/xdg/IniFile.py
+++ b/xdg/IniFile.py
@@ -8,6 +8,7 @@ from xdg.Exceptions import (ParsingError, DuplicateGroupError, NoGroupError,
debug)
import xdg.Locale
from xdg.util import u
+import gettext
def is_ascii(s):
"""Return True if a string consists entirely of ASCII characters."""
@@ -22,6 +23,7 @@ class IniFile:
fileExtension = ''
filename = ''
+ gettext_domain = None
tainted = False
@@ -101,6 +103,11 @@ class IniFile:
else:
raise ParsingError("[%s]-Header missing" % headers[0], filename)
+ # check for gettext domain
+ e = self.content.get('Desktop Entry', {})
+ self.gettext_domain = e.get('X-GNOME-Gettext-Domain',
+ e.get('X-Ubuntu-Gettext-Domain', None))
+
# start stuff to access the keys
def get(self, key, group=None, locale=False, type="string", list=False, strict=False):
# set default group
@@ -110,7 +117,12 @@ class IniFile:
# return key (with locale)
if (group in self.content) and (key in self.content[group]):
if locale:
- value = self.content[group][self.__addLocale(key, group)]
+ key = self.__addLocale(key, group)
+ if key.endswith(']') or not self.gettext_domain:
+ # inline translations
+ value = self.content[group][key]
+ else:
+ value = gettext.dgettext(self.gettext_domain, self.content[group][key])
else:
value = self.content[group][key]
else:

View File

@ -1,79 +0,0 @@
From: Debian Python Modules Team
<python-modules-team@lists.alioth.debian.org>
Date: Sat, 14 May 2022 02:49:51 +0800
Subject: python2
---
test/fuzz-mime.py | 2 +-
test/resources.py | 4 ++--
test/test-desktop.py | 2 +-
test/test-icon.py | 2 +-
test/test-inifile.py | 2 +-
test/test-menu.py | 2 +-
6 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/test/fuzz-mime.py b/test/fuzz-mime.py
index f33c875..be20a60 100755
--- a/test/fuzz-mime.py
+++ b/test/fuzz-mime.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
"""Run this manually to test xdg.Mime.get_type2 against all files in a directory.
Syntax: ./fuzz-mime.py /dir/to/test/
diff --git a/test/resources.py b/test/resources.py
index aa1a071..aedb5f9 100644
--- a/test/resources.py
+++ b/test/resources.py
@@ -75,8 +75,8 @@ Type=Application
python_desktop = """[Desktop Entry]
Name=Python
Comment=Dynamic programming language
-Exec=python
-TryExec=python
+Exec=python2
+TryExec=python2
Type=Application
"""
diff --git a/test/test-desktop.py b/test/test-desktop.py
index 49b8cd8..b158810 100644
--- a/test/test-desktop.py
+++ b/test/test-desktop.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
# coding: utf-8
from xdg.DesktopEntry import DesktopEntry
from xdg.Exceptions import ValidationError, ParsingError, NoKeyError
diff --git a/test/test-icon.py b/test/test-icon.py
index 952373b..b17d430 100644
--- a/test/test-icon.py
+++ b/test/test-icon.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
from xdg.IconTheme import IconTheme, getIconPath, getIconData
import tempfile, shutil, os
import unittest
diff --git a/test/test-inifile.py b/test/test-inifile.py
index bc78ec0..f2b8b56 100644
--- a/test/test-inifile.py
+++ b/test/test-inifile.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
# coding: utf-8
from xdg import IniFile
from xdg.util import u
diff --git a/test/test-menu.py b/test/test-menu.py
index 744fb8a..9c72733 100644
--- a/test/test-menu.py
+++ b/test/test-menu.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
from __future__ import print_function
import io

View File

@ -1,4 +0,0 @@
set-default-menu.patch
gettext-support.patch
test_mime_skip_symlink.patch
python2.diff

View File

@ -1,38 +0,0 @@
From: Ryan Kavanagh <rak@debian.org>
Date: Thu, 8 Oct 2015 13:34:16 -0700
Subject: Set default menu to be parsed
Upstream defaults to applications.menu, which isn't provided by Debian. We'll
try upstream's default, falling back to debian-menu.menu if it doesn't exist.
Origin: vendor
Bug-Debian: http://bugs.debian.org/654978
Forwarded: no
Last-Update: 2012-03-09
Patch-Name: set-default-menu.patch
---
xdg/Menu.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/xdg/Menu.py b/xdg/Menu.py
index 1d03cad..3adc413 100644
--- a/xdg/Menu.py
+++ b/xdg/Menu.py
@@ -611,8 +611,17 @@ class XMLMenuBuilder(object):
filename = _get_menu_file_path(filename)
# use default if no filename given
if not filename:
+ # Upstream's default, we leave it as default in case someone
+ # produces their own applications.menu and is depending on it.
candidate = os.environ.get('XDG_MENU_PREFIX', '') + "applications.menu"
filename = _get_menu_file_path(candidate)
+ # Since applications.menu isn't provided in Debian, we'll fallback
+ # to debian.menu, typically in /etc/xdg/menus/debian-menu.menu
+ # (Closes: #654978)
+ if not filename:
+ candidate = os.environ.get('XDG_MENU_PREFIX', '') + \
+ "debian-menu.menu"
+ filename = _get_menu_file_path(candidate)
if not filename:
raise ParsingError('File not found', "/etc/xdg/menus/%s" % candidate)
# check if it is a .menu file

View File

@ -1,45 +0,0 @@
From: Debian Python Modules Team
<python-modules-team@lists.alioth.debian.org>
Date: Sat, 14 May 2022 02:49:51 +0800
Subject: test_mime_skip_symlink
---
test/test-mime.py | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/test/test-mime.py b/test/test-mime.py
index cc10a3c..1b13f06 100644
--- a/test/test-mime.py
+++ b/test/test-mime.py
@@ -73,10 +73,11 @@ class MimeTest(MimeTestBase):
self.check_mimetype(mystery_exe, 'application', 'executable')
# Symlink
- self.check_mimetype(Mime.get_type(example_file("png_symlink")),
- 'image', 'png')
- self.check_mimetype(Mime.get_type(example_file("png_symlink"), follow=False),
- 'inode', 'symlink')
+ print("test-mime.py::test_get_type: skip symlink tests")
+ #self.check_mimetype(Mime.get_type(example_file("png_symlink")),
+ # 'image', 'png')
+ #self.check_mimetype(Mime.get_type(example_file("png_symlink"), follow=False),
+ # 'inode', 'symlink')
def test_get_type2(self):
# File that doesn't exist - use the name
@@ -113,10 +114,11 @@ class MimeTest(MimeTestBase):
self.check_mimetype(mystery_exe, 'application', 'executable')
# Symlink
- self.check_mimetype(Mime.get_type2(example_file("png_symlink")),
- 'image', 'png')
- self.check_mimetype(Mime.get_type2(example_file("png_symlink"), follow=False),
- 'inode', 'symlink')
+ print("test-mime.py::test_get_type2: skip symlink tests")
+ #self.check_mimetype(Mime.get_type2(example_file("png_symlink")),
+ # 'image', 'png')
+ #self.check_mimetype(Mime.get_type2(example_file("png_symlink"), follow=False),
+ # 'inode', 'symlink')
def test_lookup(self):
pdf1 = Mime.lookup("application/pdf")

View File

@ -1 +1 @@
3.0 (quilt)
3.0 (native)