Bug 2327997

Summary: python-pdm-backend fails to build with Python 3.14: subprocess.CalledProcessError: Command '[PosixPath('/usr/bin/hg'), 'commit', '-m', 'Add a', PosixPath('/tmp/tmp05tv6lt6/test.txt')]' returned non-zero exit status 255.
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-pdm-backendAssignee: Lumír Balhar <lbalhar>
Status: CLOSED NOTABUG QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: ksurma, lbalhar, mhroncok, python-packagers-sig
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-11-25 08:54:07 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: 2322407    

Description Karolina Surma 2024-11-22 10:34:47 UTC
python-pdm-backend fails to build with Python 3.14.0a2.

_ ERROR at setup of test__get_version_from_scm__selects_by_tag_filter_on_different_commits[hg-1] _

request = <SubRequest 'scm' for <Function test__get_version_from_scm__selects_by_tag_filter_on_different_commits[hg-1]>>
scm_dir = PosixPath('/tmp/tmp05tv6lt6')

    @pytest.fixture(params=["git", "hg"])
    def scm(request: pytest.FixtureRequest, scm_dir: Path) -> Scm:
        scm = cast(Scm, request.getfixturevalue(request.param))
    
        file_path = scm_dir / "test.txt"
        with open(file_path, "w") as f:
            f.write("a\n")
    
>       scm.commit("Add a", [file_path])

tests/pdm/backend/hooks/version/test_scm.py:175: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/pdm/backend/hooks/version/test_scm.py:129: in commit
    self.run("commit", "-m", commit_message, *files)
tests/pdm/backend/hooks/version/test_scm.py:65: in run
    result = subprocess.run(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

input = None, capture_output = True, timeout = None, check = True
popenargs = ([PosixPath('/usr/bin/hg'), 'commit', '-m', 'Add a', PosixPath('/tmp/tmp05tv6lt6/test.txt')],)
kwargs = {'cwd': PosixPath('/tmp/tmp05tv6lt6'), 'encoding': 'utf-8', 'stderr': -1, 'stdout': -1}
process = <Popen: returncode: 255 args: [PosixPath('/usr/bin/hg'), 'commit', '-m', 'Ad...>
stdout = ''
stderr = "no username found, using 'mockbuild' instead\nabort: cannot import name 'ByteString' from 'typing' (/usr/lib64/python3.14/typing.py)\n"
retcode = 255

    def run(*popenargs,
            input=None, capture_output=False, timeout=None, check=False, **kwargs):
        """Run command with arguments and return a CompletedProcess instance.
    
        The returned instance will have attributes args, returncode, stdout and
        stderr. By default, stdout and stderr are not captured, and those attributes
        will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them,
        or pass capture_output=True to capture both.
    
        If check is True and the exit code was non-zero, it raises a
        CalledProcessError. The CalledProcessError object will have the return code
        in the returncode attribute, and output & stderr attributes if those streams
        were captured.
    
        If timeout is given, and the process takes too long, a TimeoutExpired
        exception will be raised.
    
        There is an optional argument "input", allowing you to
        pass bytes or a string to the subprocess's stdin.  If you use this argument
        you may not also use the Popen constructor's "stdin" argument, as
        it will be used internally.
    
        By default, all communication is in bytes, and therefore any "input" should
        be bytes, and the stdout and stderr will be bytes. If in text mode, any
        "input" should be a string, and stdout and stderr will be strings decoded
        according to locale encoding, or by "encoding" if set. Text mode is
        triggered by setting any of text, encoding, errors or universal_newlines.
    
        The other arguments are the same as for the Popen constructor.
        """
        if input is not None:
            if kwargs.get('stdin') is not None:
                raise ValueError('stdin and input arguments may not both be used.')
            kwargs['stdin'] = PIPE
    
        if capture_output:
            if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
                raise ValueError('stdout and stderr arguments may not be used '
                                 'with capture_output.')
            kwargs['stdout'] = PIPE
            kwargs['stderr'] = PIPE
    
        with Popen(*popenargs, **kwargs) as process:
            try:
                stdout, stderr = process.communicate(input, timeout=timeout)
            except TimeoutExpired as exc:
                process.kill()
                if _mswindows:
                    # Windows accumulates the output in a single blocking
                    # read() call run on child threads, with the timeout
                    # being done in a join() on those threads.  communicate()
                    # _after_ kill() is required to collect that and add it
                    # to the exception.
                    exc.stdout, exc.stderr = process.communicate()
                else:
                    # POSIX _communicate already populated the output so
                    # far into the TimeoutExpired exception.
                    process.wait()
                raise
            except:  # Including KeyboardInterrupt, communicate handled that.
                process.kill()
                # We don't call process.wait() as .__exit__ does that for us.
                raise
            retcode = process.poll()
            if check and retcode:
>               raise CalledProcessError(retcode, process.args,
                                         output=stdout, stderr=stderr)
E               subprocess.CalledProcessError: Command '[PosixPath('/usr/bin/hg'), 'commit', '-m', 'Add a', PosixPath('/tmp/tmp05tv6lt6/test.txt')]' returned non-zero exit status 255.

/usr/lib64/python3.14/subprocess.py:577: CalledProcessError
=========================== short test summary info ============================
ERROR tests/pdm/backend/hooks/version/test_scm.py::test__get_version_from_scm__returns_tag_if_method_unspecified[hg]
ERROR tests/pdm/backend/hooks/version/test_scm.py::test__get_version_from_scm__adds_details_if_project_is_dirty[hg]
ERROR tests/pdm/backend/hooks/version/test_scm.py::test__get_version_from_scm__returns_version_if_tag_has_v[hg]
ERROR tests/pdm/backend/hooks/version/test_scm.py::test__get_version_from_scm__returns_default_if_tag_cannot_be_parsed[hg]
ERROR tests/pdm/backend/hooks/version/test_scm.py::test__get_version_from_scm__tag_regex[hg]
ERROR tests/pdm/backend/hooks/version/test_scm.py::test__get_version_from_scm__selects_by_tag_filter_on_same_commit[hg-0]
ERROR tests/pdm/backend/hooks/version/test_scm.py::test__get_version_from_scm__selects_by_tag_filter_on_same_commit[hg-1]
ERROR tests/pdm/backend/hooks/version/test_scm.py::test__get_version_from_scm__selects_by_tag_filter_on_different_commits[hg-0]
ERROR tests/pdm/backend/hooks/version/test_scm.py::test__get_version_from_scm__selects_by_tag_filter_on_different_commits[hg-1]
=================== 77 passed, 1 skipped, 9 errors in 7.62s ====================

https://docs.python.org/3.14/whatsnew/3.14.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08292238-python-pdm-backend/

For all our attempts to build python-pdm-backend with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/python-pdm-backend/

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.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
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 Miro Hrončok 2024-11-22 11:01:28 UTC
stderr = "no username found, using 'mockbuild' instead\nabort: cannot import name 'ByteString' from 'typing' (/usr/lib64/python3.14/typing.py)\n"

Is this coming from mercurial (/usr/bin/hg)?

Comment 2 Miro Hrončok 2024-11-22 11:26:52 UTC
It is. See also bz2328011.

Comment 3 Lumír Balhar 2024-11-25 08:54:07 UTC
I have prepared a fix for mercurial, built it in the COPR and it fixed the problem with this package.

PR for mercurial: https://src.fedoraproject.org/rpms/mercurial/pull-request/22
Build of this package: https://copr.fedorainfracloud.org/coprs/g/python/python3.14/build/8309861/