You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2018/09/17 17:54:21 UTC
[arrow] branch master updated: ARROW-3183: [Python] Fix
get_library_dirs on Windows
This is an automated email from the ASF dual-hosted git repository.
wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new 6258e91 ARROW-3183: [Python] Fix get_library_dirs on Windows
6258e91 is described below
commit 6258e916b36dc05a078e5b852f68a759283f3ca6
Author: Victor Uriarte <vi...@intel.com>
AuthorDate: Mon Sep 17 13:54:02 2018 -0400
ARROW-3183: [Python] Fix get_library_dirs on Windows
Author: Victor Uriarte <vi...@intel.com>
Closes #2518 from vmuriart/ARROW-3183-Python-Fix-get_library_dirs and squashes the following commits:
a8e43035f <Victor Uriarte> Remove duplicating package_cwd
85efbdfe5 <Victor Uriarte> Check for the library existence before adding
32b2f2f1a <Victor Uriarte> Add two possible locations for binary files
8f99e8e99 <Victor Uriarte> Fix python_base_install
8d4d251fd <Victor Uriarte> Add test
6d24492f5 <Victor Uriarte> Refactor get_library_dirs Windows code
b1233e6cd <Victor Uriarte> Fix get_library_dirs on Windows
---
python/pyarrow/__init__.py | 9 +++++----
python/pyarrow/tests/test_misc.py | 8 ++++++++
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/python/pyarrow/__init__.py b/python/pyarrow/__init__.py
index bed5930..12d78c8 100644
--- a/python/pyarrow/__init__.py
+++ b/python/pyarrow/__init__.py
@@ -221,9 +221,10 @@ def get_library_dirs():
if _sys.platform == 'win32':
# TODO(wesm): Is this necessary, or does setuptools within a conda
# installation add Library\lib to the linker path for MSVC?
- site_packages, _ = _os.path.split(package_cwd)
- python_base_install, _ = _os.path.split(site_packages)
- library_dirs.append(_os.path.join(python_base_install,
- 'Library', 'lib'))
+ python_base_install = _os.path.dirname(_sys.executable)
+ library_lib = _os.path.join(python_base_install, 'Library', 'lib')
+
+ if _os.path.exists(_os.path.join(library_lib, 'arrow.lib')):
+ library_dirs.append(library_lib)
return library_dirs
diff --git a/python/pyarrow/tests/test_misc.py b/python/pyarrow/tests/test_misc.py
index 1c20614..58d5f7d 100644
--- a/python/pyarrow/tests/test_misc.py
+++ b/python/pyarrow/tests/test_misc.py
@@ -26,6 +26,14 @@ def test_get_include():
assert os.path.exists(os.path.join(include_dir, 'arrow', 'api.h'))
+@pytest.mark.skipif('sys.platform != "win32"')
+def test_get_library_dirs_win32():
+ library_dirs = pa.get_library_dirs()
+
+ library_lib = library_dirs[-1]
+ assert os.path.exists(os.path.join(library_lib, 'arrow.lib'))
+
+
def test_cpu_count():
n = pa.cpu_count()
assert n > 0