]> SALOME platform Git repositories - tools/sat.git/commitdiff
Salome HOME
support github
authorNabil Ghodbane <nabil.ghodbane@cea.fr>
Mon, 18 Mar 2024 15:00:16 +0000 (16:00 +0100)
committerNabil Ghodbane <nabil.ghodbane@cea.fr>
Mon, 18 Mar 2024 15:00:16 +0000 (16:00 +0100)
commands/compile.py
commands/package.py
commands/prepare.py
commands/source.py
src/environment.py
src/product.py

index 0368549d190ccd9cae968da2f54b9d2a3aec09b2..afdad9b70f0373cc8ec628881a1d385767faf3e8 100644 (file)
@@ -168,6 +168,8 @@ def compile_all_products(sat, config, options, products_infos, all_products_dict
         if src.product.product_is_salome(p_info):
             check_salome_configuration=True
         
+        if config.APPLICATION.properties.github == 'yes' and src.product.product_test_property(p_info,"is_opensource", "no"):
+            continue
         # nothing to clean for native or fixed products
         if (not src.product.product_compiles(p_info)) or\
            src.product.product_is_native(p_info) or\
@@ -275,6 +277,10 @@ def compile_all_products(sat, config, options, products_infos, all_products_dict
             log_step(logger, header, "ignored")
             logger.write("\n", 3, False)
             continue
+        if config.APPLICATION.properties.github == 'yes' and src.product.product_test_property(p_info,"is_opensource", "no"):
+            log_step(logger, header, "ignored")
+            logger.write("\n", 3, False)
+            continue
 
         # Do nothing if the product is native
         if src.product.product_is_native(p_info):
@@ -303,7 +309,6 @@ def compile_all_products(sat, config, options, products_infos, all_products_dict
                 logger.write(_("Sources of product not found (try 'sat -h prepare') \n"))
                 res += 1 # one more error
                 continue
-        
         # if we don't force compilation, check if the was already successfully installed.
         # we don't compile in this case.
         if (not options.force) and src.product.check_installation(config, p_info):
@@ -311,12 +316,12 @@ def compile_all_products(sat, config, options, products_infos, all_products_dict
             logger.write(_(" in %s" % p_info.install_dir), 4)
             logger.write(_("\n"))
             continue
-        
+
         # If the show option was called, do not launch the compilation
         if options.no_compile:
             logger.write(_("Not installed in %s\n" % p_info.install_dir))
             continue
-        
+
         # Check if the dependencies are installed
         l_depends_not_installed = check_dependencies(config, p_name_info, all_products_dict)
         if len(l_depends_not_installed) > 0:
@@ -327,7 +332,7 @@ def compile_all_products(sat, config, options, products_infos, all_products_dict
                 logger.write(src.printcolors.printcError(prod_name + " "))
             logger.write("\n")
             continue
-        
+
         # Call the function to compile the product
         res_prod, len_end_line, error_step = compile_product(
              sat, p_name_info, config, options, logger, header, len_end_line)
@@ -744,7 +749,7 @@ def run(args, runner, logger):
                                 'directories of the products of '
                                 'the application %s\n') % 
                 src.printcolors.printcLabel(runner.cfg.VARS.application), 1)
-    
+
     info = [
             (_("SOURCE directory"),
              os.path.join(runner.cfg.APPLICATION.workdir, 'SOURCES')),
index f91476e2d6b6b87c7027b2a4ba37431b0af6de62..7ae351dd2ff8d345c9d9f1d1de7361e1ac7e8885 100644 (file)
@@ -685,6 +685,10 @@ def binary_package(config, logger, options, tmp_working_dir):
         if src.get_property_in_product_cfg(prod_info, "not_in_package") == "yes":
             continue
 
+        # skip product if github and product is not opensource
+        if config.APPLICATION.properties.github == "yes" and src.get_property_in_product_cfg(prod_info, "is_opensource") == "no":
+            continue
+
         # Add the sources of the products that have the property
         # sources_in_package : "yes"
         if src.get_property_in_product_cfg(prod_info,
@@ -992,6 +996,11 @@ def get_archives(config, logger):
         if (src.product.product_is_native(p_info)
                 or src.product.product_is_fixed(p_info)):
             continue
+
+        # skip product if github and product is not opensource
+        if config.APPLICATION.properties.github == "yes" and src.get_property_in_product_cfg(prod_info, "is_opensource") == "no":
+            continue
+
         if p_info.get_source == "archive":
             archive_path = p_info.archive_info.archive_name
             archive_name = os.path.basename(archive_path)
index 71a44a805b935d1dac409f7f2f6256675dd37a09..d147699addb5a1e0b76555c47f7eb0a5fce23573 100644 (file)
@@ -36,7 +36,6 @@ parser.add_option('c', 'complete', 'boolean', 'complete',
     _("Optional: completion mode, only prepare products not present in SOURCES dir."),
     False)
 
-
 def find_products_already_prepared(l_products):
     '''function that returns the list of products that have an existing source 
        directory.
@@ -92,13 +91,15 @@ def run(args, runner, logger):
     src.check_platform_is_supported( runner.cfg, logger )
 
     products_infos = src.product.get_products_list(options, runner.cfg, logger)
-
     # Construct the arguments to pass to the clean, source and patch commands
     args_appli = runner.cfg.VARS.application + " "  # useful whitespace
     if options.products:
         listProd = list(options.products)
     else: # no product interpeted as all products
         listProd = [name for name, tmp in products_infos]
+    if runner.cfg.APPLICATION.properties.github == 'yes':
+        not_opensource_products = [p for p in products_infos if src.product.product_is_not_opensource(p[1])]
+        listProd = [p for p in listProd if p not in [name for name, tmp in not_opensource_products]]
 
     if options.complete:
         # remove products that are already prepared 'completion mode)
@@ -156,7 +157,6 @@ Use the --force_patch option to overwrite it.
     args_clean = args_appli + args_product_opt_clean + " --sources"
     args_source = args_appli + args_product_opt  
     args_patch = args_appli + args_product_opt_patch
-      
     # Initialize the results to a running status
     res_clean = 0
     res_source = 0
index 832e484f0f032653e3522caa83bbfe2e58b87ef7..9ed87eddead89c1ad9ee8ce14794ea2c5898fa63 100644 (file)
@@ -86,11 +86,12 @@ def get_source_from_git(config,
     # The str to display
     coflag = 'git'
 
-    use_repo_dev=False
+    use_repo_dev = "APPLICATION" in config and "properties" in config.APPLICATION and "github" in config.APPLICATION.properties and not config.APPLICATION.properties.github == "yes"
     if ("APPLICATION" in config  and
             "properties"  in config.APPLICATION  and
             "repo_dev"    in config.APPLICATION.properties  and
-            config.APPLICATION.properties.repo_dev == "yes") :
+            config.APPLICATION.properties.repo_dev == "yes" and
+            use_repo_dev == True ) :
                 use_repo_dev=True
 
     # Get the repository address.
index a706d5deab31149f876575522860b92198d41b46..b928f937427cd65367c5deef6f437a96b351a6b0 100644 (file)
@@ -604,6 +604,10 @@ class SalomeEnviron:
         #    src.appli_test_property(self.cfg,"pip_install_dir", "python") ):
         #        return
 
+        # skip product if github and product is not opensource
+        if self.cfg.APPLICATION.properties.github == "yes" and src.get_property_in_product_cfg(pi, "is_opensource") == "no":
+            return
+
         # skip mesa products (if any) at run time, 
         # unless use_mesa property was activated
         if not self.forBuild:
index a679e44817d9d767140fbeb15f83076b0ed1fe5c..8bce492692caf74673d7cc9190659333e3a1d2e3 100644 (file)
@@ -1097,6 +1097,18 @@ def product_is_cpp(product_info):
             "cpp" in product_info.properties and
             product_info.properties.cpp == "yes")
 
+def product_is_not_opensource(product_info):
+    """Check if a given product is not open
+    
+    :param product_info Config: The configuration specific to 
+                               the product
+    :return: True if the product is an opensource, False otherwise
+    :rtype: boolean
+    """
+    return ("properties" in product_info and
+            "is_opensource" in product_info.properties and
+            product_info.properties.is_opensource == "no")
+
 def product_compiles(product_info):
     """\
     Know if a product compiles or not