Skip to content

[CI][Conan] Unhandled TypeError in conanfile.py when ARROW_HOME is unset #48855

@PythonicVarun

Description

@PythonicVarun

Describe the bug, including details regarding any error messages, version, and platform.

I encountered a potential unhandled TypeError in ci/conan/all/conanfile.py within the source() method.

Location:
https://github.com/apache/arrow/blob/main/ci/conan/all/conanfile.py#L290-L302

The Issue:
The logic block handling local source copying (when the version is not found in conan_data), the script retrieves ARROW_HOME from the environment:

top_level = os.environ.get("ARROW_HOME")
shutil.copytree(os.path.join(top_level, "cpp"),
                os.path.join(self.source_folder, "cpp"))
shutil.copytree(os.path.join(top_level, "format"),
                os.path.join(self.source_folder, "format"))

If the ARROW_HOME environment variable is not set, os.environ.get returns None. Consequently, passing None to os.path.join raises a TypeError (i.e., TypeError: expected str, bytes or os.PathLike object, not NoneType) rather than a descriptive error message indicating the missing configuration.

Expected Behavior: If ARROW_HOME is required for this build path but is missing, the script should explicitly check for None and raise a clear ConanException (like, "ARROW_HOME environment variable is required but not set") to improve the developer experience.

Proposal: I am happy to submit a PR to add a check for top_level is None and raise a proper exception. Please let me know if this is a desired improvement.

Component(s)

Continuous Integration, Packaging

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions