示例#1
0
	def __init__(self, target):
		system.System.__init__(self)
		# create some HELP:
		self.set_help("CXX: Generic C++ library")
		self.set_valid(True)
		if target.config["compilator"] == "clang":
			if target.board_id < 21:
				debug.error("Clang work only with the board wersion >= 21 : android 5.x.x")
				self.valid = False
				return
			self.add_flag("c++", "-D__STDCPP_LLVM__")
			# llvm is BSD-like licence
			self.add_path(os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "include"))
			if target.type_arch == "armv5":
				stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "libs", "armeabi")
				self.add_path(        os.path.join(stdCppBasePath, "include"))
				self.add_flag("link", os.path.join(stdCppBasePath, "libc++_static.a"))
			elif target.type_arch == "armv7":
				stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libs", "armeabi-v7a")
				self.add_path(        os.path.join(stdCppBasePath + "include"))
				self.add_flag("link", os.path.join(stdCppBasePath, "thumb", "libc++_static.a"))
			elif target.type_arch == "mips":
				stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "libs", "mips")
				self.add_path(        os.path.join(stdCppBasePath + "include"))
				self.add_flag("link", os.path.join(stdCppBasePath + "libc++_static.a"))
			elif target.type_arch == "x86":
				stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "libs", "x86")
				self.add_path(        os.path.join(stdCppBasePath, "include"))
				self.add_flag("link", os.path.join(stdCppBasePath, "libc++_static.a"))
			else:
				debug.warning("unknow architecture: '" + str(target.arch) + "'");
		else:
			self.add_flag("c++", "-D__STDCPP_GNU__")
			self.add_flag("c++-remove","-nostdlib")
			self.add_flag("need-libstdc++", True)
			# GPL v3 (+ exception link for gcc compilator)
			self.add_path(os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "include"))
			if target.type_arch == "armv5":
				stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "armeabi")
				self.add_path(        os.path.join(stdCppBasePath, "include"))
				self.add_flag("link", os.path.join(stdCppBasePath, "thumb", "libgnustl_static.a"))
				self.add_flag("link", os.path.join(stdCppBasePath, "thumb", "libsupc++.a"))
			elif target.type_arch == "armv7":
				stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "armeabi-v7a")
				self.add_path(        os.path.join(stdCppBasePath, "include"))
				self.add_flag("link", os.path.join(stdCppBasePath, "thumb", "libgnustl_static.a"))
				self.add_flag("link", os.path.join(stdCppBasePath, "thumb", "libsupc++.a"))
			elif target.type_arch == "mips":
				stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "mips")
				self.add_path(        os.path.join(stdCppBasePath, "include/"))
				self.add_flag("link", os.path.join(stdCppBasePath, "libgnustl_static.a"))
				self.add_flag("link", os.path.join(stdCppBasePath, "libsupc++.a"))
			elif target.type_arch == "x86":
				stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "x86")
				self.add_path(        os.path.join(stdCppBasePath, "include"))
				self.add_flag("link", os.path.join(stdCppBasePath, "libgnustl_static.a"))
				self.add_flag("link", os.path.join(stdCppBasePath, "libsupc++.a"))
			else:
				debug.warning("unknow architecture: '" + str(target.arch) + "'");
			debug.warning("plop")
示例#2
0
文件: image.py 项目: HeeroYui/lutin
def resize(src_file, dest_file, x, y, cmd_file=None):
	if os.path.exists(src_file) == False:
		debug.error("Request a resize an image that does not existed : '" + src_file + "'")
		return
	if enable_resize_image == False:
		debug.warning("Can not resize image missing pillow or CoreGraphics : '" + src_file + "' (just copy)")
		tools.copy_file(src_file, dest_file)
		return
	cmd_line = "resize Image : " + src_file + " ==> " + dest_file + " newSize=(" + str(x) + "x" + str(y) + ")"
	if depend.need_re_build(dest_file, src_file, file_cmd=cmd_file , cmd_line=cmd_line) == False:
		return
	# add cmdLine ...
	x = get_pow_2_multiple(x)
	extension = dest_file[dest_file.rfind('.'):]
	if platform.system() == "Darwin":
		source_image = CoreGraphics.CGImageImport(CoreGraphics.CGDataProviderCreateWithFilename(src_file))
		source_width = source_image.getWidth()
		source_height = source_image.getHeight()
		if source_width <= x:
			# for small image just copy:
			tools.copy_file(src_file, dest_file)
		else:
			if y <= 0:
				# keep ratio :
				y = int(float(x) * float(source_height) / float(source_width))
			y = get_pow_2_multiple(y)
			debug.print_element("resize Image (" + str(x) + "x" + str(y) + ")", src_file, "==>", dest_file)
			debug.debug("Resize image: " + src_file + " size=(" + str(source_width) + "x" + str(source_height) + ") -> (" + str(x) + "x" + str(y) + ")")
			source_image_rect = CoreGraphics.CGRectMake(0, 0, source_width, source_height)
			new_image = source_image.createWithImageInRect(source_image_rect)
			colors_space = CoreGraphics.CGColorSpaceCreateDeviceRGB()
			colors = CoreGraphics.CGFloatArray(5)
			context = CoreGraphics.CGBitmapContextCreateWithColor(x, y, colors_space, colors)
			context.setInterpolationQuality(CoreGraphics.kCGInterpolationHigh)
			new_image_rect = CoreGraphics.CGRectMake(0, 0, x, y)
			context.drawImage(new_image_rect, new_image)
			tools.create_directory_of_file(dest_file)
			if extension == ".jpeg":
				context.writeToFile(dest_file, CoreGraphics.kCGImageFormatJPEG)
			elif extension == ".png":
				context.writeToFile(dest_file, CoreGraphics.kCGImageFormatPNG)
			else:
				debug.error(" can not manage extention ... : " + dest_file)
	else:
		# open an image file (.bmp,.jpg,.png,.gif) you have in the working path
		im1 = Image.open(src_file)
		if im1.size[0] <= x:
			# for small image just copy:
			tools.copy_file(src_file, dest_file)
		else:
			if y <= 0:
				# keep ratio :
				y = int(float(x) * float(im1.size[1]) / float(im1.size[0]))
			y = get_pow_2_multiple(y)
			debug.print_element("resize Image (" + str(x) + "x" + str(y) + ")", src_file, "==>", dest_file)
			# use one of these filter options to resize the image
			tmpImage = im1.resize((x, y), Image.ANTIALIAS)
			tools.create_directory_of_file(dest_file)
			tmpImage.save(dest_file)
	tools.store_command(cmd_line, cmd_file)
示例#3
0
 def __init__(self, dest_option="", optionnal=False, desc=""):
     self.dest_option = dest_option
     if dest_option == "":
         debug.error("volatil argument must be store in an argument name")
     self.optionnal = optionnal
     self.description = desc
     self.count = 0
示例#4
0
	def __init__(self, target):
		system.System.__init__(self)
		# create some HELP:
		self.set_help("CXX: Generic C++ library")
		self.set_valid(True)
		# no check needed ==> just add this:
		self.add_depend([
		    'c',
		    'm',
		    'pthread'
		    ])
		self.add_flag("c++", "-D__STDCPP_GNU__")
		if env.get_isolate_system() == False:
			self.add_flag("c++-remove", "-nostdlib")
			self.add_flag("need-libstdc++", True)
		else:
			self.add_flag("link-lib", "stdc++")
			compilator_gcc = "g++"
			if target.config["compilator-version"] != "":
				compilator_gcc = compilator_gcc + "-" + target.config["compilator-version"]
			
			#get g++ compilation version :
			version_cpp = multiprocess.run_command_direct(compilator_gcc + " -dumpversion");
			if version_cpp == False:
				debug.error("Can not get the g++ version ...")
			
			self.add_header_file([
			    "/usr/include/c++/" + version_cpp + "/*"
			    ],
			    recursive=True)
示例#5
0
文件: macro.py 项目: HeeroYui/lutin
def load_macro(name):
	global __macro_list
	debug.debug("load macro: " + name)
	if len(__macro_list) == 0:
		debug.error("No macro to compile !!!")
	debug.debug("list macro: " + str(__macro_list))
	for mod in __macro_list:
		if mod[0] == name:
			debug.verbose("add to path: '" + os.path.dirname(mod[1]) + "'")
			sys.path.append(os.path.dirname(mod[1]))
			debug.verbose("import macro : '" + env.get_build_system_base_name() + __start_macro_name + name + "'")
			the_macro = __import__(env.get_build_system_base_name() + __start_macro_name + name)
			return the_macro
	raise KeyError("No entry for : " + name)
