]> git.pld-linux.org Git - packages/rpm.git/blame - rpm-pythoneggs.patch
- rel 46; missing import
[packages/rpm.git] / rpm-pythoneggs.patch
CommitLineData
76cf8a80 1--- rpm-5.4.15.org/scripts/pythoneggs.py 2012-05-08 00:39:11.000000000 +0200
75024bb9
AM
2+++ rpm-5.4.15/scripts/pythoneggs.py 2018-09-27 10:32:34.661059061 +0200
3@@ -16,7 +16,8 @@ from pkg_resources import Distribution,
fb11a0dd
JR
4 from distutils.sysconfig import get_python_lib
5 from subprocess import Popen, PIPE, STDOUT
6 import os
7-
75024bb9 8+import platform
fb11a0dd
JR
9+import re
10
11 opts, args = getopt(argv[1:], 'hPRSCOEb:',
12 ['help', 'provides', 'requires', 'suggests', 'conflicts', 'obsoletes', 'extras','buildroot='])
75024bb9 13@@ -29,6 +30,13 @@ Obsoletes = False
fb11a0dd
JR
14 Extras = False
15 buildroot = None
16
17+def make_pldver(raw):
18+ if re.match(r'^[0-9\.]+$', raw) == None:
19+ pldver = re.sub(r'([\d\.]+)(.+)', r'\1-0.\2', raw)
20+ else:
21+ pldver = raw
22+ return pldver
23+
24 for o, a in opts:
25 if o in ('-h', '--help'):
26 print '-h, --help\tPrint help'
75024bb9 27@@ -125,11 +133,14 @@ for f in files:
25bdcc2c
JR
28 if not name in py_deps:
29 py_deps[name] = []
30 py_deps[name].append(('==', dist.py_version))
31- name = 'pythonegg(%s)' % dist.key
32+ if dist.py_version .split(".")[0] == '3':
33+ name = 'python3egg(%s)' % dist.key
34+ else:
35+ name = 'pythonegg(%s)' % dist.key
fb11a0dd
JR
36 if not name in py_deps:
37 py_deps[name] = []
38 if dist.version:
39- spec = ('==', dist.version)
40+ spec = ('==', make_pldver(dist.version))
41 if not spec in py_deps[name]:
42 py_deps[name].append(spec)
43 if Requires or (Suggests and dist.extras):
75024bb9 44@@ -145,6 +156,14 @@ for f in files:
76cf8a80
AM
45 spec = ('==', dist.py_version)
46 if not spec in py_deps[name]:
47 py_deps[name].append(spec)
48+ # fake python version for dist.requires(), so deps like
49+ # [:python_version < '3']
50+ # enum34
51+ # will be handled correctly
52+ old_python_version = platform.python_version
53+ def new_python_version():
54+ return dist.py_version
55+ platform.python_version = new_python_version
56 deps = dist.requires()
57 if Suggests:
58 depsextras = dist.requires(extras=dist.extras)
75024bb9 59@@ -153,15 +172,20 @@ for f in files:
76cf8a80
AM
60 if dep in deps:
61 depsextras.remove(dep)
25bdcc2c 62 deps = depsextras
76cf8a80 63+ platform.python_version = old_python_version
25bdcc2c
JR
64 # add requires/suggests based on egg metadata
65 for dep in deps:
66- name = 'pythonegg(%s)' % dep.key
67+ if dist.py_version .split(".")[0] == '3':
68+ name = 'python3egg(%s)' % dep.key
69+ else:
70+ name = 'pythonegg(%s)' % dep.key
71 for spec in dep.specs:
fb11a0dd
JR
72 if spec[0] != '!=':
73 if not name in py_deps:
74 py_deps[name] = []
75- if not spec in py_deps[name]:
76- py_deps[name].append(spec)
77+ plddep = (spec[0], make_pldver(spec[1]))
78+ if not plddep in py_deps[name]:
79+ py_deps[name].append(plddep)
80 if not dep.specs:
81 py_deps[name] = []
82 # Unused, for automatic sub-package generation based on 'extras' from egg metadata
This page took 0.069246 seconds and 4 git commands to generate.