예제 #1
0
	def load_special_tools(self, var, ban=[]):
		"""
		Loads third-party extensions modules for certain programming languages
		by trying to list certain files in the extras/ directory. This method
		is typically called once for a programming language group, see for
		example :py:mod:`waflib.Tools.compiler_c`

		:param var: glob expression, for example 'cxx\_\*.py'
		:type var: string
		:param ban: list of exact file names to exclude
		:type ban: list of string
		"""
		if os.path.isdir(waf_dir):
			lst = self.root.find_node(waf_dir).find_node('waflib/extras').ant_glob(var)
			for x in lst:
				if not x.name in ban:
					load_tool(x.name.replace('.py', ''))
		else:
			from zipfile import PyZipFile
			waflibs = PyZipFile(waf_dir)
			lst = waflibs.namelist()
			for x in lst:
				if not re.match('waflib/extras/%s' % var.replace('*', '.*'), var):
					continue
				f = os.path.basename(x)
				doban = False
				for b in ban:
					r = b.replace('*', '.*')
					if re.match(r, f):
						doban = True
				if not doban:
					f = f.replace('.py', '')
					load_tool(f)
예제 #2
0
 def load_special_tools(self, var, ban=[]):
     global waf_dir
     if os.path.isdir(waf_dir):
         lst = self.root.find_node(waf_dir).find_node(
             'waflib/extras').ant_glob(var)
         for x in lst:
             if not x.name in ban:
                 load_tool(x.name.replace('.py', ''))
     else:
         from zipfile import PyZipFile
         waflibs = PyZipFile(waf_dir)
         lst = waflibs.namelist()
         for x in lst:
             if not re.match("waflib/extras/%s" % var.replace("*", ".*"),
                             var):
                 continue
             f = os.path.basename(x)
             doban = False
             for b in ban:
                 r = b.replace("*", ".*")
                 if re.match(b, f):
                     doban = True
             if not doban:
                 f = f.replace('.py', '')
                 load_tool(f)
예제 #3
0
파일: Context.py 프로젝트: fedepell/waf
	def load_special_tools(self, var, ban=[]):
		"""
		Loads third-party extensions modules for certain programming languages
		by trying to list certain files in the extras/ directory. This method
		is typically called once for a programming language group, see for
		example :py:mod:`waflib.Tools.compiler_c`

		:param var: glob expression, for example 'cxx\_\*.py'
		:type var: string
		:param ban: list of exact file names to exclude
		:type ban: list of string
		"""
		if os.path.isdir(waf_dir):
			lst = self.root.find_node(waf_dir).find_node('waflib/extras').ant_glob(var)
			for x in lst:
				if not x.name in ban:
					load_tool(x.name.replace('.py', ''))
		else:
			from zipfile import PyZipFile
			waflibs = PyZipFile(waf_dir)
			lst = waflibs.namelist()
			for x in lst:
				if not re.match('waflib/extras/%s' % var.replace('*', '.*'), var):
					continue
				f = os.path.basename(x)
				doban = False
				for b in ban:
					r = b.replace('*', '.*')
					if re.match(r, f):
						doban = True
				if not doban:
					f = f.replace('.py', '')
					load_tool(f)
예제 #4
0
파일: Context.py 프로젝트: Jajcus/jack2
	def load_special_tools(self, var, ban=[]):
		global waf_dir
		if os.path.isdir(waf_dir):
			lst = self.root.find_node(waf_dir).find_node('waflib/extras').ant_glob(var)
			for x in lst:
				if not x.name in ban:
					load_tool(x.name.replace('.py', ''))
		else:
			from zipfile import PyZipFile
			waflibs = PyZipFile(waf_dir)
			lst = waflibs.namelist()
			for x in lst:
				if not re.match("waflib/extras/%s" % var.replace("*", ".*"), var):
					continue
				f = os.path.basename(x)
				doban = False
				for b in ban:
					r = b.replace("*", ".*")
					if re.match(b, f):
						doban = True
				if not doban:
					f = f.replace('.py', '')
					load_tool(f)