示例#6
0
def pool_synchrosize():
	global error_occured
	global error_execution
	if processor_availlable <= 1:
		#in this case : nothing to synchronise
		return
	
	debug.verbose("wait queue process ended\n")
	# Wait for queue to empty
	while not work_queue.empty() \
	      and error_occured == False:
		time.sleep(0.2)
		pass
	# Wait all thread have ended their current process
	while current_thread_working != 0 \
	      and error_occured == False:
		time.sleep(0.2)
		pass
	if error_occured == False:
		debug.verbose("queue is empty")
	else:
		un_init()
		debug.debug("Thread return with error ... ==> stop all the pool")
		if error_execution["id"] == -1:
			debug.error("Pool error occured ... (No return information on Pool)")
			return
		debug.error("Error in an pool element : [" + str(error_execution["id"]) + "]", crash=False)
		debug.debug(env.print_pretty(error_execution["cmd"]), force=True)
		debug.print_compilator(str(error_execution["out"][0]))
		debug.print_compilator(str(error_execution["err"][0]))
		if error_execution["return"] == 2:
			debug.error("can not compile file ... [keyboard interrrupt]")
		else:
			debug.error("can not compile file ... return value : " + str(error_execution["return"]))
示例#7
0
def run_command_no_lock_out(cmd_line):
	# prepare command line:
	args = shlex.split(cmd_line)
	debug.info("cmd = " + str(args))
	try:
		# create the subprocess
		p = subprocess.Popen(args)
	except subprocess.CalledProcessError as e:
		debug.error("subprocess.CalledProcessError : " + str(args))
		return
	#except:
	#	debug.error("Exception on : " + str(args))
	# launch the subprocess:
	p.communicate()
示例#8
0
文件: target.py 项目: HeeroYui/lutin
def load_target(name, config):
	global __target_list
	debug.debug("load target: " + name)
	if len(__target_list) == 0:
		debug.error("No target to compile !!!")
	debug.debug("list target: " + str(__target_list))
	for mod in __target_list:
		if mod[0] == name:
			debug.verbose("add to path: '" + os.path.dirname(mod[1]) + "'")
			sys.path.append(os.path.dirname(mod[1]))
			debug.verbose("import target : '" + env.get_build_system_base_name() + __start_target_name + name + "'")
			theTarget = __import__(env.get_build_system_base_name() + __start_target_name + name)
			#create the target
			tmpTarget = theTarget.Target(config)
			return tmpTarget
	raise KeyError("No entry for : " + name)
示例#9
0
文件: system.py 项目: HeeroYui/lutin
def load(target, lib_name, list_target_name):
	global __system_list
	find_target = False
	for target_name in list_target_name:
		if target_name in __system_list:
			find_target = True
	if find_target == False:
		debug.error("you must call this function after checking of the system exist() !1!")
		return
	for target_name in reversed(list_target_name):
		if target_name not in __system_list:
			continue
		for data in __system_list[target_name]:
			if data["name"] == lib_name:
				if data["exist"] == False:
					debug.error("you must call this function after checking of the system exist() !2!")
				if data["module"] == None:
					# create a module from the system interface...
					data["module"] = create_module_from_system(target, data)
					data["loaded"] = True
				target.add_module(data["module"])
				return
示例#10
0
文件: target.py 项目: HeeroYui/lutin
	def make_package(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
		debug.debug("make_package [START]")
		#The package generated depend of the type of the element:
		end_point_module_name = heritage_list.list_heritage[-1].name
		module = self.get_module(end_point_module_name)
		if module == None:
			debug.error("can not create package ... ");
		if module.get_type() == 'PREBUILD':
			#nothing to do ...
			return
		elif    module.get_type() == 'LIBRARY' \
		     or module.get_type() == 'LIBRARY_DYNAMIC' \
		     or module.get_type() == 'LIBRARY_STATIC':
			debug.info("Can not create package for library");
			return
		elif    module.get_type() == 'BINARY' \
		     or module.get_type() == 'BINARY_STAND_ALONE':
			self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = True)
		elif module.get_type() == 'BINARY_SHARED':
			self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False)
		elif module.get_type() == 'PACKAGE':
			self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False)
		debug.debug("make_package [STOP]")
		return
示例#11
0
def run_command_direct(cmd_line):
	# prepare command line:
	args = shlex.split(cmd_line)
	debug.verbose("cmd = " + str(args))
	try:
		# create the subprocess
		p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
	except subprocess.CalledProcessError as e:
		debug.error("subprocess.CalledProcessError : " + str(args))
	except:
		debug.error("Exception on : " + str(args))
	# launch the subprocess:
	output, err = p.communicate()
	if sys.version_info >= (3, 0):
		output = output.decode("utf-8")
		err = err.decode("utf-8")
	# Check error :
	if p.returncode == 0:
		if output == None:
			return err[:-1];
		return output[:-1];
	else:
		debug.warning("get an error cmd " + str(err))
		return False
示例#12
0
文件: target.py 项目: HeeroYui/lutin
	def set_cross_base(self, cross=""):
		self.cross = cross
		debug.debug("== Target='" + self.cross + "'");
		self.java = "javac"
		self.javah = "javah"
		self.jar = "jar"
		self.ar = self.cross + "ar"
		self.ranlib = self.cross + "ranlib"
		if self.config["compilator"] == "clang":
			self.cc = self.cross + "clang"
			self.xx = self.cross + "clang++"
			#self.ar=self.cross + "llvm-ar"
			self.ranlib=""
		else:
			self.cc = self.cross + "gcc"
			self.xx = self.cross + "g++"
			#self.ar=self.cross + "ar"
			#self.ranlib=self.cross + "ranlib"
		if self.config["compilator-version"] != "":
			self.cc = self.cc + "-" + self.config["compilator-version"]
			self.xx = self.xx + "-" + self.config["compilator-version"]
		
		#get g++ compilation version :
		ret = multiprocess.run_command_direct(self.xx + " -dumpversion");
		if ret == False:
			debug.error("Can not get the g++/clang++ version ...")
		self.xx_version = self.create_number_from_version_string(ret)
		debug.debug(self.config["compilator"] + "++ version=" + str(ret) + " number=" + str(self.xx_version))
		
		self.ld = self.cross + "ld"
		self.nm = self.cross + "nm"
		self.strip = self.cross + "strip"
		self.dlltool = self.cross + "dlltool"
		self._update_path_tree()
		
		#some static libraries that is sometime needed when not use stdlib ...
		ret = multiprocess.run_command_direct(self.xx + " -print-file-name=libgcc.a");
		if ret == False:
			debug.error("Can not get the g++/clang++ libgcc.a ...")
		self.stdlib_name_libgcc = ret;
		ret = multiprocess.run_command_direct(self.xx + " -print-file-name=libsupc++.a");
		if ret == False:
			debug.error("Can not get the g++/clang++ libsupc++.a ...")
		self.stdlib_name_libsupc = ret;
