View | Details | Raw Unified | Return to bug 50332
Collapse All | Expand All

(-)management/univention-management-console/dev/dh-umc-module-install (-2 / +2 lines)
 Lines 1-4    Link Here 
1
#!/usr/bin/python2.7
1
#!/usr/bin/python2.7 -W ignore
2
# -*- coding: utf-8 -*-
2
# -*- coding: utf-8 -*-
3
#
3
#
4
# Univention Management Console
4
# Univention Management Console
 Lines 51-57   class Module(object): Link Here 
51
	def __init__(self, module):
51
	def __init__(self, module):
52
		self.module = module
52
		self.module = module
53
		self.destdir = os.path.join('debian', self.module.package)
53
		self.destdir = os.path.join('debian', self.module.package)
54
		self.python_destdirs = [os.path.join(self.destdir, 'usr/lib/python%s/dist-packages/' % (self.module.python_version,))]
54
		self.python_destdirs = [os.path.join(self.destdir, 'usr/lib/python%s/dist-packages/' % (version,)) for version in self.module.python_versions]
55
		self.languages = dh_umc.LANGUAGES
55
		self.languages = dh_umc.LANGUAGES
56
56
57
	def dh_module_install(self):
57
	def dh_module_install(self):
(-)packaging/univention-ucs-translation-template/univention/translationhelper/umc.py (-5 / +21 lines)
 Lines 51-59   from __future__ import print_function Link Here 
51
# /usr/share/common-licenses/AGPL-3; if not, see
51
# /usr/share/common-licenses/AGPL-3; if not, see
52
# <https://www.gnu.org/licenses/>.
52
# <https://www.gnu.org/licenses/>.
53
53
54
import io
54
import re
55
import re
55
import os
56
import os
56
import sys
57
import sys
58
import warnings
57
import copy
59
import copy
58
import json
60
import json
59
from email.utils import formatdate
61
from email.utils import formatdate
 Lines 61-67   from email.utils import formatdate Link Here 
61
import polib
63
import polib
62
import xml.etree.ElementTree as ET
64
import xml.etree.ElementTree as ET
63
65
64
from debian.deb822 import Deb822
66
from debian.deb822 import Deb822, Packages
65
from . import helper
67
from . import helper
66
try:
68
try:
67
	from typing import Iterable, Iterator, List, Optional, Tuple, Union  # noqa F401
69
	from typing import Iterable, Iterator, List, Optional, Tuple, Union  # noqa F401
 Lines 70-76   except ImportError: Link Here 
70
72
71
MODULE = 'Module'
73
MODULE = 'Module'
72
PYTHON = 'Python'
74
PYTHON = 'Python'
73
PYTHON_VERSION = 'PythonVersion'
74
DEFINITION = 'Definition'
75
DEFINITION = 'Definition'
75
JAVASCRIPT = 'Javascript'
76
JAVASCRIPT = 'Javascript'
76
CATEGORY = 'Category'
77
CATEGORY = 'Category'
 Lines 121-129   class UMC_Module(dict): Link Here 
121
			return None
122
			return None
122
123
123
	@property
124
	@property
124
	def python_version(self):
125
	def python_versions(self):
125
		# type: () -> float
126
		# type: () -> list[float]
126
		return 3 if self.get(PYTHON_VERSION, ['2.7'])[0].startswith('3') else 2.7
127
		versions = [2.7]
128
		if '${python3:Provides}' in self['provides']:
129
			versions.append(3)
130
			if '${python:Provides}' not in self['provides']:
131
				versions.remove(2.7)
132
		return versions
127
133
128
	@property
134
	@property
129
	def js_path(self):
135
	def js_path(self):
 Lines 250-259   def read_modules(package, core=False): Link Here 
250
	modules = []  # type: List[UMC_Module]
256
	modules = []  # type: List[UMC_Module]
251
257
252
	file_umc_module = os.path.join('debian/', package + '.umc-modules')
258
	file_umc_module = os.path.join('debian/', package + '.umc-modules')
259
	file_control = os.path.join('debian/control')
253
260
254
	if not os.path.isfile(file_umc_module):
261
	if not os.path.isfile(file_umc_module):
255
		return modules
262
		return modules
256
263
264
	provides = []
265
	with io.open(file_control, 'r', encoding='utf-8') as fd:
266
		with warnings.catch_warnings():  # debian/deb822.py:982: UserWarning: cannot parse package relationship "${python3:Depends}", returning it raw
267
			for pkg in Packages.iter_paragraphs(fd):
268
				if pkg.get('Package') == package:
269
					provides = [p[0]['name'] for p in pkg.relations['provides']]
270
					break
271
257
	with open(file_umc_module, 'rb') as fd:
272
	with open(file_umc_module, 'rb') as fd:
258
		for item in Deb822.iter_paragraphs(fd):
273
		for item in Deb822.iter_paragraphs(fd):
259
			item = dict((k, [v]) for k, v in item.iteritems())  # simulate dh_ucs.parseRfc822 behaviour
274
			item = dict((k, [v]) for k, v in item.iteritems())  # simulate dh_ucs.parseRfc822 behaviour
 Lines 265-270   def read_modules(package, core=False): Link Here 
265
280
266
			# single values
281
			# single values
267
			item['package'] = package
282
			item['package'] = package
283
			item['provides'] = provides
268
			module = UMC_Module(item)
284
			module = UMC_Module(item)
269
			if core:
285
			if core:
270
				if module.module_name != 'umc-core' or not module.xml_categories:
286
				if module.module_name != 'umc-core' or not module.xml_categories:

Return to bug 50332