use runtime_error instead of base exception and use arrow_home directly

This commit is contained in:
Thomas Fussell 2017-08-06 11:02:13 -07:00
parent 4cc9bee610
commit 474e802c40
2 changed files with 9 additions and 15 deletions

View File

@ -84,15 +84,8 @@ class build_ext(_build_ext):
cmake_options.append('-DPYARROW_CXXFLAGS="{0}"'
.format(self.cmake_cxxflags))
# ARROW-1090: work around CMake rough edges
if 'ARROW_HOME' in os.environ and sys.platform != 'win32':
pkg_config = pjoin(os.environ['ARROW_HOME'], 'lib',
'pkgconfig')
os.environ['PKG_CONFIG_PATH'] = pkg_config
del os.environ['ARROW_HOME']
cmake_options.append('-DCMAKE_BUILD_TYPE={0}'
.format(self.build_type.lower()))
.format(self.build_type))
if sys.platform != 'win32':
cmake_command = (['cmake', self.extra_cmake_args] +
@ -112,7 +105,9 @@ class build_ext(_build_ext):
print("-- Finished cmake --build for xlntpyarrow")
else:
import shlex
cmake_generator = 'Visual Studio 15 2017 Win64'
generator_args = []
if 'CMAKE_GENERATOR' in os.environ:
generator_args = ['-G', os.environ['CMAKE_GENERATOR']]
if not is_64_bit:
raise RuntimeError('Not supported on 32-bit Windows')
@ -120,9 +115,7 @@ class build_ext(_build_ext):
extra_cmake_args = shlex.split(self.extra_cmake_args)
cmake_command = (['cmake'] + extra_cmake_args +
cmake_options +
[source, '-G', cmake_generator])
if "-G" in self.extra_cmake_args:
cmake_command = cmake_command[:-2]
[source] + generator_args)
print("-- Runnning cmake for xlntpyarrow")
self.spawn(cmake_command)

View File

@ -21,6 +21,7 @@
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <exception>
#include <arrow/api.h>
#include <arrow/python/pyarrow.h>
#include <pybind11/pybind11.h>
@ -37,7 +38,7 @@ void import_pyarrow()
{
if (arrow::py::import_pyarrow() != 0)
{
throw std::exception("Import of pyarrow failed.");
throw std::runtime_error("Import of pyarrow failed.");
}
imported = true;
@ -155,7 +156,7 @@ std::unique_ptr<arrow::ArrayBuilder> make_array_builder(std::shared_ptr<arrow::D
break;
*/
default:
throw std::exception("not implemented");
throw std::runtime_error("not implemented");
}
return std::unique_ptr<arrow::ArrayBuilder>(builder);
@ -309,7 +310,7 @@ pybind11::handle read_batch(xlnt::streaming_workbook_reader &reader,
break;
*/
default:
throw std::exception("not implemented");
throw std::runtime_error("not implemented");
}
}