Skip to content
Snippets Groups Projects
Commit f5720cc6 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

changes location of package data

this seems cleaner
parent 02d03e99
No related branches found
No related tags found
No related merge requests found
......@@ -51,7 +51,14 @@ project(TurTLE)
find_program(PYTHON_EXECUTABLE
python3)
execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/get_version.py OUTPUT_VARIABLE TURTLE_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/get_version.py
OUTPUT_VARIABLE TURTLE_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/get_version_long.py
OUTPUT_VARIABLE TURTLE_VERSION_LONG
OUTPUT_STRIP_TRAILING_WHITESPACE)
project(TurTLE
VERSION ${TURTLE_VERSION}
......@@ -479,6 +486,9 @@ if(EXISTS "${PROJECT_BINARY_DIR}/bash_setup_for_TurTLE.sh")
DESTINATION "lib/"
)
endif()
install(FILES "${PROJECT_SOURCE_DIR}/TurTLE/test/B32p1e4_checkpoint_0.h5" DESTINATION share/TurTLE-${TURTLE_VERSION_LONG})
install(DIRECTORY "${PROJECT_SOURCE_DIR}/TurTLE/test/particle_set" DESTINATION share/TurTLE-${TURTLE_VERSION_LONG}/)
install(DIRECTORY "${PROJECT_SOURCE_DIR}/TurTLE/test/profiler" DESTINATION share/TurTLE-${TURTLE_VERSION_LONG}/)
#####################################################################################
......
......@@ -36,10 +36,12 @@ try:
dist_loc = os.path.realpath(_dist.location)
lib_dir = os.path.join(dist_loc, 'TurTLE')
except:
__version__ = '@TURTLE_VERSION@'
__version__ = '@TURTLE_VERSION_LONG@'
dist_loc = None
lib_dir = None
data_dir = os.path.join('@CMAKE_INSTALL_PREFIX@', 'share/TurTLE-@TURTLE_VERSION_LONG@')
here = os.path.normcase(__file__)
homefolder = os.path.expanduser('~')
......
......@@ -11,8 +11,8 @@ import TurTLE._base
import TurTLE.DNS
from TurTLE._code import _code
cpp_location = os.path.join(os.path.join(
TurTLE.lib_dir, 'test'), 'profiler')
cpp_location = os.path.join(
TurTLE.data_dir, 'profiler')
class ADNS(TurTLE.DNS):
......
......@@ -11,8 +11,8 @@ import TurTLE._base
import TurTLE.DNS
from TurTLE._code import _code
cpp_location = os.path.join(os.path.join(
TurTLE.lib_dir, 'test'), 'particle_set')
cpp_location = os.path.join(
TurTLE.data_dir, 'particle_set')
class ADNS(TurTLE.DNS):
......
......@@ -20,7 +20,7 @@ def main():
['NSVE',
'-n', '32',
'--src-simname', 'B32p1e4',
'--src-wd', TurTLE.lib_dir + '/test',
'--src-wd', TurTLE.data_dir,
'--src-iteration', '0',
'--simname', 'dns_test',
'--np', '4',
......
......@@ -43,7 +43,7 @@ def basic_test():
c.simname = 'basic_cloud_test'
f0 = h5py.File(
os.path.join(
os.path.join(TurTLE.lib_dir, 'test'),
TurTLE.data_dir,
'B32p1e4_checkpoint_0.h5'),
'r')
ic_file = h5py.File(c.get_checkpoint_0_fname(), 'a')
......@@ -55,7 +55,7 @@ def basic_test():
'-n', '32',
'--src-simname', 'B32p1e4',
'--forcing_type', 'linear',
'--src-wd', TurTLE.lib_dir + '/test',
'--src-wd', TurTLE.data_dir,
'--src-iteration', '0',
'--simname', c.simname,
'--np', '4',
......@@ -70,7 +70,7 @@ def basic_test():
'--wd', './'])
f0 = h5py.File(
os.path.join(
os.path.join(TurTLE.lib_dir, 'test'),
TurTLE.data_dir,
'B32p1e4_checkpoint_0.h5'),
'r')
f1 = h5py.File(c.get_checkpoint_0_fname(), 'r')
......@@ -118,7 +118,7 @@ def nasty_test():
'--src-simname', 'B32p1e4',
'--simname', c.simname,
'--forcing_type', 'linear',
'--src-wd', TurTLE.lib_dir + '/test',
'--src-wd', TurTLE.data_dir,
'--src-iteration', '0',
'--np', '4',
'--ntpp', '2',
......
......@@ -27,7 +27,7 @@ def main():
['NSVEcomplex_particles',
'-n', '32',
'--src-simname', 'B32p1e4',
'--src-wd', TurTLE.lib_dir + '/test',
'--src-wd', TurTLE.data_dir,
'--src-iteration', '0',
'--np', '4',
'--ntpp', '1',
......
......@@ -49,7 +49,7 @@ def main_basic():
['NSVE',
'-n', '32',
'--src-simname', 'B32p1e4',
'--src-wd', TurTLE.lib_dir + '/test',
'--src-wd', TurTLE.data_dir,
'--src-iteration', '0',
'--simname', 'nsve_for_comparison',
'--np', '4',
......@@ -130,7 +130,7 @@ def main_long():
['NSVE',
'-n', '64',
'--src-simname', 'B32p1e4',
'--src-wd', TurTLE.lib_dir + '/test',
'--src-wd', TurTLE.data_dir,
'--src-iteration', '0',
'--simname', 'nsve_for_long_comparison',
'--np', '4',
......
......@@ -57,7 +57,7 @@ def main():
['NSVEparticles',
'-n', '32',
'--src-simname', 'B32p1e4',
'--src-wd', TurTLE.lib_dir + '/test',
'--src-wd', TurTLE.data_dir,
'--src-iteration', '0',
'--simname', 'dns_nsveparticles',
'--np', '4',
......@@ -75,7 +75,7 @@ def main():
sys.argv[1:])
f0 = h5py.File(
os.path.join(
os.path.join(TurTLE.lib_dir, 'test'),
TurTLE.data_dir,
'B32p1e4_checkpoint_0.h5'),
'r')
f1 = h5py.File(c.get_checkpoint_0_fname(), 'r')
......
################################################################################
# #
# Copyright 2019 Max Planck Institute for Dynamics and Self-Organization #
# #
# This file is part of TurTLE. #
# #
# TurTLE is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published #
# by the Free Software Foundation, either version 3 of the License, #
# or (at your option) any later version. #
# #
# TurTLE is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with TurTLE. If not, see <http://www.gnu.org/licenses/> #
# #
# Contact: Cristian.Lalescu@ds.mpg.de #
# #
################################################################################
import datetime
import subprocess
def main():
# get current time
now = datetime.datetime.now()
# obtain version
try:
git_branch = subprocess.check_output(['git',
'rev-parse',
'--abbrev-ref',
'HEAD']).strip().split()[-1].decode()
git_revision = subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip()
git_date = datetime.datetime.fromtimestamp(int(subprocess.check_output(['git', 'log', '-1', '--format=%ct']).strip()))
except:
git_revision = ''
git_branch = ''
git_date = now
if git_branch == '':
# there's no git available or something
VERSION = '{0:0>4}{1:0>2}{2:0>2}.{3:0>2}{4:0>2}{5:0>2}'.format(
git_date.year, git_date.month, git_date.day,
git_date.hour, git_date.minute, git_date.second)
VERSION_py = VERSION
else:
VERSION = subprocess.check_output(['git', 'describe', '--tags']).strip().decode().split('-')[0]
if (('develop' in git_branch) or
('feature' in git_branch) or
('bugfix' in git_branch)):
VERSION_py = subprocess.check_output(
['git', 'describe', '--tags', '--dirty']).strip().decode().replace('-g', '+g').replace('-dirty', '.dirty').replace('-', '.post')
else:
VERSION_py = VERSION
print(VERSION_py)
return VERSION_py
if __name__ == '__main__':
main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment