diff --git a/CMakeLists.txt b/CMakeLists.txt index 082db384f8d3e69ea850d2ab5353f03424b19739..d5952f56710d5c669f907e693b8e115eb2b7144c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -498,6 +498,11 @@ configure_file( "${PROJECT_SOURCE_DIR}/TurTLE/__init__.py.in" "${PROJECT_SOURCE_DIR}/TurTLE/__init__.py" @ONLY) +# update setup.py +configure_file( + "${PROJECT_SOURCE_DIR}/setup.py.in" + "${PROJECT_BINARY_DIR}/python/setup.py" + @ONLY) # copy command install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/TurTLE ${PROJECT_BINARY_DIR}/python/TurTLE/)") if(EXISTS "${PROJECT_BINARY_DIR}/host_info.py") @@ -509,7 +514,7 @@ else() install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/pc_host_info.py ${PROJECT_BINARY_DIR}/python/TurTLE/host_info.py)") endif() endif() -install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/setup.py install --force --prefix=${CMAKE_INSTALL_PREFIX} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/python/)") +install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/python/setup.py install --force --prefix=${CMAKE_INSTALL_PREFIX} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/python/)") ##################################################################################### diff --git a/TurTLE/__init__.py.in b/TurTLE/__init__.py.in index 9193f4dd4f16fb90b066e6d4bf48802d9d537478..4c08dcecdbbf90e24cc693e3a2577e8d2b1bfbbd 100644 --- a/TurTLE/__init__.py.in +++ b/TurTLE/__init__.py.in @@ -24,28 +24,11 @@ import os -import sys -import pickle -import pkg_resources - -try: - __version__ = pkg_resources.require('TurTLE')[0].version - - _dist = pkg_resources.get_distribution('TurTLE') - dist_loc = os.path.realpath(_dist.location) - lib_dir = os.path.join(dist_loc, 'TurTLE') -except: - __version__ = '@TURTLE_VERSION_LONG@' - dist_loc = None - lib_dir = None +__version__ = '@TURTLE_VERSION_LONG@' data_dir = os.path.join('@CMAKE_INSTALL_PREFIX@', 'share/TurTLE-@TURTLE_VERSION_LONG@') -here = os.path.normcase(__file__) - -homefolder = os.path.expanduser('~') - from .host_info import host_info from .DNS import DNS diff --git a/setup.py b/setup.py.in similarity index 62% rename from setup.py rename to setup.py.in index a4f43074563d4f1a29226347a72bec13ca53bb6a..369f51430a095ae3132e27842d42197b7cac7d48 100644 --- a/setup.py +++ b/setup.py.in @@ -26,65 +26,20 @@ AUTHOR = 'Cristian C Lalescu' AUTHOR_EMAIL = 'Cristian.Lalescu@ds.mpg.de' -import os -import shutil -import datetime -import sys -import subprocess import pickle ### package versioning -import get_version -VERSION = get_version.main() +VERSION = '@TURTLE_VERSION_LONG@' print('This is TurTLE version ' + VERSION) - -import distutils.cmd - -class CompileLibCommand(distutils.cmd.Command): - description = 'Compile TurTLE library.' - user_options = [ - ('timing-output=', None, 'Toggle timing output.'), - ('fftw-estimate=', None, 'Use FFTW ESTIMATE.'), - ('split-fftw-many=', None, 'Turn on SPLIT_FFTW_MANY.'), - ('disable-fftw-omp=', None, 'Turn Off FFTW OpenMP.'), - ] - def initialize_options(self): - self.timing_output = 0 - self.fftw_estimate = 0 - self.disable_fftw_omp = 0 - self.split_fftw_many = 0 - return None - def finalize_options(self): - self.timing_output = (int(self.timing_output) == 1) - self.split_fftw_many = (int(self.split_fftw_many) == 1) - self.fftw_estimate = (int(self.fftw_estimate) == 1) - self.disable_fftw_omp = (int(self.disable_fftw_omp) == 1) - return None - def run(self): - ### save compiling information - pickle.dump( - {'install_date' : now, - 'VERSION' : VERSION, - 'git_revision' : git_revision}, - open('turtle/install_info.pickle', 'wb'), - protocol = 2) - return None - from setuptools import setup setup( name = 'TurTLE', packages = ['TurTLE', 'TurTLE/test'], install_requires = ['numpy>=1.8', 'h5py>=2.2.1'], - package_data = {'TurTLE': ['test/B32p1e4_checkpoint_0.h5', - 'test/particle_set/NSVEparticle_set.hpp', - 'test/particle_set/NSVEparticle_set.cpp', - 'test/profiler/scalar_evolution.hpp', - 'test/profiler/scalar_evolution.cpp', - 'test/profiler/Kraichnan_scalar_v1.hpp', - 'test/profiler/Kraichnan_scalar_v1.cpp', - ]}, + # package data is installed by CMake + #package_data = {'TurTLE': []}, entry_points = { 'console_scripts': [ 'turtle = TurTLE.__main__:main',