MCPcopy Create free account
hub / github.com/apache/arrow / _create_importable_pyarrow

Function _create_importable_pyarrow

python/scripts/update_stub_docstrings.py:221–246  ·  view source on GitHub ↗

Assemble an importable pyarrow package inside a temporary directory. During wheel builds the .py sources and compiled binary artifacts live in separate trees (source checkout vs CMake install prefix). This function symlinks (or copies) both into pyarrow_pkg folder so that a plain

(pyarrow_pkg, source_dir, install_pyarrow_dir)

Source from the content-addressed store, hash-verified

219
220
221def _create_importable_pyarrow(pyarrow_pkg, source_dir, install_pyarrow_dir):
222 """
223 Assemble an importable pyarrow package inside a temporary directory.
224
225 During wheel builds the .py sources and compiled binary artifacts live in
226 separate trees (source checkout vs CMake install prefix). This function
227 symlinks (or copies) both into pyarrow_pkg folder so that a plain
228 ``import pyarrow`` works and docstrings can be extracted at build time.
229 """
230 source_pyarrow = source_dir / "pyarrow"
231 if not source_pyarrow.exists():
232 raise FileNotFoundError(f"PyArrow source package not found: {source_pyarrow}")
233
234 for source_path in sorted(source_pyarrow.iterdir()):
235 if source_path.suffix == ".py":
236 _link_or_copy(source_path, pyarrow_pkg / source_path.name)
237 elif source_path.is_dir() and not source_path.name.startswith((".", "__")):
238 _link_or_copy(source_path, pyarrow_pkg / source_path.name)
239
240 for artifact in sorted(install_pyarrow_dir.iterdir()):
241 if not artifact.is_file() or artifact.suffix == ".pyi":
242 continue
243
244 destination = pyarrow_pkg / artifact.name
245 if not destination.exists():
246 _link_or_copy(artifact, destination)
247
248
249if __name__ == "__main__":

Callers 1

Calls 3

_link_or_copyFunction · 0.85
is_dirMethod · 0.80
is_fileMethod · 0.80

Tested by

no test coverage detected