From 438ae93b7fbaa2dc51e1710e3f003ed5bca642f3 Mon Sep 17 00:00:00 2001 From: Nabil Ghodbane Date: Tue, 24 Aug 2021 09:41:47 +0200 Subject: [PATCH] spns #24320 : license header file approach --- products/MeshGems.pyconf | 19 ++++++++ products/env_scripts/MeshGems.py | 77 ++++++++++++++++++-------------- 2 files changed, 62 insertions(+), 34 deletions(-) diff --git a/products/MeshGems.pyconf b/products/MeshGems.pyconf index dad3860..9d8f722 100644 --- a/products/MeshGems.pyconf +++ b/products/MeshGems.pyconf @@ -35,6 +35,25 @@ default_win : } } +version_2_13_1 : +{ + properties : + { + is_distene : "no" + incremental : "yes" + } +} + +version_2_13_1_win : +{ + properties : + { + is_distene : "no" + incremental : "yes" + single_install_dir : "yes" # aimed to solve sat #18914 + } +} + version_2_9_6 : { } diff --git a/products/env_scripts/MeshGems.py b/products/env_scripts/MeshGems.py index 158b5c6..8ccf5f4 100644 --- a/products/env_scripts/MeshGems.py +++ b/products/env_scripts/MeshGems.py @@ -3,48 +3,57 @@ import os.path import platform +from distutils.version import LooseVersion def set_distene_licence(env): - try: - license_file = env.environ.get_value("LICENCE_FILE") - except Exception as e: - return - - if os.path.exists(license_file): - env.add_line(1) - env.add_comment("Set DISTENE License") - env.set('DISTENE_LICENSE_FILE', 'Use global envvar: DLIM8VAR') - - if os.access(license_file, os.R_OK): - lines = open(license_file, "r").readlines() - for line in lines: - id1=line.find('r"dlim8') - if id1 != -1: - # on a trouvé la clé dlim8 dans line, on extrait sa valeur - id2=line.find('"', id1+2) - if id2 != -1: - env.set("DLIM8VAR", line[id1+2:id2]) - break + try: + license_file = env.environ.get_value("LICENCE_FILE") + except Exception as e: + return + + if os.path.exists(license_file): + env.add_line(1) + env.add_comment("Set DISTENE License") + env.set('DISTENE_LICENSE_FILE', 'Use global envvar: DLIM8VAR') + + if os.access(license_file, os.R_OK): + lines = open(license_file, "r").readlines() + for line in lines: + id1=line.find('r"dlim8') + if id1 != -1: + # on a trouvé la clé dlim8 dans line, on extrait sa valeur + id2=line.find('"', id1+2) + if id2 != -1: + env.set("DLIM8VAR", line[id1+2:id2]) + break + return + +def set_DASSAULT_license(env, version): + env.add_comment("DASSAULT MeshGems KeyGenerator based License") + env.set('SALOME_MG_KEYGEN_LIB_PATH', '/home/salome/private/MeshGems/libSalomeMeshGemsKeyGenerator.so') + return def set_env(env, prereq_dir, version): - env.add_comment("Here you can define your license parameters for MeshGems") + env.add_comment("Here you can define your license parameters for MeshGems") + if LooseVersion(version) > LooseVersion('2.12-1'): + set_DASSAULT_license(env,version) + else: env.add_comment("DISTENE license") - if not env.forBuild: - # we don't need licence keys at compile time - set_distene_licence(env) + # we don't need licence keys at compile time + set_distene_licence(env) - env.set('MESHGEMSHOME', prereq_dir) - env.set('MESHGEMS_ROOT_DIR', prereq_dir) # update for cmake + env.set('MESHGEMSHOME', prereq_dir) + env.set('MESHGEMS_ROOT_DIR', prereq_dir) # update for cmake - env.prepend('PATH', os.path.join(prereq_dir, 'bin')) + env.prepend('PATH', os.path.join(prereq_dir, 'bin')) - if platform.system() == "Windows" : - env.prepend('PATH', os.path.join(prereq_dir, 'lib')) - else : - libdir = "Linux_64" - env.prepend('PATH', os.path.join(prereq_dir, 'bin', libdir)) - env.prepend('LD_LIBRARY_PATH', os.path.join(prereq_dir, 'lib', libdir)) + if platform.system() == "Windows" : + env.prepend('PATH', os.path.join(prereq_dir, 'lib')) + else : + libdir = "Linux_64" + env.prepend('PATH', os.path.join(prereq_dir, 'bin', libdir)) + env.prepend('LD_LIBRARY_PATH', os.path.join(prereq_dir, 'lib', libdir)) def set_nativ_env(env): - pass + pass -- 2.39.2