Skip to content

[P2] Linux source builds fail when git clean runs outside the dependency checkout #248

Description

@drebbe-intrepid

Bug

_build_libicsneo_linux runs git clean -xdf with cwd="libicsneo", although the cloned Git repository is at libicsneo//source. In an extracted source distribution there is no parent .git either, so the build fails before CMake.

Reviewed commit: 45167e09de6b886cd451a4245f842c8221349711 (current master on 2026-09-15).
Source: build_libicsneo.py:126

Reproduction

Create an extracted-source-style directory outside any Git checkout, with the dependency repository nested under libicsneo/0dd8dbf/source. Invoke _build_libicsneo_linux() from that directory. A focused reproduction (no downloads or hardware):

import importlib.util, os, pathlib, subprocess, tempfile
source = pathlib.Path('build_libicsneo.py').resolve()
root = pathlib.Path(tempfile.mkdtemp())
dependency = root/'libicsneo'/'0dd8dbf'/'source'
dependency.mkdir(parents=True)
subprocess.run(['git', 'init', '--quiet', str(dependency)], check=True)
os.chdir(root)
spec = importlib.util.spec_from_file_location('review_build', source)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
module._build_libicsneo_linux()

Observed / expected

The first command fails with exit 128: fatal: not a git repository (or any of the parent directories): .git. This focused Git-path reproduction was run on Windows; the Python command and Git repository-discovery behavior are the same in the Linux build path. A complete Linux source build was not run. Expected builds from source archives to work without a .git directory for python_ics itself.

Suggested fix and regression coverage

Clean only the intended dependency build directory, or run Git operations in LIBICSNEO_SOURCE if source cleaning is actually needed. Use the existing LIBICSNEO_BUILD path consistently. Add a Linux build check from an unpacked sdist with no parent .git.

Validation environment

Windows x64, CPython 3.14.5, extension rebuilt from the commit above. Hardware-dependent entry points below were exercised with a mock DLL, not a connected device. The existing 30 tests pass despite these findings.

Activity

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