With Linux and macOS wheels, the bundled shared libraries have an embedded ABI version like libarrow.so.17 or libarrow.17.dylib and so linking to them with -larrow won't work unless we create symlinks at locations like site-packages/pyarrow/libarrow.so. This unfortunate workaround a
()
| 345 | |
| 346 | |
| 347 | def create_library_symlinks(): |
| 348 | """ |
| 349 | With Linux and macOS wheels, the bundled shared libraries have an embedded |
| 350 | ABI version like libarrow.so.17 or libarrow.17.dylib and so linking to them |
| 351 | with -larrow won't work unless we create symlinks at locations like |
| 352 | site-packages/pyarrow/libarrow.so. This unfortunate workaround addresses |
| 353 | prior problems we had with shipping two copies of the shared libraries to |
| 354 | permit third party projects like turbodbc to build their C++ extensions |
| 355 | against the pyarrow wheels. |
| 356 | |
| 357 | This function must only be invoked once and only when the shared libraries |
| 358 | are bundled with the Python package, which should only apply to wheel-based |
| 359 | installs. It requires write access to the site-packages/pyarrow directory |
| 360 | and so depending on your system may need to be run with root. |
| 361 | """ |
| 362 | import glob |
| 363 | if _sys.platform == 'win32': |
| 364 | return |
| 365 | package_cwd = _os.path.dirname(__file__) |
| 366 | |
| 367 | if _sys.platform == 'linux': |
| 368 | bundled_libs = glob.glob(_os.path.join(package_cwd, '*.so.*')) |
| 369 | |
| 370 | def get_symlink_path(hard_path): |
| 371 | return hard_path.rsplit('.', 1)[0] |
| 372 | else: |
| 373 | bundled_libs = glob.glob(_os.path.join(package_cwd, '*.*.dylib')) |
| 374 | |
| 375 | def get_symlink_path(hard_path): |
| 376 | return '.'.join((hard_path.rsplit('.', 2)[0], 'dylib')) |
| 377 | |
| 378 | for lib_hard_path in bundled_libs: |
| 379 | symlink_path = get_symlink_path(lib_hard_path) |
| 380 | if _os.path.exists(symlink_path): |
| 381 | continue |
| 382 | try: |
| 383 | _os.symlink(lib_hard_path, symlink_path) |
| 384 | except PermissionError: |
| 385 | print("Tried creating symlink {}. If you need to link to " |
| 386 | "bundled shared libraries, run " |
| 387 | "pyarrow.create_library_symlinks() as root") |
| 388 | |
| 389 | |
| 390 | def get_library_dirs(): |
nothing calls this directly
no test coverage detected