]> SALOME platform Git repositories - tools/sat.git/commitdiff
Salome HOME
support msys2 msys2
authorU-IDSI0\nghodban <nghodban@PO16920.IDSI0.si.c-s.fr>
Mon, 28 Oct 2024 10:16:22 +0000 (11:16 +0100)
committerU-IDSI0\nghodban <nghodban@PO16920.IDSI0.si.c-s.fr>
Mon, 28 Oct 2024 10:16:22 +0000 (11:16 +0100)
commands/config.py
src/architecture.py
src/compilation.py
src/internal_config/distrib.pyconf
src/internal_config/salomeTools_msys.pyconf [new file with mode: 0644]
src/product.py
src/system.py

index 3b9fb9cbc3ee580cd802f58f9257b709f223018b..bd6759cb429e6aa8f555b3a9c5d2a9db8eb2d49f 100644 (file)
@@ -267,6 +267,9 @@ class ConfigManager:
             if src.architecture.is_windows(): # special internal config for windows
                 internal_cfg = src.pyconf.Config(open( osJoin(cfg.VARS.srcDir,
                                         'internal_config', 'salomeTools_win.pyconf')))
+            elif src.architecture.is_msys2():
+                internal_cfg = src.pyconf.Config(open( osJoin(cfg.VARS.srcDir,
+                                        'internal_config', 'salomeTools_msys.pyconf')))                
             else:
                 internal_cfg = src.pyconf.Config(open( osJoin(cfg.VARS.srcDir,
                                         'internal_config', 'salomeTools.pyconf')))
index ad06c80e9ef6b819c62652dead451892a8f6498a..bc354784233d8661681c00a0e5fabd21e302b05a 100644 (file)
@@ -45,8 +45,19 @@ def is_windows():
       
     :rtype: boolean
     '''
-    return system() == 'Windows'
+    return system() == 'Windows' and not is_msys2()
 
+def is_msys2():
+    '''method that checks MSYS2
+      
+    :rtype: boolean
+    '''
+    try:
+        import distro
+        return  distro.id().startswith("mingw64_nt")
+    except Exception:
+        sys.exit(-1)
 def get_user():
     '''method that gets the username that launched sat  
     
@@ -74,6 +85,8 @@ def get_distribution(codes):
     '''
     if is_windows():
         return "W"
+    elif is_msys2():
+        return "mingw"
 
     # else get linux distribution description from platform, and encode it with code
     lin_distrib = linux_distribution()[0].lower()
@@ -117,7 +130,8 @@ def get_distrib_version(distrib):
 
     if is_windows():
         return release()
-
+    elif is_msys2():
+        return '-w64-x86_64'
     # get version from platform
     dist_version=linux_distribution()[1].split('.')
 
index ac2a55696054ecda2bd9aa36894f3b8beb7eedbf..59821dcea8ffa238bd916e647da6ae3854247fda 100644 (file)
@@ -507,6 +507,10 @@ CC=\\"hack_libtool\\"%g" libtool'''
             self.build_environ.set("SAT_VERBOSE", "1")
 
 
+    def list2cmdline(self, args): return ' '.join(map(
+        lambda a: a if a.lstrip().startswith('"') or '"' not in a else '"' + a + '"',
+            map(lambda a: subprocess.list2cmdline([a]), args)))
+
     def do_batch_script_build(self, script, nb_proc):
 
         if src.architecture.is_windows():
@@ -517,12 +521,13 @@ CC=\\"hack_libtool\\"%g" libtool'''
         self.log_command("  " + _("Run build script %s\n") % script)
         self.complete_environment(make_options)
         
-        res = subprocess.call(script
+        res = subprocess.call(self.list2cmdline([script])
                               shell=True,
                               stdout=self.logger.logTxtFile,
                               stderr=subprocess.STDOUT,
                               cwd=str(self.build_dir),
                               env=self.build_environ.environ.environ)
+        print("==",res)
 
         res_check=self.check_install()
         if res_check > 0 :
index 9476840b971b7b928b2be73e4a7a894b55d522c3..371be5905c5322263802749ad6c2f1b542f52fd7 100644 (file)
@@ -21,4 +21,5 @@ DISTRIBUTIONS :
   "linux mint": "UB"
   "opensuse":"OS"
   "Windows" : "W"
+  "msys2" : "mingw-w64-x86_64"
 }
