[CI][Conan] Unhandled TypeError in conanfile.py when ARROW_HOME is unset
- Dominant language
- C++
- Stars
- 17.1k
- Forks
- 4.3k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 88
Description
### 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:
```python
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
Contributor guide
Assessment
This issue has not been assessed yet.