From f0c1fa827be3842a11b6b9520b2bef2542780e58 Mon Sep 17 00:00:00 2001 From: crouzet Date: Tue, 12 Nov 2019 10:58:04 +0100 Subject: [PATCH] integration patch pour version windows --- commands/package.py | 13 +++++++++---- src/environment.py | 3 ++- src/fileEnviron.py | 9 ++++++--- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/commands/package.py b/commands/package.py index 1e3ca2d..02a8e7d 100644 --- a/commands/package.py +++ b/commands/package.py @@ -42,6 +42,8 @@ PROJECT_DIR = "PROJECT" IGNORED_DIRS = [".git", ".svn"] IGNORED_EXTENSIONS = [] +PACKAGE_EXT=".tar.gz" # the extension we use for the packages + PROJECT_TEMPLATE = """#!/usr/bin/env python #-*- coding:utf-8 -*- @@ -354,7 +356,10 @@ def produce_relative_env_files(config, for_package = binaries_dir_name) # Little hack to put out_dir_Path as environment variable - src.replace_in_file(filepath, '"out_dir_Path', '"${out_dir_Path}' ) + if src.architecture.is_windows() : + src.replace_in_file(filepath, '"out_dir_Path', '"%out_dir_Path%' ) + else: + src.replace_in_file(filepath, '"out_dir_Path', '"${out_dir_Path}' ) # change the rights in order to make the file executable for everybody os.chmod(filepath, @@ -921,7 +926,7 @@ def make_archive(prod_name, prod_info, where): :return: The path of the resulting archive :rtype: str ''' - path_targz_prod = os.path.join(where, prod_name + ".tgz") + path_targz = os.path.join(dir_name, archive_name + PACKAGE_EXT) tar_prod = tarfile.open(path_targz_prod, mode='w:gz') local_path = prod_info.source_dir tar_prod.add(local_path, @@ -1329,7 +1334,7 @@ The procedure to do it is: if options.sources: f.write(src.template.substitute(readme_template_path_src, d)) - if options.binaries and options.sources: + if options.binaries and options.sources and not src.architecture.is_windows(): f.write(readme_compilation_with_binaries) if options.project: @@ -1503,7 +1508,7 @@ Please add it in file: logger.write("\n", 1) return 1 - path_targz = os.path.join(dir_name, archive_name + ".tgz") + path_targz = os.path.join(dir_name, archive_name + PACKAGE_EXT) src.printcolors.print_value(logger, "Package path", path_targz, 2) diff --git a/src/environment.py b/src/environment.py index d5a9811..5c4c11c 100644 --- a/src/environment.py +++ b/src/environment.py @@ -388,7 +388,8 @@ class SalomeEnviron: self.add_line(1) self.add_comment("reset these sensitive variables to avoid bad environment interactions") self.add_comment("comment these to lines if you wish a different behaviour") - self.set("LD_LIBRARY_PATH", "") + if not src.architecture.is_windows(): + self.set("LD_LIBRARY_PATH", "") self.set("PYTHONPATH", "") self.add_line(1) diff --git a/src/fileEnviron.py b/src/fileEnviron.py index b2feabe..d9ba063 100644 --- a/src/fileEnviron.py +++ b/src/fileEnviron.py @@ -476,6 +476,9 @@ class LauncherFileEnviron(FileEnviron): launcher_header=launcher_header2 else: launcher_header=launcher_header3 + # in case of Windows OS, Python scripts are not executable. PyExe ? + if src.architecture.is_windows(): + launcher_header = launcher_header.replace("#! /usr/bin/env python3",'') self.output.write(launcher_header\ .replace("BIN_KERNEL_INSTALL_DIR", self.bin_kernel_root_dir)) @@ -625,7 +628,7 @@ class LauncherFileEnviron(FileEnviron): def add_comment(self, comment): - # Special comment in case of the distène licence + # Special comment in case of the DISTENE licence if comment=="DISTENE license": self.output.write(self.indent+ "#"+ @@ -762,7 +765,7 @@ out_dir_Path=os.path.dirname(os.path.realpath(__file__)) # Preliminary work to initialize path to SALOME Python modules def __initialize(): - sys.path[:0] = [ 'BIN_KERNEL_INSTALL_DIR' ] # to get salomeContext + sys.path[:0] = [ r'BIN_KERNEL_INSTALL_DIR' ] # to get salomeContext # define folder to store omniorb config (initially in virtual application folder) try: @@ -836,7 +839,7 @@ out_dir_Path=os.path.dirname(os.path.realpath(__file__)) # Preliminary work to initialize path to SALOME Python modules def __initialize(): - sys.path[:0] = [ 'BIN_KERNEL_INSTALL_DIR' ] + sys.path[:0] = [ r'BIN_KERNEL_INSTALL_DIR' ] # define folder to store omniorb config (initially in virtual application folder) try: -- 2.39.2