示例#13
0
	def __init__(self, config, sub_name=[]):
		#processor type selection (auto/arm/ppc/x86)
		if config["arch"] == "auto":
			config["arch"] = "arm"
		#bus size selection (auto/32/64)
		if config["bus-size"] == "auto":
			config["bus-size"] = "32"
		self.type_arch = ""
		target.Target.__init__(self, ["Android"] + sub_name, config, self.type_arch)
		
		if config["bus-size"] == "32":
			self.type_arch="armv7"
		else:
			self.type_arch="arm64"
		
		self.path_ndk = os.getenv('PROJECT_NDK', "AUTO")
		self.path_sdk = os.getenv('PROJECT_SDK', "AUTO")
		# auto search NDK
		if self.path_ndk == "AUTO":
			for path in os.listdir("."):
				if os.path.isdir(path)==True:
					if path=="android":
						self.path_ndk = path + "/ndk"
			if self.path_ndk == "AUTO":
				self.path_ndk = tools.get_run_path() + "/../android/ndk"
		# auto search SDK
		if self.path_sdk == "AUTO":
			for path in os.listdir("."):
				if os.path.isdir(path)==True:
					if path=="android":
						self.path_sdk = path + "/sdk"
			if self.path_sdk == "AUTO":
				self.path_sdk = tools.get_run_path() + "/../android/sdk"
		
		if not os.path.isdir(self.path_ndk):
			debug.error("NDK path not set !!! set env : PROJECT_NDK on the NDK path")
		if not os.path.isdir(self.path_sdk):
			debug.error("SDK path not set !!! set env : PROJECT_SDK on the SDK path")
		
		
		tmpOsVal = "64"
		gccVersion = "4.9"
		# TODO : Remove this or set it better ...
		self.compilator_version = gccVersion
		if host.BUS_SIZE==64:
			tmpOsVal = "_64"
		if self.config["compilator"] == "clang":
			self.set_cross_base(self.path_ndk + "/toolchains/llvm-3.6/prebuilt/linux-x86" + tmpOsVal + "/bin/")
			# Patch for LLVM AR tool
			self.ar = self.cross + "llvm-ar"
		else:
			basepathArm = self.path_ndk + "/toolchains/arm-linux-androideabi-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
			basepathMips = self.path_ndk + "/toolchains/mipsel-linux-android-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
			basepathX86 = self.path_ndk + "/toolchains/x86-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
			self.set_cross_base(basepathArm + "arm-linux-androideabi-")
			if not os.path.isdir(basepathArm):
				debug.error("Gcc Arm path does not exist !!!")
			if not os.path.isdir(basepathMips):
				debug.info("Gcc Mips path does not exist !!!")
			if not os.path.isdir(basepathX86):
				debug.info("Gcc x86 path does not exist !!!")
		
		# TODO : Set it back in the package only ...
		#self.path_bin="mustNotCreateBinary"
		#self.path_lib="data/lib/armeabi"
		#self.path_data="data/assets"
		#self.path_doc="doc"
		#self.suffix_package='.pkg'
		self.pkg_path_data = "data/assets"
		self.pkg_path_bin = "mustNotCreateBinary"
		self.pkg_path_lib = "data/lib/armeabi"
		self.pkg_path_license = "license"
		
		# If the env variable is not define, find the newest version of the BOARD_ID (Note: 0: autofind)
		self.board_id = int(os.getenv('PROJECT_NDK_BOARD_ID', "0"))
		if self.board_id != 0:
			# check if element existed :
			if not os.path.isdir(self.path_sdk +"/platforms/android-" + str(self.board_id)):
				debug.error("Specify PROJECT_NDK_BOARD_ID env variable and the BOARD_ID does not exit ... : " + str(self.board_id) + "==> auto-search")
				self.board_id = 0
		if self.board_id == 0:
			debug.debug("Auto-search BOARD-ID")
			for iii in reversed(range(0, 50)):
				debug.debug("try: " + os.path.join(self.path_sdk, "platforms", "android-" + str(iii)))
				if os.path.isdir(os.path.join(self.path_sdk, "platforms", "android-" + str(iii))):
					debug.debug("Find BOARD-ID : " + str(iii))
					self.board_id = iii
					break;
		if self.board_id == 0:
			debug.error("Can not find BOARD-ID ==> update your android SDK")
		
		self.add_flag("c", "-D__ANDROID_BOARD_ID__=" + str(self.board_id))
		if self.type_arch == "armv5" or self.type_arch == "armv7":
			self.global_include_cc.append("-I" + os.path.join(self.path_ndk, "platforms", "android-" + str(self.board_id), "arch-arm", "usr", "include"))
		elif self.type_arch == "mips":
			self.global_include_cc.append("-I" + os.path.join(self.path_ndk, "platforms", "android-" + str(self.board_id), "arch-mips", "usr", "include"))
		elif self.type_arch == "x86":
			self.global_include_cc.append("-I" + os.path.join(self.path_ndk, "platforms", "android-" + str(self.board_id), "arch-x86", "usr", "include"))
		
		self.global_include_cc.append("-I" + os.path.join(self.path_ndk, "sources", "android", "support", "include"))
		
		if self.config["compilator"] == "clang":
			self.global_include_cc.append("-gcc-toolchain " + os.path.join(self.path_ndk, "sources", "android", "support", "include"))
			if self.type_arch == "armv5":
				pass
			elif self.type_arch == "armv7":
				# The only one tested ... ==> but we have link error ...
				self.add_flag("c", [
				    "-target armv7-none-linux-androideabi",
				    "-march=armv7-a",
				    "-mfpu=vfpv3-d16",
				    "-mhard-float"
				    ])
				self.add_flag("link", [
				    "-target armv7-none-linux-androideabi",
				    "-Wl,--fix-cortex-a8",
				    "-Wl,--no-warn-mismatch",
				    "-lm_hard"
				    ])
			elif self.type_arch == "mips":
				pass
			elif self.type_arch == "x86":
				pass
		else:
			if self.type_arch == "armv5":
				pass
			elif self.type_arch == "armv7":
				pass
			elif self.type_arch == "mips":
				pass
			elif self.type_arch == "x86":
				pass
		
		self.sysroot = "--sysroot=" + os.path.join(self.path_ndk, "platforms", "android-" + str(self.board_id), "arch-arm")
		
		if True:
			self._mode_arm = "thumb"
		else:
			self._mode_arm = "arm"
		
		
		self.add_flag("c", [
		    "-D__ARM_ARCH_5__",
		    "-D__ARM_ARCH_5T__",
		    "-D__ARM_ARCH_5E__",
		    "-D__ARM_ARCH_5TE__"
		    ])
		if self.config["compilator"] != "clang":
			if self.type_arch == "armv5":
				# -----------------------
				# -- arm V5 :
				# -----------------------
				self.add_flag("c", [
				    "-march=armv5te",
				    "-msoft-float"
				    ])
			else:
				# -----------------------
				# -- arm V7 (Neon) :
				# -----------------------
				self.add_flag("c", [
				    "-m"+self._mode_arm,
				    "-mfpu=neon",
				    "-march=armv7-a",
				    "-mtune=cortex-a8",
				    "-mfloat-abi=softfp",
				    "-mvectorize-with-neon-quad",
				    "-D__ARM_ARCH_7__",
				    "-D__ARM_NEON__"
				    ])
				self.add_flag("link", [
				    "-mfpu=neon",
				    "-mfloat-abi=softfp",
				    "-Wl,--fix-cortex-a8",
				    ])
		"""
		self.add_flag("link-lib", [
		    "dl"
		    ])
		self.add_flag("link", [
		    "-rdynamic"
		    ])
		"""
		# the -mthumb must be set for all the android produc, some ot the not work coretly without this one ... (all android code is generated with this flags)
		#self.add_flag("c", "-mthumb")
		# -----------------------
		# -- Common flags :
		# -----------------------
		self.add_flag("c", "-fpic")
		if self.config["compilator"] != "clang":
			self.add_flag("c", [
			    "-ffunction-sections",
			    "-funwind-tables",
			    "-fstack-protector",
			    "-Wno-psabi",
			    #"-mtune=xscale",
			    "-fomit-frame-pointer",
			    "-fno-strict-aliasing"
			    ])
		self.add_flag("c++", [
		    "-frtti",
		    "-fexceptions",
		    "-Wa,--noexecstack"
		    ])
示例#14
0
def run_command(cmd_line, store_cmd_line="", build_id=-1, file="", store_output_file="", depend_data=None):
	global error_occured
	global exit_flag
	global current_id_execution
	global error_execution
	# prepare command line:
	args = shlex.split(cmd_line)
	debug.verbose("cmd = " + str(args))
	try:
		# create the subprocess
		p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
	except subprocess.CalledProcessError as e:
		debug.error("subprocess.CalledProcessError : TODO ...")
	except:
		debug.error("Exception on : " + str(args))
	# launch the subprocess:
	output, err = p.communicate()
	if sys.version_info >= (3, 0):
		output = output.decode("utf-8")
		err = err.decode("utf-8")
	# store error if needed:
	tools.store_warning(store_output_file, output, err)
	# Check error :
	if p.returncode == 0:
		debug.debug(env.print_pretty(cmd_line))
		queue_lock.acquire()
		if depend_data != None:
			depend.create_dependency_file(depend_data['file'], depend_data['data'])
		# TODO : Print the output all the time .... ==> to show warnings ...
		if build_id >= 0 and (output != "" or err != ""):
			debug.warning("output in subprocess compiling: '" + file + "'")
		if output != "":
			debug.print_compilator(output)
		if err != "":
			debug.print_compilator(err)
		queue_lock.release()
	else:
		error_occured = True
		exit_flag = True
		# if No ID : Not in a multiprocess mode ==> just stop here
		if build_id < 0:
			debug.debug(env.print_pretty(cmd_line), force=True)
			debug.print_compilator(output)
			debug.print_compilator(err)
			if p.returncode == 2:
				debug.error("can not compile file ... [keyboard interrrupt]")
			else:
				debug.error("can not compile file ... ret : " + str(p.returncode))
		else:
			# in multiprocess interface
			queue_lock.acquire()
			# if an other write an error before, check if the current process is started before ==> then is the first error
			if error_execution["id"] >= build_id:
				# nothing to do ...
				queue_lock.release()
				return;
			error_execution["id"] = build_id
			error_execution["cmd"] = cmd_line
			error_execution["return"] = p.returncode
			error_execution["err"] = err,
			error_execution["out"] = output,
			queue_lock.release()
		# not write the command file...
		return
	debug.verbose("done 3")
	# write cmd line only after to prevent errors ...
	tools.store_command(cmd_line, store_cmd_line)
示例#15
0
文件: target.py 项目: HeeroYui/lutin
	def __init__(self, name, config, arch):
		if tools.get_type_string(name) != "list":
			debug.error("You must define a name in a list ...")
		if len(name) < 1:
			debug.error("You must define a name for your target ...")
		## configuration of the build
		self.config = config
		
		if self.config["bus-size"] == "auto":
			debug.error("system error ==> must generate the default 'bus-size' config")
		if self.config["arch"] == "auto":
			debug.error("system error ==> must generate the default 'bus-size' config")
		
		debug.debug("config=" + str(config))
		if arch != "":
			self.arch = "-arch " + arch
		else:
			self.arch = ""
		
		self.end_generate_package = config["generate-package"]
		# todo : remove this :
		self._name = name[-1]
		self._config_based_on = name
		debug.info("=================================");
		debug.info("== Target='" + self._name + "' " + self.config["bus-size"] + " bits for arch '" + self.config["arch"] + "'");
		debug.info("== Target list=" + str(self._config_based_on))
		debug.info("=================================");
		
		self.set_cross_base()
		
		###############################################################################
		# Target global variables.
		###############################################################################
		self.global_include_cc=[]
		self.global_flags={}
		
		self.global_libs_ld=[]
		self.global_libs_ld_shared=[]
		
		self.suffix_cmd_line='.cmd'
		self.suffix_warning='.warning'
		self.suffix_dependence='.d'
		self.suffix_obj='.o'
		self.prefix_lib='lib'
		self.suffix_lib_static='.a'
		self.suffix_lib_dynamic='.so'
		self.suffix_binary=''
		self.suffix_package='.deb'
		
		self.path_generate_code="/generate_header"
		self.path_arch = "/" + self._name
		
		for elem in self._config_based_on:
			self.add_flag("c", '-D__TARGET_OS__' + elem)
		self.add_flag("c", [
		    '-D__TARGET_ARCH__' + self.config["arch"],
		    '-D__TARGET_ADDR__' + self.config["bus-size"] + 'BITS',
		    '-D_REENTRANT'
		    ])
		if     self.config["compilator"] == "clang" \
		   and self.xx_version >= 4002001: # >= 4.2.1
			self.add_flag("c++", "-Wno-undefined-var-template")
		self.add_flag("c", "-nodefaultlibs")
		self.add_flag("c++", "-nostdlib")
		# this disable the need to have the __cxa_guard_release
		self.add_flag("c++", "-fno-threadsafe-statics")
		#self.add_flag("c", "-nostdinc") #ignores standard C include directories
		#self.add_flag("c++", "-nostdinc++") #ignores standard C++ include directories
		self.add_flag("ar", 'rcs')
		
		if self._name == "Windows":
			self.add_flag("c++", [
			    '-static-libgcc',
			    '-static-libstdc++'
			    ])
		if "debug" == self.config["mode"]:
			self.add_flag("c", [
			    "-g",
			    "-DDEBUG"
			    ])
			if env.get_force_optimisation() == False:
				self.add_flag("c", "-O0")
			else:
				self.add_flag("c", "-O3")
		else:
			self.add_flag("c", [
			    "-DNDEBUG",
			    "-O3"
			    ])
		
		## To add code coverate on build result system
		if self.config["gcov"] == True:
			if self.config["compilator"] == "clang":
				self.add_flag("c", [
				    "--coverage"
				    ])
				self.add_flag("link", [
				    "--coverage"
				    ])
			else:
				self.add_flag("c", [
				    "-fprofile-arcs",
				    "-ftest-coverage"
				    ])
				self.add_flag("link", [
				    "-lgcov",
				    "--coverage"
				    ])
		
		self._update_path_tree()
		self.path_bin="bin"
		self.path_lib="lib"
		self.path_data="share"
		self.path_doc="doc"
		self.path_include="include"
		self.path_temporary_generate="generate"
		self.path_object="obj"
		
		
		self.build_done=[]
		self.build_tree_done=[]
		self.module_list=[]
		# output staging files list :
		self.list_final_file=[]
		
		self.sysroot=""
		
		self.action_on_state={}
		
		# set some default package path
		self.pkg_path_version_file = "version.txt"
		self.pkg_path_maintainer_file = "maintainer.txt"
		self.pkg_path_application_name_file = "appl_name.txt"
		self.pkg_path_application_description_file = "appl_description.txt"
		self.pkg_path_readme_file = "readme.txt"
		self.pkg_path_change_log_file = "changelog.txt"
		
		# special case for IOS (example) no build dynamicly ...
		self.support_dynamic_link = True
示例#16
0
文件: target.py 项目: HeeroYui/lutin
	def get_module(self, name):
		for mod in self.module_list:
			if mod.get_name() == name:
				return mod
		debug.error("the module '" + str(name) + "'does not exist/already build")
		return None
示例#17
0
文件: target.py 项目: HeeroYui/lutin
	def clean(self, name):
		for mod in self.module_list:
			if mod.get_name() == name:
				mod.clean(self)
				return
		debug.error("request to clean an un-existant module name : '" + name + "'")
示例#18
0
    def parse(self, start_position_parsing=1):
        list_argument = []  # composed of list element
        not_parse_next_element = False
        for iii in range(start_position_parsing, len(sys.argv)):
            self._last_element_parsed = iii
            # special case of parameter in some elements
            if not_parse_next_element == True:
                not_parse_next_element = False
                continue
            debug.verbose("parse [" + str(iii) + "]=" + sys.argv[iii])
            argument = sys.argv[iii]
            # check if we get a stop parsing element:
            if argument in self._list_element_stop:
                debug.warning("stop at position: " + str(iii))
                list_argument.append(ArgElement("", argument))
                break
            optionList = argument.split("=")
            debug.verbose(str(optionList))
            if type(optionList) == type(str()):
                option = optionList
            else:
                option = optionList[0]
            optionParam = argument[len(option) + 1:]
            debug.verbose(option)
            argument_found = False
            if option[:2] == "--":
                # big argument
                for prop in self.list_properties:
                    if prop.is_parsable() == False:
                        continue
                    if prop.get_option_big() == "":
                        continue
                    if prop.get_option_big() == option[2:]:
                        # find it
                        debug.verbose("find argument 2 : " + option[2:])
                        if prop.need_parameters() == True:
                            internalSub = option[2 +
                                                 len(prop.get_option_big()):]
                            if len(internalSub) != 0:
                                if len(optionParam) != 0:
                                    # wrong argument ...
                                    debug.warning(
                                        "maybe wrong argument for : '" +
                                        prop.get_option_big() + "' cmdLine='" +
                                        argument + "'")
                                    prop.display()
                                    continue
                                optionParam = internalSub
                            if len(optionParam) == 0:
                                #Get the next parameters
                                if len(sys.argv) > iii + 1:
                                    optionParam = sys.argv[iii + 1]
                                    not_parse_next_element = True
                                else:
                                    # missing arguments
                                    debug.warning(
                                        "parsing argument error : '" +
                                        prop.get_option_big() +
                                        "' Missing : subParameters ... cmdLine='"
                                        + argument + "'")
                                    prop.display()
                                    exit(-1)
                            if prop.check_availlable(optionParam) == False:
                                debug.warning(
                                    "argument error : '" +
                                    prop.get_option_big() +
                                    "' SubParameters not availlable ... cmdLine='"
                                    + argument + "' option='" + optionParam +
                                    "'")
                                prop.display()
                                exit(-1)
                            list_argument.append(
                                ArgElement(prop.get_option_big(), optionParam))
                            argument_found = True
                        else:
                            if len(optionParam) != 0:
                                debug.warning("parsing argument error : '" +
                                              prop.get_option_big() +
                                              "' need no subParameters : '" +
                                              optionParam + "'   cmdLine='" +
                                              argument + "'")
                                prop.display()
                            list_argument.append(
                                ArgElement(prop.get_option_big()))
                            argument_found = True
                        break
                if argument_found == False:
                    debug.error("UNKNOW argument : '" + argument + "'")
            elif option[:1] == "-":
                # small argument
                for prop in self.list_properties:
                    if prop.is_parsable() == False:
                        continue
                    if prop.get_option_small() == "":
                        continue
                    if prop.get_option_small(
                    ) == option[1:1 + len(prop.get_option_small())]:
                        # find it
                        debug.verbose("find argument 1 : " +
                                      option[1:1 +
                                             len(prop.get_option_small())])
                        if prop.need_parameters() == True:
                            internalSub = option[1 +
                                                 len(prop.get_option_small()):]
                            if len(internalSub) != 0:
                                if len(optionParam) != 0:
                                    # wrong argument ...
                                    debug.warning(
                                        "maybe wrong argument for : '" +
                                        prop.get_option_big() + "' cmdLine='" +
                                        argument + "'")
                                    prop.display()
                                    continue
                                optionParam = internalSub
                            if len(optionParam) == 0:
                                #Get the next parameters
                                if len(sys.argv) > iii + 1:
                                    optionParam = sys.argv[iii + 1]
                                    not_parse_next_element = True
                                else:
                                    # missing arguments
                                    debug.warning(
                                        "parsing argument error : '" +
                                        prop.get_option_big() +
                                        "' Missing : subParameters  cmdLine='"
                                        + argument + "'")
                                    prop.display()
                                    exit(-1)
                            if prop.check_availlable(optionParam) == False:
                                debug.warning(
                                    "argument error : '" +
                                    prop.get_option_big() +
                                    "' SubParameters not availlable ... cmdLine='"
                                    + argument + "' option='" + optionParam +
                                    "'")
                                prop.display()
                                exit(-1)
                            list_argument.append(
                                ArgElement(prop.get_option_big(), optionParam))
                            argument_found = True
                        else:
                            if len(optionParam) != 0:
                                debug.warning("parsing argument error : '" +
                                              prop.get_option_big() +
                                              "' need no subParameters : '" +
                                              optionParam + "'  cmdLine='" +
                                              argument + "'")
                                prop.display()
                            list_argument.append(
                                ArgElement(prop.get_option_big()))
                            argument_found = True
                        break

            if argument_found == False:
                # small argument
                for prop in self.list_properties:
                    if    prop.is_parsable() == True \
                       or prop.get_option_big() == "":
                        continue
                    if prop.need_parameters() == True:
                        list_argument.append(
                            ArgElement(prop.get_option_big(), argument))
                        argument_found = True
                        break
            if argument_found == False:
                #unknow element ... ==> just add in the list ...
                debug.verbose("unknow argument : " + argument)
                list_argument.append(ArgElement("", argument))

        for prop in self.list_properties:
            if    prop.is_parsable() == True \
               or prop.get_option_big() == "":
                continue
            if     prop.need_parameters() == True \
               and prop.optionnal == False:
                debug.error("Missing argument:" + prop.get_option_big())
        #for argument in list_argument:
        #	argument.display()
        #exit(0)
        return list_argument
