clean up setup.py and install to LIBRARY_PREFIX on Windows instead of PREFIX

This commit is contained in:
Thomas Fussell 2017-08-08 07:15:50 -07:00
parent 60319c19d7
commit b5e10a8dbe

View File

@ -86,10 +86,14 @@ class build_ext(_build_ext):
cmake_options.append('-DCMAKE_BUILD_TYPE={0}' cmake_options.append('-DCMAKE_BUILD_TYPE={0}'
.format(self.build_type)) .format(self.build_type))
cmake_options.append('-DCMAKE_INSTALL_PREFIX={0}'
.format(os.environ['PREFIX'])) if 'CMAKE_GENERATOR' in os.environ:
cmake_options.append('-G{}'
.format(os.environ['CMAKE_GENERATOR']))
if sys.platform != 'win32': if sys.platform != 'win32':
cmake_options.append('-DCMAKE_INSTALL_PREFIX={0}'
.format(os.environ['PREFIX']))
cmake_command = (['cmake', self.extra_cmake_args] + cmake_command = (['cmake', self.extra_cmake_args] +
cmake_options + [source]) cmake_options + [source])
@ -110,17 +114,14 @@ class build_ext(_build_ext):
print("-- Finished cmake --build for xlntpyarrow") print("-- Finished cmake --build for xlntpyarrow")
else: else:
import shlex import shlex
generator_args = []
if 'CMAKE_GENERATOR' in os.environ:
generator_args = ['-G', os.environ['CMAKE_GENERATOR']]
if not is_64_bit: if not is_64_bit:
raise RuntimeError('Not supported on 32-bit Windows') raise RuntimeError('Not supported on 32-bit Windows')
# Generate the build files cmake_options.append('-DCMAKE_INSTALL_PREFIX={0}'
.format(os.environ['LIBRARY_PREFIX']))
extra_cmake_args = shlex.split(self.extra_cmake_args) extra_cmake_args = shlex.split(self.extra_cmake_args)
cmake_command = (['cmake'] + extra_cmake_args + cmake_command = (['cmake'] + extra_cmake_args +
cmake_options + cmake_options + [source])
[source] + generator_args)
print("-- Runnning cmake for xlntpyarrow") print("-- Runnning cmake for xlntpyarrow")
self.spawn(cmake_command) self.spawn(cmake_command)
@ -150,9 +151,6 @@ class build_ext(_build_ext):
except OSError: except OSError:
pass pass
build_prefix = ['source'] + ([self.build_type] if sys.platform == 'win32' else [])
build_prefix = pjoin(*build_prefix)
self._found_names = [] self._found_names = []
built_path = self.get_ext_built('lib') built_path = self.get_ext_built('lib')
if not os.path.exists(built_path): if not os.path.exists(built_path):