Skip to content

os.path.commonprefix deprecated in Python 3.15 #364

Open

Description

@stbergmann

I ran into this while building https://gerrit.collaboraoffice.com/online, as described at https://gerrit.collaboraoffice.com/c/online/+/15136 "external/gyp: Work around os.path.commonprefix deprecation in Python 3.15"

...which caused an --enable-werror (i.e., PYTHONWARNINGS=error) build against
python3-3.15.0~rc3-2.fc45.x86_64 to fail with

> NSPR [5/5] install ...
> Exception: os.path.commonprefix() is deprecated. Use os.path.commonpath() for longest path prefix.
> Traceback (most recent call last):
>   File ".../engine/workdir/UnpackedTarball/gyp/pylib/gyp/common.py", line 25, in __call__
>     return self.cache[args]
>            ~~~~~~~~~~^^^^^^
> KeyError: ('.../engine/workdir/UnpackedTarball/nss/nss', '.../engine/workdir/UnpackedTarball/nss/nss')
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File ".../engine/workdir/UnpackedTarball/gyp/pylib/gyp/input.py", line 524, in CallLoadTargetBuildFile
>     result = LoadTargetBuildFile(
>         build_file_path,
>     ...<6 lines>...
>         False,
>     )
>   File ".../engine/workdir/UnpackedTarball/gyp/pylib/gyp/input.py", line 379, in LoadTargetBuildFile
>     d = gyp.common.RelativePath(depth, os.path.dirname(build_file_path))
>   File ".../engine/workdir/UnpackedTarball/gyp/pylib/gyp/common.py", line 27, in __call__
>     result = self.func(*args)
>   File ".../engine/workdir/UnpackedTarball/gyp/pylib/gyp/common.py", line 161, in RelativePath
>     prefix_len = len(os.path.commonprefix([path_split, relative_to_split]))
>                      ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "<frozen genericpath>", line 109, in commonprefix
> DeprecationWarning: os.path.commonprefix() is deprecated. Use os.path.commonpath() for longest path prefix.
>
> make[1]: *** [.../engine/external/nss/ExternalProject_nss.mk:129: .../engine/workdir/ExternalProject/nss/build] Error 1

Activity

  1. cclauss commented on Oct 12, 2026

    @cclauss
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions