[CI][Conan] Unhandled TypeError in conanfile.py when ARROW_HOME is unset
- Lingua principale
- C++
- Stelle
- 17.1k
- Fork
- 4.3k
- Merge medio
- 3g 23h
- PR unite (30g)
- 101
Descrizione
### 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
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia da ci/conan/all/conanfile.py, in particolare dal metodo source(), nel ramo che copia le sorgenti locali. Riproduci il percorso con ARROW_HOME non impostato e verifica come vengono sollevate le eccezioni Conan nelle vicinanze. Il lavoro è completato quando la configurazione mancante produce una ConanException chiara invece di un TypeError.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- build-system, ci-cd
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 52/100