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