Univention Bugzilla – Attachment 10236 Details for
Bug 50332
Adjust dh_umc for dh_python2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
50332.patch (text/plain), 3.79 KB, created by
Florian Best
on 2019-11-29 11:56 CET
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Florian Best
Created:
2019-11-29 11:56 CET
Size:
3.79 KB
patch
obsolete
>commit 99b4334a820ba411c7bae59c821fce6a4b5ac141 >Author: Florian Best <best@univention.de> >Date: Fri Nov 29 11:56:11 2019 +0100 > > Bug #50332: use ${python3:Provides} for adding a python 3 UMC module > >diff --git management/univention-management-console/dev/dh-umc-module-install management/univention-management-console/dev/dh-umc-module-install >index c05f1808ef..2a8791384e 100755 >--- management/univention-management-console/dev/dh-umc-module-install >+++ management/univention-management-console/dev/dh-umc-module-install >@@ -1,4 +1,4 @@ >-#!/usr/bin/python2.7 >+#!/usr/bin/python2.7 -W ignore > # -*- coding: utf-8 -*- > # > # Univention Management Console >@@ -51,7 +51,7 @@ class Module(object): > def __init__(self, module): > self.module = module > self.destdir = os.path.join('debian', self.module.package) >- self.python_destdirs = [os.path.join(self.destdir, 'usr/lib/python%s/dist-packages/' % (self.module.python_version,))] >+ self.python_destdirs = [os.path.join(self.destdir, 'usr/lib/python%s/dist-packages/' % (version,)) for version in self.module.python_versions] > self.languages = dh_umc.LANGUAGES > > def dh_module_install(self): >diff --git packaging/univention-ucs-translation-template/univention/translationhelper/umc.py packaging/univention-ucs-translation-template/univention/translationhelper/umc.py >index 959839a31e..9542a88546 100644 >--- packaging/univention-ucs-translation-template/univention/translationhelper/umc.py >+++ packaging/univention-ucs-translation-template/univention/translationhelper/umc.py >@@ -51,9 +51,11 @@ from __future__ import print_function > # /usr/share/common-licenses/AGPL-3; if not, see > # <https://www.gnu.org/licenses/>. > >+import io > import re > import os > import sys >+import warnings > import copy > import json > from email.utils import formatdate >@@ -61,7 +63,7 @@ from email.utils import formatdate > import polib > import xml.etree.ElementTree as ET > >-from debian.deb822 import Deb822 >+from debian.deb822 import Deb822, Packages > from . import helper > try: > from typing import Iterable, Iterator, List, Optional, Tuple, Union # noqa F401 >@@ -70,7 +72,6 @@ except ImportError: > > MODULE = 'Module' > PYTHON = 'Python' >-PYTHON_VERSION = 'PythonVersion' > DEFINITION = 'Definition' > JAVASCRIPT = 'Javascript' > CATEGORY = 'Category' >@@ -121,9 +122,14 @@ class UMC_Module(dict): > return None > > @property >- def python_version(self): >- # type: () -> float >- return 3 if self.get(PYTHON_VERSION, ['2.7'])[0].startswith('3') else 2.7 >+ def python_versions(self): >+ # type: () -> list[float] >+ versions = [2.7] >+ if '${python3:Provides}' in self['provides']: >+ versions.append(3) >+ if '${python:Provides}' not in self['provides']: >+ versions.remove(2.7) >+ return versions > > @property > def js_path(self): >@@ -250,10 +256,19 @@ def read_modules(package, core=False): > modules = [] # type: List[UMC_Module] > > file_umc_module = os.path.join('debian/', package + '.umc-modules') >+ file_control = os.path.join('debian/control') > > if not os.path.isfile(file_umc_module): > return modules > >+ provides = [] >+ with io.open(file_control, 'r', encoding='utf-8') as fd: >+ with warnings.catch_warnings(): # debian/deb822.py:982: UserWarning: cannot parse package relationship "${python3:Depends}", returning it raw >+ for pkg in Packages.iter_paragraphs(fd): >+ if pkg.get('Package') == package: >+ provides = [p[0]['name'] for p in pkg.relations['provides']] >+ break >+ > with open(file_umc_module, 'rb') as fd: > for item in Deb822.iter_paragraphs(fd): > item = dict((k, [v]) for k, v in item.iteritems()) # simulate dh_ucs.parseRfc822 behaviour >@@ -265,6 +280,7 @@ def read_modules(package, core=False): > > # single values > item['package'] = package >+ item['provides'] = provides > module = UMC_Module(item) > if core: > if module.module_name != 'umc-core' or not module.xml_categories:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 50332
: 10236