示例#19
0
文件: target.py 项目: HeeroYui/lutin
	def run(self, pkg_name, option_list, binary_name = None):
		debug.debug("------------------------------------------------------------------------")
		debug.info("-- Run package '" + pkg_name + "' + option: " + str(option_list))
		debug.debug("------------------------------------------------------------------------")
		debug.error("action not implemented ...")
示例#20
0
def push_video_file(_path, _basic_key={}):
    file_name, file_extension = os.path.splitext(_path)
    debug.info("Send file: '" + file_name + "'  with extention " +
               file_extension)
    # internal file_extension ...
    if file_extension == "sha512":
        debug.verbose("file: '" + _path + "' sha512 extention ...")
        return True

    debug.info("Add media : '" + _path + "'")
    if     file_extension[1:] not in ["avi", "mkv", "mov", "mp4", "ts"] \
       and file_name not in ["cover_1.jpg","cover_1.png", "cover_1.till", "cover_1.bmp", "cover_1.tga"]:
        debug.warning("Not send file : " + _path +
                      " Not manage file_extension... " + file_extension)
        return False

    if file_name in [
            "cover_1.jpg", "cover_1.png", "cover_1.till", "cover_1.bmp",
            "cover_1.tga"
    ]:
        # find a cover...
        debug.warning("Not send cover Not managed ... : " + _path +
                      " Not manage ...")
        """
		debug.info("Send cover for: " + _basic_key["series-name"] + " " + _basic_key["saison"]);
		if _basic_key["series-name"] == "":
			debug.error("    ==> can not asociate at a specific seri");
			return False;
		
		etk::String groupName = _basic_key["series-name"];
		if _basic_key["saison"] != "":
			groupName += ":" + _basic_key["saison"];
		
		auto sending = _srv.setGroupCover(zeus::File::create(_path.getString(), ""), groupName);
		sending.onSignal(progressCallback);
		sending.waitFor(echrono::seconds(20000));
		"""
        return True
    """
	if etk::path::exist(_path + ".sha512") == True:
		debug.verbose("file sha512 exist ==> read it");
		uint64_t time_sha512 = get_modify_time(_path + ".sha512");
		uint64_t time_elem = get_modify_time(_path);
		storedSha512_file = file_read_data(_path + ".sha512")
		debug.verbose("file sha == " + storedSha512_file);
		if time_elem > time_sha512:
			debug.verbose("file time > sha time ==> regenerate new one ...");
			# check the current sha512 
			storedSha512 = calculate_sha512(_path);
			debug.verbose("calculated new sha'" + storedSha512 + "'");
			if storedSha512_file != storedSha512:
				# need to remove the old sha file
				auto idFileToRemove_fut = _srv.getId(storedSha512_file).waitFor(echrono::seconds(2));
				if idFileToRemove_fut.hasError() == True:
					debug.error("can not remove the remote file with sha " + storedSha512_file);
				else:
					debug.info("Remove old deprecated file: " + storedSha512_file);
					_srv.remove(idFileToRemove_fut.get());
					# note, no need to wait the call is async ... and the user does not interested with the result ...
				
			
			# store new sha512 ==> this update tile too ...
			file.open(etk::io::OpenMode::Write);
			file.writeAll(storedSha512);
			file.close();
		else:
			# store new sha512
			/*
			storedSha512 = file.readAllString();
			file.open(etk::io::OpenMode::Read);
			file.writeAll(storedSha512);
			file.close();
			*/
			storedSha512 = storedSha512_file;
			debug.verbose("read all sha from the file'" + storedSha512 + "'");
		
	else:
	"""
    """
	if True:
		storedSha512 = calculate_sha512(_path)
		file_write_data(_path + ".sha512", storedSha512);
		debug.info("calculate and store sha512 '" + storedSha512 + "'");
	debug.info("check file existance: sha='" + storedSha512 + "'");
	"""

    # push only if the file exist
    """
	# TODO : Check the metadata updating ...
	auto idFile_fut = _srv.getId(storedSha512).waitFor(echrono::seconds(2));
	if idFile_fut.hasError() == False:
		# media already exit ==> stop here ...
		return True;
	
	# TODO: Do it better ==> add the calback to know the push progression ...
	debug.verbose("Add File : " + _path + "    sha='" + storedSha512 + "'");
	auto sending = _srv.add(zeus::File::create(_path, storedSha512));
	sending.onSignal(progressCallback);
	debug.verbose("Add done ... now waiting  ... ");
	uint32_t mediaId = sending.waitFor(echrono::seconds(20000)).get();
	debug.verbose("END WAITING ... ");
	if mediaId == 0:
		debug.error("Get media ID = 0 With no error");
		return False;
	
	"""
    mime = magic.Magic(mime=True)
    mime_type = mime.from_file(_path)
    headers_values = {'filename': _path, 'mime-type': mime_type}
    result_send_data = requests.post("http://127.0.0.1:15080/data",
                                     headers=headers_values,
                                     data=upload_in_chunks(_path,
                                                           chunksize=4096))
    debug.info("result *********** : " + str(result_send_data) + "  " +
               result_send_data.text)
    file_name = os.path.basename(file_name)
    debug.info("Find file_name : '" + file_name + "'")
    # Remove Date (XXXX) or other titreadsofarle
    file_name, dates = extract_and_remove(file_name, '(', ')')
    have_date = False
    have_Title = False
    for it in dates:
        if len(it) == 0:
            continue
        if      it[0] == '0' \
             or it[0] == '1' \
             or it[0] == '2' \
             or it[0] == '3' \
             or it[0] == '4' \
             or it[0] == '5' \
             or it[0] == '6' \
             or it[0] == '7' \
             or it[0] == '8' \
             or it[0] == '9':
            # find a date ...
            if have_date == True:
                debug.info("                '" + file_name + "'")
                debug.error("Parse Date error : () : " + it +
                            " ==> multiple date")
                continue
            have_date = True
            _basic_key["date"] = it
        else:
            if have_Title == True:
                debug.info("                '" + file_name + "'")
                debug.error("Parse Title error : () : " + it +
                            " ==> multiple title")
                continue
            have_Title = True
            # Other title
            _basic_key.set["title2"] = it

    # Remove the actors [XXX YYY][EEE TTT]...
    file_name, actors = extract_and_remove(file_name, '[', ']')
    if len(actors) > 0:
        debug.info("                '" + file_name + "'")
        actor_list = []
        for it_actor in actors:
            if actor_list != "":
                actor_list += ";"
            actor_list.append(it_actor)
        _basic_key["actors"] = actor_list
    list_element_base = file_name.split('-')
    debug.warning("==> Title file: " + file_name)
    debug.warning("==> Title cut : " + str(list_element_base))

    list_element = []
    tmp_start_string = ""
    iii = 0
    while iii < len(list_element_base):
        if     list_element_base[iii][0] != 's' \
           and list_element_base[iii][0] != 'e':
            if tmp_start_string != "":
                tmp_start_string += '-'
            tmp_start_string += list_element_base[iii]
        else:
            list_element.append(tmp_start_string)
            tmp_start_string = ""
            while iii < len(list_element_base):
                list_element.append(list_element_base[iii])
                iii += 1
        iii += 1

    debug.warning("==> start elem: " + str(tmp_start_string))

    if tmp_start_string != "":
        list_element.append(tmp_start_string)

    debug.warning("==> list_element : " + str(list_element))

    if len(list_element) == 1:
        # nothing to do , it might be a film ...
        _basic_key["title"] = list_element[0]
    else:
        if     len(list_element) > 3 \
           and list_element[1][0] == 's' \
           and list_element[2][0] == 'e':
            debug.warning("Parse format: xxx-sXX-eXX-kjhlkjlkj(1234).*")
            # internal formalisme ...
            saison = -1
            episode = -1
            series_name = list_element[0]

            _basic_key["series-name"] = series_name
            full_episode_name = list_element[3]
            for yyy in range(4, len(list_element)):
                full_episode_name += "-" + list_element[yyy]

            _basic_key["title"] = full_episode_name
            if list_element[1][1:] == "XX":
                # saison unknow ... ==> nothing to do ...
                #saison = 123456789;
                pass
            else:
                saison = int(list_element[1][1:])

            if list_element[2][1:] == "XX":
                # episode unknow ... ==> nothing to do ...
                pass
            else:
                episode = int(list_element[2][1:])
                _basic_key["episode"] = int(episode)

            debug.info("Find a internal mode series: :")
            debug.info("    origin       : '" + file_name + "'")
            saisonPrint = "XX"
            episodePrint = "XX"
            if saison < 0:
                # nothing to do
                pass
            else:
                saisonPrint = str(saison)
                _basic_key["saison"] = saison

            if episode < 0:
                # nothing to do
                pass
            elif episode < 10:
                episodePrint = "0" + str(episode)
                _basic_key["episode"] = episode
            else:
                episodePrint = str(episode)
                _basic_key["episode"] = episode

            debug.info("     ==> '" + series_name + "-s" + saisonPrint + "-e" +
                       episodePrint + "-" + full_episode_name + "'")
        elif     len(list_element) > 2 \
             and list_element[1][0] == 'e':
            debug.warning("Parse format: xxx-eXX-kjhlkjlkj(1234).*")
            # internal formalisme ...
            saison = -1
            episode = -1
            series_name = list_element[0]

            _basic_key["series-name"] = series_name
            full_episode_name = list_element[2]
            for yyy in range(3, len(list_element)):
                full_episode_name += "-" + list_element[yyy]

            _basic_key["title"] = full_episode_name
            if list_element[1][1:] == "XX":
                # episode unknow ... ==> nothing to do ...
                pass
            else:
                episode = int(list_element[1][1:])
                _basic_key["episode"] = int(episode)

            debug.info("Find a internal mode series: :")
            debug.info("    origin       : '" + file_name + "'")
            saisonPrint = "XX"
            episodePrint = "XX"
            if episode < 0:
                # nothing to do
                pass
            elif episode < 10:
                episodePrint = "0" + str(episode)
                _basic_key["episode"] = episode
            else:
                episodePrint = str(episode)
                _basic_key["episode"] = episode

            debug.info("     ==> '" + series_name + "-s" + saisonPrint + "-e" +
                       episodePrint + "-" + full_episode_name + "'")

    result_send_data_json = json.loads(result_send_data.text)
    debug.info("pared meta data: " +
               json.dumps(_basic_key, sort_keys=True, indent=4))
    data_model = {
        "type_id": _basic_key["type"],
        "sha512": result_send_data_json["sha512"],
        #"group_id": int,
        "name": _basic_key["title"],
        # number of second
        "time": None,
    }
    for elem in ["date", "description", "episode"
                 ]:  #["actors", "date", "description", "episode", "title2"]:
        if elem in _basic_key.keys():
            data_model[elem] = _basic_key[elem]
    if "series-name" in _basic_key.keys():
        result_group_data = requests.post(
            "http://127.0.0.1:15080/group/find",
            data=json.dumps({"name": _basic_key["series-name"]},
                            sort_keys=True,
                            indent=4))
        debug.info("Create group ??? *********** : " + str(result_group_data) +
                   "  " + result_group_data.text)
        if result_group_data.status_code == 404:
            result_group_data = requests.post(
                "http://127.0.0.1:15080/group",
                data=json.dumps({"name": _basic_key["series-name"]},
                                sort_keys=True,
                                indent=4))
            debug.info("yes we create new group *********** : " +
                       str(result_group_data) + "  " + result_group_data.text)
        group_id = result_group_data.json()["id"]
        data_model["group_id"] = group_id
        if "saison" in _basic_key.keys():
            result_saison_data = requests.post(
                "http://127.0.0.1:15080/saison/find",
                data=json.dumps(
                    {
                        "number": _basic_key["saison"],
                        "group_id": group_id
                    },
                    sort_keys=True,
                    indent=4))
            debug.info("Create saison ??? *********** : " +
                       str(result_saison_data) + "  " +
                       result_saison_data.text)
            if result_saison_data.status_code == 404:
                result_saison_data = requests.post(
                    "http://127.0.0.1:15080/saison",
                    data=json.dumps(
                        {
                            "number": _basic_key["saison"],
                            "group_id": group_id
                        },
                        sort_keys=True,
                        indent=4))
                debug.info("yes we create new saison *********** : " +
                           str(result_saison_data) + "  " +
                           result_saison_data.text)
            saison_id = result_saison_data.json()["id"]
            data_model["saison_id"] = saison_id

    result_send_data = requests.post("http://127.0.0.1:15080/video",
                                     data=json.dumps(data_model,
                                                     sort_keys=True,
                                                     indent=4))
    debug.info("result *********** : " + str(result_send_data) + "  " +
               result_send_data.text)

    return True
示例#21
0
文件: target.py 项目: HeeroYui/lutin
	def show_log(self, pkg_name):
		debug.debug("------------------------------------------------------------------------")
		debug.info("-- Show log logcat '" + pkg_name + "'")
		debug.debug("------------------------------------------------------------------------")
		debug.error("action not implemented ...")
示例#22
0
文件: target.py 项目: HeeroYui/lutin
	def build(self, name, optionnal=False, actions=[], package_name=None):
		if    len(name.split("?")) != 1\
		   or len(name.split("@")) != 1:
			debug.error("need update")
		if actions == "":
			actions = ["build"]
		if actions == []:
			actions = ["build"]
		if type(actions) == str:
			actions = [actions]
		if name == "gcov":
			debug.info("gcov all")
			debug.error("must set the gcov parsing on a specific library or binary ==> not supported now for all")
		if name == "dump":
			debug.info("dump all")
			self.load_all()
			for mod in self.module_list:
				mod.display()
			return
		if name[:10] == "dependency":
			if len(name) > 10:
				rules = name.split(":")[1]
			else:
				rules = "LBDPK"
				# L for library
				# B for binary
				# D for Data
				# P for prebuild
				# K for package
			debug.print_element("dot", "", "---", "dependency.dot")
			self.load_all()
			tmp_file = open("dependency.dot", 'w')
			tmp_file.write('digraph G {\n')
			tmp_file.write('	rankdir=\"LR\";\n')
			for mod in self.module_list:
				mod.dependency_generate(self, tmp_file, 1, rules)
			# TODO : do it better ==> system library hook (do a oad of all avillable system library)
			tmp_file.write('	node [\n');
			tmp_file.write('		shape=square;\n');
			tmp_file.write('		style=filled;\n');
			tmp_file.write('		color=gray;\n');
			tmp_file.write('		];\n');
			# TODO : End hook
			for mod in self.module_list:
				mod.dependency_generate(self, tmp_file, 2, rules)
			tmp_file.write('}\n')
			tmp_file.flush()
			tmp_file.close()
			debug.print_element("dot", "", "---", "dependency.dot")
			return
		if name == "all":
			debug.info("build all")
			self.load_all()
			for mod in self.module_list:
				if self._name == "Android":
					if mod.get_type() == "PACKAGE":
						mod.build(self, package_name)
				else:
					if    mod.get_type() == "BINARY" \
					   or mod.get_type() == "PACKAGE":
						mod.build(self, package_name)
		elif name == "clean":
			debug.info("clean all")
			self.load_all()
			for mod in self.module_list:
				mod.clean(self)
		else:
			module_name = name
			action_list = actions
			for action_name in action_list:
				debug.verbose("requested : " + module_name + "?" + action_name + " [START]")
				ret = None;
				if action_name == "install":
					try:
						self.install_package(module_name)
					except AttributeError:
						debug.error("target have no 'install_package' instruction")
				elif action_name == "uninstall":
					try:
						self.un_install_package(module_name)
					except AttributeError:
						debug.error("target have no 'un_install_package' instruction")
				elif action_name[:3] == "run":
					"""
					if     mod.get_type() != "BINARY" \
					   and mod.get_type() != "PACKAGE":
						debug.error("Can not run other than 'BINARY' ... pakage='" + mod.get_type() + "' for module='" + module_name + "'")
					"""
					bin_name = None
					if len(action_name) > 3:
						if action_name[3] == '%':
							bin_name = ""
							for elem in action_name[4:]:
								if elem == ":":
									break;
								bin_name += elem
						# we have option:
						action_name2 = action_name.replace("\:", "1234COLUMN4321")
						option_list = action_name2.split(":")
						if len(option_list) == 0:
							if bin_name != None:
								debug.warning("action 'run' wrong options options ... : '" + action_name + "' might be separate with ':'")
							option_list = []
						else:
							option_list_tmp = option_list[1:]
							option_list = []
							for elem in option_list_tmp:
								option_list.append(elem.replace("1234COLUMN4321", ":"))
					else:
						option_list = []
					#try:
					self.run(module_name, option_list, bin_name)
					#except AttributeError:
					#	debug.error("target have no 'run' instruction")
				elif action_name == "log":
					try:
						self.show_log(module_name)
					except AttributeError:
						debug.error("target have no 'show_log' instruction")
				else:
					present = self.load_if_needed(module_name, optionnal=optionnal)
					if     present == False \
					   and optionnal == True:
						ret = [heritage.HeritageList(), False]
					else:
						for mod in self.module_list:
							debug.verbose("compare " + mod.get_name() + " == " + module_name)
							if mod.get_name() == module_name:
								if action_name[:4] == "dump":
									debug.info("dump module '" + module_name + "'")
									if len(action_name) > 4:
										debug.warning("action 'dump' does not support options ... : '" + action_name + "'")
									ret = mod.display()
									break
								elif action_name[:5] == "clean":
									debug.info("clean module '" + module_name + "'")
									if len(action_name) > 5:
										debug.warning("action 'clean' does not support options ... : '" + action_name + "'")
									ret = mod.clean(self)
									break
								elif action_name[:4] == "gcov":
									debug.debug("gcov on module '" + module_name + "'")
									if len(action_name) > 4:
										# we have option:
										option_list = action_name.split(":")
										if len(option_list) == 0:
											debug.warning("action 'gcov' wrong options options ... : '" + action_name + "' might be separate with ':'")
											option_list = []
										else:
											option_list = option_list[1:]
									else:
										option_list = []
									if "output" in option_list:
										ret = mod.gcov(self, generate_output=True)
									else:
										ret = mod.gcov(self, generate_output=False)
									break
								elif action_name[:5] == "build":
									if len(action_name) > 5:
										debug.warning("action 'build' does not support options ... : '" + action_name + "'")
									debug.debug("build module '" + module_name + "'")
									if optionnal == True:
										ret = [mod.build(self, package_name), True]
									else:
										ret = mod.build(self, package_name)
									break
						if     optionnal == True \
						   and ret == None:
							ret = [heritage.HeritageList(), False]
							break
						if ret == None:
							debug.error("not know module name : '" + module_name + "' to '" + action_name + "' it")
				debug.verbose("requested : " + module_name + "?" + action_name + " [STOP]")
			if len(action_list) == 1:
				return ret
