# from sat product infos, represent the product dependencies in a simple python graph
# keys are nodes, the list of dependencies are values
-def get_dependencies_graph(p_infos):
+def get_dependencies_graph(p_infos, compile_time=True):
graph={}
for (p_name,p_info) in p_infos:
- graph[p_name]=p_info.depend
+ depprod=[]
+ for d in p_info.depend:
+ depprod.append(d)
+ if compile_time and "build_depend" in p_info:
+ for d in p_info.build_depend:
+ depprod.append(d)
+ graph[p_name]=depprod
return graph
# this recursive function calculates all the dependencies of node start
# store at beginning compile time products, we need to compile them before!
for n in sorted_nodes:
if n in products_list:
- if src.product.product_is_compile_time(all_products_dict[n][1]) or\
- src.product.product_is_compile_and_runtime(all_products_dict[n][1]):
- product_list_compiletime.append(n)
- else:
- product_list_runtime.append(n)
- sorted_product_list = product_list_compiletime + product_list_runtime
+ sorted_product_list.append(n)
logger.write("Sorted list of products to compile : %s\n" % sorted_product_list, 5)
# from the sorted list of products to compile, build a sorted list of products infos
products_infos.append(all_products_dict[product])
# for all products to compile, store in "depend_all" field the complete dependencies (recursive)
- # (will be used by check_dependencies funvtion)
+ # (will be used by check_dependencies function)
for pi in products_infos:
dep_prod=[]
dep_prod=depth_search_graph(all_products_graph,pi[0], dep_prod)
if "opt_depend" in pinfo:
src.printcolors.print_value(logger, "optional", sorted(pinfo.opt_depend), 2)
+ if "build_depend" in pinfo:
+ src.printcolors.print_value(logger, "build depend on", sorted(pinfo.build_depend), 2)
+
+
# information on pyconf
logger.write("\n", 2)
logger.write(src.printcolors.printcLabel("configuration:") + "\n", 2)
self.cfg.APPLICATION.products,
self.cfg)
- all_products_graph=get_dependencies_graph(all_products_infos)
+ all_products_graph=get_dependencies_graph(all_products_infos, self.forBuild)
visited_nodes=[]
sorted_nodes=[]
for n in all_products_graph:
sorted_nodes)
self.sorted_product_list=sorted_nodes
- # store the list of compile time products
- # they should be added in build env
- compile_time_products=[]
- for (pname,pinfo) in all_products_infos:
- if src.product.product_is_compile_time(pinfo) or\
- src.product.product_is_compile_and_runtime(pinfo) :
- compile_time_products.append(pname)
- self.compile_time_products=compile_time_products
-
def append(self, key, value, sep=os.pathsep):
"""\
self.set_a_product("Python", logger)
self.set_python_libdirs()
- # for a build environment, add compile time products (like cmake)
- if self.forBuild :
- for product in self.compile_time_products:
- if product == "Python":
- continue
- self.set_a_product(product, logger)
-
# The loop on the products
for product in self.sorted_product_list:
if product == "Python":
continue
- if self.forBuild and product in self.compile_time_products:
- continue
self.set_a_product(product, logger)
def set_full_environ(self, logger, env_info):
self.set_a_product("Python", logger)
self.set_python_libdirs()
- # for a build environment, add compile time products (like cmake)
- if self.forBuild :
- for product in self.compile_time_products:
- if product == "Python":
- continue
- self.set_a_product(product, logger)
-
# set products
for product in sorted_product_list:
if product == "Python":
continue
- if self.forBuild and product in self.compile_time_products:
- continue
self.set_a_product(product, logger)
class FileEnvWriter:
res.addMapping(p_info.name, src.pyconf.Mapping(res), "")
res[p_info.name]= p_info.version
- for prod_name in p_info.depend:
+ depprod=[]
+ for d in p_info.depend:
+ depprod.append(d)
+ if "build_depend" in p_info:
+ for d in p_info.build_depend:
+ depprod.append(d)
+ for prod_name in depprod:
if prod_name not in res:
res.addMapping(prod_name, src.pyconf.Mapping(res), "")
prod_dep_info = src.product.get_product_config(config, prod_name, False)
:return: the list of products in dependence
:rtype: list
"""
- if "depend" not in product_info or product_info.depend == []:
+ depend_all=[]
+ if "depend" in product_info:
+ for d in product_info.depend:
+ depend_all.append(d)
+ if "build_depend" in product_info:
+ for d in product_info.build_depend:
+ depend_all.append(d)
+
+ if len(depend_all) == 0:
return []
+
res = []
- for prod in product_info.depend:
+ for prod in depend_all:
if prod == product_info.name:
continue
if prod not in res: