Bug 2074528

Summary: python-genshi fails to build with Python 3.11: re.error: global flags not at the start of the expression at position 994
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-genshiAssignee: Felix Schwarz <fschwarz>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: fschwarz, mhroncok, python-sig, thrnciar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 0.7.7-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-04-22 19:52:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2016048    

Description Tomáš Hrnčiar 2022-04-12 12:13:05 UTC
python-genshi fails to build with Python 3.11.0a6.

creating build/temp.linux-x86_64-3.11/genshi
gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -I/usr/include/python3.11 -c genshi/_speedups.c -o build/temp.linux-x86_64-3.11/genshi/_speedups.o
**********************************************************************
WARNING:
An optional C extension could not be compiled, speedups will not be
available.
**********************************************************************
command 'gcc' failed: No such file or directory
Traceback (most recent call last):
  File "/builddir/build/BUILD/Genshi-0.7.6/setup.py", line 98, in <module>
    setup(
    ^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/__init__.py", line 155, in setup
    return distutils.core.setup(**attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 148, in setup
    return run_commands(dist)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
    dist.run_commands()
    ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
    self.run_command(cmd)
    ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
    cmd_obj.run()
    ^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/command/test.py", line 181, in paths_on_pythonpath
    yield
    ^^^^^
  File "/usr/lib64/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/command/test.py", line 181, in paths_on_pythonpath
    yield
    ^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/command/test.py", line 155, in project_on_sys_path
    yield
    ^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/command/test.py", line 224, in run
    self.run_tests()
    ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/command/test.py", line 227, in run_tests
    test = unittest.main(
           ^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/unittest/main.py", line 101, in __init__
    self.parseArgs(argv)
    ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/unittest/main.py", line 150, in parseArgs
    self.createTests()
    ^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/unittest/main.py", line 161, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/unittest/loader.py", line 220, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/unittest/loader.py", line 220, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/unittest/loader.py", line 205, in loadTestsFromName
    test = obj()
           ^^^^^
  File "/builddir/build/BUILD/Genshi-0.7.6/genshi/tests/__init__.py", line 19, in suite
    from genshi.filters import tests as filters
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/Genshi-0.7.6/genshi/filters/__init__.py", line 17, in <module>
    from genshi.filters.i18n import Translator
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/Genshi-0.7.6/genshi/filters/i18n.py", line 31, in <module>
    from genshi.template.base import DirectiveFactory, EXPR, SUB, _apply_directives
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/Genshi-0.7.6/genshi/template/__init__.py", line 20, in <module>
    from genshi.template.markup import MarkupTemplate
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/Genshi-0.7.6/genshi/template/markup.py", line 25, in <module>
    from genshi.template.interpolation import interpolate
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/Genshi-0.7.6/genshi/template/interpolation.py", line 33, in <module>
    token_re = re.compile('%s|%s(?s)' % (
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/re/__init__.py", line 227, in compile
    return _compile(pattern, flags)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/re/__init__.py", line 279, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/re/_compiler.py", line 798, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/re/_parser.py", line 963, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/re/_parser.py", line 447, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/re/_parser.py", line 822, in _parse
    raise source.error('global flags not at the start '
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
re.error: global flags not at the start of the expression at position 994

Global inline flags (e.g. (?i)) can now only be used at the start of the regular expressions. Using them not at the start of expression was deprecated since Python 3.6. (Contributed by Serhiy Storchaka in bpo-47066.)

https://bugs.python.org/issue?@action=redirect&bpo=47066
https://docs.python.org/3.11/whatsnew/3.11.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/04175147-python-genshi/

For all our attempts to build python-genshi with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/python-genshi/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.11:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/

Let us know here if you have any questions.

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Felix Schwarz 2022-04-22 19:45:36 UTC
I just pushed genshi 0.7.7 to rawhide which possibly fixes the issues. Otherwise we might have to wait until https://github.com/edgewall/genshi/issues/62#issuecomment-1106532890 is fixed.

Comment 2 Miro Hrončok 2022-04-22 19:52:58 UTC
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/python-genshi/ says *succeeded*, thanks.