示例#23
0
	def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
		debug.debug("------------------------------------------------------------------------")
		debug.info("Generate package '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"]))
		debug.debug("------------------------------------------------------------------------")
		#output path
		target_outpath = self.get_staging_path(pkg_name)
		tools.create_directory_of_file(target_outpath)
		
		## Create share datas:
		self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
		
		## copy binary files
		# in Android Package we have no binary element, only shared object ... (and java start file)
		
		## Create libraries (special case of Android...)
		copy_list={}
		target_outpath_lib = os.path.join(target_outpath, self.pkg_path_lib)
		tools.create_directory_of_file(target_outpath_lib)
		# copy application lib: (needed to lunch ...)
		file_src = self.get_build_file_dynamic(pkg_name)
		if os.path.isfile(file_src):
			debug.debug("      need copy: " + file_src + " to " + target_outpath_lib)
			tools.copy_file(file_src,
			                os.path.join(target_outpath_lib, os.path.basename(file_src)),
			                in_list=copy_list)
		# copy other if needed:
		if static == False:
			#copy all shared libsh...
			debug.verbose("libs for " + str(pkg_name) + ":")
			for heritage in heritage_list.list_heritage:
				debug.debug("sub elements: " + str(heritage.name))
				file_src = self.get_build_file_dynamic(heritage.name)
				debug.verbose("      has directory: " + file_src)
				if os.path.isfile(file_src):
					debug.debug("      need copy: " + file_src + " to " + target_outpath_lib)
					#copy all data:
					# TODO : We can have a problem when writing over library files ...
					tools.copy_file(file_src,
					                os.path.join(target_outpath_lib, os.path.basename(file_src)),
					                in_list=copy_list)
		#real copy files
		tools.copy_list(copy_list)
		if self.pkg_path_lib != "":
			# remove unneded files (NOT folder ...)
			tools.clean_directory(target_outpath_lib, copy_list)
		
		## Create generic files:
		self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
		
		## create specific android project (local)
		pkg_name_application_name = pkg_name
		if self.config["mode"] == "debug":
			pkg_name_application_name += "debug"
		#debug.info("ploppppp: " + str(pkg_properties))
		# FINAL_path_JAVA_PROJECT
		self.path_java_project = os.path.join(target_outpath,
		                                      "src")
		if pkg_properties["COMPAGNY_TYPE"] != "":
			self.path_java_project = os.path.join(self.path_java_project,
			                                      pkg_properties["COMPAGNY_TYPE"])
		if pkg_properties["COMPAGNY_NAME2"] != "":
			self.path_java_project = os.path.join(self.path_java_project,
			                                      pkg_properties["COMPAGNY_NAME2"])
		self.path_java_project = os.path.join(self.path_java_project,
		                                      pkg_name_application_name)
		#FINAL_FILE_ABSTRACTION
		self.file_final_abstraction = os.path.join(self.path_java_project, pkg_name_application_name + ".java")
		
		compleatePackageName = ""
		if pkg_properties["COMPAGNY_TYPE"] != "":
			compleatePackageName += pkg_properties["COMPAGNY_TYPE"] + "."
		if pkg_properties["COMPAGNY_NAME2"] != "":
			compleatePackageName += pkg_properties["COMPAGNY_NAME2"] + "."
		compleatePackageName += pkg_name_application_name
		
		if "ADMOD_ID" in pkg_properties:
			pkg_properties["RIGHT"].append("INTERNET")
			pkg_properties["RIGHT"].append("ACCESS_NETWORK_STATE")
		
		
		debug.print_element("pkg", "absractionFile", "<==", "dynamic file")
		# Create path :
		tools.create_directory_of_file(self.file_final_abstraction)
		# Create file :
		# java ==> done by ewol wrapper ... (and compiled in the normal compilation system ==> must be find in the dependency list of jar ...
		
		tools.create_directory_of_file(target_outpath + "/res/drawable/icon.png");
		if     "ICON" in pkg_properties.keys() \
		   and pkg_properties["ICON"] != "":
			image.resize(pkg_properties["ICON"], target_outpath + "/res/drawable/icon.png", 256, 256)
		else:
			# to be sure that we have all time a resource ...
			tmpFile = open(target_outpath + "/res/drawable/plop.txt", 'w')
			tmpFile.write('plop\n')
			tmpFile.flush()
			tmpFile.close()
		
		if pkg_properties["ANDROID_MANIFEST"]!="":
			debug.print_element("pkg", "AndroidManifest.xml", "<==", pkg_properties["ANDROID_MANIFEST"])
			tools.copy_file(pkg_properties["ANDROID_MANIFEST"], target_outpath + "/AndroidManifest.xml", force=True)
		else:
			debug.error("missing parameter 'ANDROID_MANIFEST' in the properties ... ")
		
		#add properties on wallpaper :
		# myModule.add_pkg("ANDROID_WALLPAPER_PROPERTIES", ["list", key, title, summary, [["key","value display"],["key2","value display 2"]])
		# myModule.add_pkg("ANDROID_WALLPAPER_PROPERTIES", ["list", "testpattern", "Select test pattern", "Choose which test pattern to display", [["key","value display"],["key2","value display 2"]]])
		# myModule.add_pkg("ANDROID_WALLPAPER_PROPERTIES", ["bool", key, title, summary, ["enable string", "disable String"])
		# myModule.add_pkg("ANDROID_WALLPAPER_PROPERTIES", ["bool", "movement", "Motion", "Apply movement to test pattern", ["Moving test pattern", "Still test pattern"]
		#copy needed resources :
		for res_source, res_dest in pkg_properties["ANDROID_RESOURCES"]:
			if res_source == "":
				continue
			tools.copy_file(res_source , target_outpath + "/res/" + res_dest + "/" + os.path.basename(res_source), force=True)
		
		
		# Doc :
		# http://asantoso.wordpress.com/2009/09/15/how-to-build-android-application-package-apk-from-the-command-line-using-the-sdk-tools-continuously-integrated-using-cruisecontrol/
		debug.print_element("pkg", "R.java", "<==", "Resources files")
		tools.create_directory_of_file(target_outpath + "/src/noFile")
		android_tool_path = self.path_sdk + "/build-tools/"
		# find android tool version
		dirnames = tools.get_list_sub_path(android_tool_path)
		if len(dirnames) == 0:
			debug.warning("This does not comport directory: '" + android_tool_path + "'")
			debug.error("An error occured when getting the tools for android")
		elif len(dirnames) > 1:
			dirnames = sorted(dirnames, reverse=True)
			debug.debug("sort tools directory: '" + str(dirnames) + "' ==> select : " + str(dirnames[0]))
		android_tool_path += dirnames[0] + "/"
		
		# this is to create resource file for android ... (we did not use aset in jar with ewol ...
		adModResoucepath = ""
		if "ADMOD_ID" in pkg_properties:
			adModResoucepath = " -S " + self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/res/ "
		cmdLine = android_tool_path + "aapt p -f " \
		          + "-M " + target_outpath + "/AndroidManifest.xml " \
		          + "-F " + target_outpath + "/resources.res " \
		          + "-I " + self.path_sdk + "/platforms/android-" + str(self.board_id) + "/android.jar "\
		          + "-S " + target_outpath + "/res/ " \
		          + adModResoucepath \
		          + "-J " + target_outpath + "/src/ "
		multiprocess.run_command(cmdLine)
		
		tools.create_directory_of_file(target_outpath + "/build/classes/noFile")
		debug.print_element("pkg", "*.class", "<==", "*.java")
		#generate android java files:
		filesString=""
		
		"""
		old : 
		if "ADMOD_ID" in pkg_properties:
			# TODO : check this I do not think it is really usefull ... ==> write for IDE only ...
			filesString += self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/src/android/UnusedStub.java "
		if len(pkg_properties["ANDROID_WALLPAPER_PROPERTIES"])!=0:
			filesString += self.path_java_project + pkg_name_application_name + "Settings.java "
		
		adModJarFile = ""
		if "ADMOD_ID" in pkg_properties:
			adModJarFile = ":" + self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar"
		
		cmdLine = "javac " \
		          + "-d " + self.get_staging_path(pkg_name) + "/build/classes " \
		          + "-classpath " + self.path_sdk + "/platforms/android-" + str(self.board_id) + "/android.jar" \
		          + adModJarFile + " " \
		          + filesString \
		          + self.file_final_abstraction + " "  \
		          + self.get_staging_path(pkg_name) + "/src/R.java "
		multiprocess.run_command(cmdLine)
		"""
		debug.verbose("heritage .so=" + str(tools.filter_extention(heritage_list.src['dynamic'], ["so"])))
		debug.verbose("heritage .jar=" + str(tools.filter_extention(heritage_list.src['src'], ["jar"])))
		
		class_extern = ""
		upper_jar = tools.filter_extention(heritage_list.src['src'], ["jar"])
		#debug.warning("ploppppp = " + str(upper_jar))
		for elem in upper_jar:
			if len(class_extern) > 0:
				class_extern += ":"
			class_extern += elem
		# create enpoint element :
		cmdLine = "javac " \
		          + "-d " + target_outpath + "/build/classes " \
		          + "-classpath " + class_extern + " " \
		          + target_outpath + "/src/R.java "
		multiprocess.run_command(cmdLine)
		
		debug.print_element("pkg", ".dex", "<==", "*.class")
		cmdLine = android_tool_path + "dx " \
		          + "--dex --no-strict " \
		          + "--output=" + target_outpath + "/build/" + pkg_name_application_name + ".dex " \
		          + target_outpath + "/build/classes/ "
		
		if "ADMOD_ID" in pkg_properties:
			cmdLine += self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar "
		# add element to dexification:
		for elem in upper_jar:
			# remove android sdk:
			if elem[-len("android.jar"):] != "android.jar":
				cmdLine += elem + " "
		
		multiprocess.run_command(cmdLine)
		
		debug.print_element("pkg", ".apk", "<==", ".dex, assets, .so, res")
		#builderDebug="-agentlib:jdwp=transport=dt_socket,server=y,address=8050,suspend=y "
		builderDebug=""
		# note : set -u not signed application...
		#+ ":" + self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar "
		cmdLine =   "java -Xmx128M " \
		          + " -classpath " + self.path_sdk + "/tools/lib/sdklib.jar " \
		          + builderDebug \
		          + " com.android.sdklib.build.ApkBuilderMain " \
		          + target_outpath + "/build/" + pkg_name_application_name + "-unalligned.apk " \
		          + " -u " \
		          + " -z " + target_outpath + "/resources.res " \
		          + " -f " + target_outpath + "/build/" + pkg_name_application_name + ".dex " \
		          + " -rf " + target_outpath + "/data "
		multiprocess.run_command(cmdLine)
		
		# doc :
		# http://developer.android.com/tools/publishing/app-signing.html
		# Create a key for signing your application:
		# keytool -genkeypair -v -keystore AndroidKey.jks -storepass Pass__AndroidDebugKey -alias alias__AndroidDebugKey -keypass PassKey__AndroidDebugKey -keyalg RSA -validity 36500
		if self.config["mode"] == "debug":
			debug.print_element("pkg", ".apk(signed debug)", "<==", ".apk (not signed)")
			# verbose mode : 
			#debugOption = "-verbose -certs "
			debugOption = ""
			cmdLine = "jarsigner " \
			    + debugOption \
			    + "-keystore " + tools.get_current_path(__file__) + "/AndroidDebugKey.jks " \
			    + " -sigalg SHA1withRSA -digestalg SHA1 " \
			    + " -storepass Pass__AndroidDebugKey " \
			    + " -keypass PassKey__AndroidDebugKey " \
			    + target_outpath + "/build/" + pkg_name_application_name + "-unalligned.apk " \
			    + " alias__AndroidDebugKey"
			multiprocess.run_command(cmdLine)
			tmpFile = open("tmpPass.boo", 'w')
			tmpFile.write("\n")
			tmpFile.flush()
			tmpFile.close()
		else:
			print("On release mode we need the file :  and key an pasword to sign the application ...")
			debug.print_element("pkg", ".apk(signed debug)", "<==", ".apk (not signed)")
			cmdLine = "jarsigner " \
			    + " -keystore " + pkg_properties["ANDROID_SIGN"] + " " \
			    + " -sigalg SHA1withRSA -digestalg SHA1 " \
			    + target_outpath + "/build/" + pkg_name_application_name + "-unalligned.apk " \
			    + " " + pkg_name_application_name
			multiprocess.run_command(cmdLine)
			cmdLine = "jarsigner " \
			    + " -verify -verbose -certs " \
			    + " -sigalg SHA1withRSA -digestalg SHA1 " \
			    + target_outpath + "/build/" + pkg_name_application_name + "-unalligned.apk "
			multiprocess.run_command(cmdLine)
		
		debug.print_element("pkg", ".apk(aligned)", "<==", ".apk (not aligned)")
		tools.remove_file(target_outpath + "/" + pkg_name_application_name + ".apk")
		# verbose mode : -v
		cmdLine = android_tool_path + "zipalign 4 " \
		          + target_outpath + "/build/" + pkg_name_application_name + "-unalligned.apk " \
		          + target_outpath + "/" + pkg_name_application_name + ".apk "
		multiprocess.run_command(cmdLine)
		
		# copy file in the final stage :
		tools.copy_file(target_outpath + "/" + pkg_name_application_name + ".apk",
		                self.get_final_path() + "/" + pkg_name_application_name + ".apk",
		                force=True)
示例#24
0
for elem in tmp_out:
    name = get_element_name(elem)
    if name not in list_of_library:
        list_of_library.append(name)
for elem in tmp_out:
    dependency = get_element_depend(elem)
    name = get_element_name(elem)
    for dep in dependency:
        if dep not in list_of_library:
            if dep not in missing_dependency:
                missing_dependency.append(dep)
            debug.info("Element:        '" + name + "'")
            debug.warning("    depends:    " + str(dependency))
            debug.warning("    missing:    " + str(dep))
if len(missing_dependency) != 0:
    debug.error("missing dependency: " + str(missing_dependency))

debug.info("======================================================")
debug.info("== Ordering elements")
debug.info("======================================================")
project_elements_ordered = []

max_loop = len(project_elements) * 10

while len(project_elements) != 0:
    max_loop -= 1
    if max_loop <= 0:
        debug.error("ERROR: Detect dependency loop...")
    debug.info("Order dependency: " + str(len(project_elements)) +
               "    ->    " + str(len(project_elements_ordered)))
    for elem in project_elements:
示例#25
0
文件: target.py 项目: HeeroYui/lutin
	def un_install_package(self, pkg_name):
		debug.debug("------------------------------------------------------------------------")
		debug.info("-- Un-Install package '" + pkg_name + "'")
		debug.debug("------------------------------------------------------------------------")
		debug.error("action not implemented ...")
示例#26
0
文件: host.py 项目: HeeroYui/lutin
## @license MPL v2.0 (see license file)
##
import platform
import sys
# Local import
from realog import debug

# print os.name # ==> 'posix'
if platform.system() == "Linux":
	OS = "Linux"
	HOST_DEFAULT_COMPILATOR = "gcc"
elif platform.system() == "Windows":
	OS = "Windows"
	HOST_DEFAULT_COMPILATOR = "gcc"
elif platform.system() == "Darwin":
	OS = "MacOs"
	HOST_DEFAULT_COMPILATOR = "clang"
else:
	debug.error("Unknow the Host OS ... '" + platform.system() + "'")

debug.debug("host.OS = " + OS)


if sys.maxsize > 2**32:
	BUS_SIZE = 64
else:
	BUS_SIZE = 32

debug.debug("host.BUS_SIZE = " + str(BUS_SIZE))

示例#27
0
        video = result_video.json()
        debug.info(indent_data + "- " + str(video["generated_name"]))
    else:
        debug.warning(indent_data + "get video id: " + str(elem_video_id) +
                      " !!!!!! " + str(result_video.status_code) + "")


# ****************************************************************************************
# **   Clear All the data base ...
# ****************************************************************************************
if requestAction == "clear":
    debug.info("============================================")
    debug.info("== Clear data base: ")
    debug.info("============================================")
    # TODO : Do it :
    debug.error("NEED to add check in cmd line to execute it ...")
    """
	uint32_t count = remoteServiceVideo.count().wait().get();
	debug.debug("have " + count + " medias");
	for (uint32_t iii=0; iii<count ; iii += 1024:
		uint32_t tmpMax = etk::min(iii + 1024, count);
		debug.debug("read section " + iii + " -> " + tmpMax);
		etk::Vector<uint32_t> list = remoteServiceVideo.getIds(iii,tmpMax).wait().get();
		zeus::FutureGroup groupWait;
		for (auto& it : list:
			debug.info("remove ELEMENT : " + it);
			groupWait.add(remoteServiceVideo.remove(it));
		groupWait.waitFor(echrono::seconds(2000));
	"""
    debug.info("============================================")
    debug.info("==              DONE                      ==")
示例#28
0
文件: target.py 项目: HeeroYui/lutin
	def build_tree(self, name, package_name):
		for mod in self.module_list:
			if mod.get_name() == name:
				mod.build_tree(self, package_name)
				return
		debug.error("request to build tree on un-existant module name : '" + name + "'")