diff --git a/src/internal_config/salomeTools_msys.pyconf b/src/internal_config/salomeTools_msys.pyconf
new file mode 100644 (file)
index 0000000..5642acb
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+
+INTERNAL :
+{   
+    sat_version : "5.3.0"
+    config :
+    {    
+        copy_prefix : "LOCAL_"
+        install_dir : "w64-x86-64"
+        binary_dir : "w64-x86-64"
+        single_install_dir : "PRODUCTS"
+    }
+    log :
+    {
+       not_shown_commands : ["log"]
+    }
+    command :
+    {
+        pip_download : "python3 -m pip download --disable-pip-version-check"
+        pip_install : "python3 -m pip install --disable-pip-version-check --no-index"
+    }
+}
+PRODUCTS :
+{
+}
index 8f49eb1ee31266be4f6aab576f976ce10eaf0b73..b60edc5b30c71793d0693718593e05914ad1b3a3 100644 (file)
@@ -1353,6 +1353,10 @@ def check_system_dep(distrib, check_cmd, product_info):
                 if "apt_dev" in additional_sysinfo:
                     for pkg in additional_sysinfo.apt_dev:
                         build_dep[pkg]=src.system.check_system_pkg(check_cmd,pkg)
+        if check_cmd[0]=="pacman":
+            if "pacman" in sysinfo:
+                for pkg in sysinfo.pacman:
+                    runtime_dep[pkg]=src.system.check_system_pkg(check_cmd,pkg)
 
     return runtime_dep,build_dep
 
index 7dbd2d3fc196d9dedb5c609136da8b496a59cbdc..2dfee2d1ad3585f305bca4aa3f54d73ba145f42d 100644 (file)
@@ -425,33 +425,37 @@ def get_pkg_check_cmd(dist_name):
 
     if dist_name in ["CO","FD","MG","MD","CO","OS"]: # linux using rpm
         linux="RH"  
-        manager_msg_err="Error : command failed because sat was not able to find apt command"
+        manager_msg_err="Error : command failed because sat was not able to find rpm command"
     else:
         linux="DB"
-        manager_msg_err="Error : command failed because sat was not able to find rpm command"
+        manager_msg_err="Error : command failed because sat was not able to find apt command"
 
     # 1- search for an installed package manager (rpm on rh, apt or dpkg-query on db)
     cmd_which_rpm  = ["which", "rpm"]
     cmd_which_apt  = ["which", "apt"]
     cmd_which_dpkg = ["which", "dpkg-query"]
-    with open(os.devnull, 'w') as devnull:
-        # 1) we search for apt (debian based systems)
-        completed=SP.call(cmd_which_dpkg,stdout=devnull, stderr=SP.STDOUT)
-        if completed==0 and linux=="DB":
-            cmd_is_package_installed = ["dpkg-query", "-l"]
-        else:
-            # 2) if dpkg not found search for apt
-            completed = SP.call(cmd_which_apt, stdout=devnull, stderr=SP.STDOUT)
-            if completed == 0 and linux == "DB":
-                cmd_is_package_installed = ["apt", "list", "--installed"]
-            else:
-                # 3) if apt not found search for rpm (redhat)
-                completed=SP.call(cmd_which_rpm,stdout=devnull, stderr=SP.STDOUT) # only 3.8! ,capture_output=True)
-                if completed==0 and linux=="RH":
-                    cmd_is_package_installed=["rpm", "-q"]
-                else:
-                    # no package manager was found corresponding to dist_name
-                    raise src.SatException(manager_msg_err)
+    cmd_which_pacman = ["which", "pacman"]
+    if src.architecture.is_msys2():
+       cmd_is_package_installed = ["pacman", "-Q"]
+    else:
+      with open(os.devnull, 'w') as devnull:
+          # 1) we search for apt (debian based systems)
+          completed=SP.call(cmd_which_dpkg,stdout=devnull, stderr=SP.STDOUT)
+          if completed==0 and linux=="DB":
+              cmd_is_package_installed = ["dpkg-query", "-l"]
+          else:
+              # 2) if dpkg not found search for apt
+              completed = SP.call(cmd_which_apt, stdout=devnull, stderr=SP.STDOUT)
+              if completed == 0 and linux == "DB":
+                  cmd_is_package_installed = ["apt", "list", "--installed"]
+              else:
+                  # 3) if apt not found search for rpm (redhat)
+                  completed=SP.call(cmd_which_rpm,stdout=devnull, stderr=SP.STDOUT) # only 3.8! ,capture_output=True)
+                  if completed==0 and linux=="RH":
+                      cmd_is_package_installed=["rpm", "-q"]
+                  else:
+                      # no package manager was found corresponding to dist_name
+                      raise src.SatException(manager_msg_err)
     return cmd_is_package_installed
 
 def check_system_pkg(check_cmd,pkg):