rpm-software-management / spec-cleaner

spec-cleaner
BSD 3-Clause "New" or "Revised" License
28 stars 34 forks source link

spec-cleaner 0.9.1 requires a never version of re than ships with CentOS 7 #165

Closed intlabs closed 7 years ago

intlabs commented 7 years ago

spec-cleaner 0.9.1 is not compatible with Python 2.7.5's re which is the version used by CentOS.

The regular expressions introduced in https://github.com/openSUSE/spec-cleaner/commit/2c97233bcd2628ae9034ba48b4e5629257681159, break compatibility with Python 2.7.5

This affects building OpenStack on CentOS based Distros.

I have also filed a bug at Launchpad: https://bugs.launchpad.net/openstack-requirements/+bug/1655509

$ docker run -it --rm centos:7 python
Python 2.7.5 (default, Nov  6 2016, 00:28:07) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re_configure = re.compile(r'(^|(.*\s)?)./configure($|(\s(.*)?))')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/re.py", line 190, in compile
    return _compile(pattern, flags)
  File "/usr/lib64/python2.7/re.py", line 242, in _compile
    raise error, v # invalid expression
sre_constants.error: nothing to repeat
>>> re_cmake = re.compile(r'(^|(.*\s)?)cmake($|(\s(.*)?))')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/re.py", line 190, in compile
    return _compile(pattern, flags)
  File "/usr/lib64/python2.7/re.py", line 242, in _compile
    raise error, v # invalid expression
sre_constants.error: nothing to repeat
scarabeusiv commented 7 years ago

It seems to be bug in re honestly. In old version of 3.3 it was also present and fixed as one of the minor bumps.

Maybe reporting it to Redhat would make them fix it in their python?

ghost commented 7 years ago

@scarabeusiv specifically '(.*)?' does not work in <2.7.6 python. Using a regex without that is probably the best move here. I ran into this problem about a year ago and the solution was to use a different regex without '(.*)?' rather than have anyone else change anything.

For the record, Ubuntu 12.04 and Debian Wheezy also will have an issue with this

scarabeusiv commented 7 years ago

Oky as it is easier here I just tweaked it back, thanks to pointing out what is wrong :)

Hang tight for 0.9.2 release fixing this.