Skip to content
This repository
Browse code

Upgrade to WAF 1.5.15

  • Loading branch information...
commit 01f7d4484e5aa079155c0affc35210eee6959f99 1 parent ec0266a
ry authored April 04, 2010
2  bin/node-waf
@@ -12,6 +12,6 @@ t = join(w, 'Tools')
12 12
 sys.path = [w, t] + sys.path
13 13
 
14 14
 import Scripting
15  
-VERSION="1.5.14"
  15
+VERSION="1.5.15"
16 16
 Scripting.prepare(t, os.getcwd(), VERSION, wafdir)
17 17
 sys.exit(0)
2  tools/waf-light
@@ -37,7 +37,7 @@ if 'PSYCOWAF' in os.environ:
37 37
 	try:import psyco;psyco.full()
38 38
 	except:pass
39 39
 
40  
-VERSION="1.5.14"
  40
+VERSION="1.5.15"
41 41
 REVISION="x"
42 42
 INSTALL="x"
43 43
 C1='x'
9  tools/wafadmin/Build.py
@@ -681,8 +681,13 @@ def flush(self, all=1):
681 681
 			for i in xrange(len(self.task_manager.groups)):
682 682
 				g = self.task_manager.groups[i]
683 683
 				self.task_manager.current_group = i
  684
+				if Logs.verbose:
  685
+					Logs.debug('group: group %s' % ([x for x in self.task_manager.groups_names if id(self.task_manager.groups_names[x]) == id(g)][0]))
  686
+
684 687
 				for tg in g.tasks_gen:
685 688
 					if id(tg) in to_compile:
  689
+						if Logs.verbose:
  690
+							Logs.debug('group: %s' % tg)
686 691
 						tg.post()
687 692
 
688 693
 		else:
@@ -702,9 +707,13 @@ def flush(self, all=1):
702 707
 			for i in xrange(len(self.task_manager.groups)):
703 708
 				g = self.task_manager.groups[i]
704 709
 				self.task_manager.current_group = i
  710
+				if Logs.verbose:
  711
+					Logs.debug('group: group %s' % ([x for x in self.task_manager.groups_names if id(self.task_manager.groups_names[x]) == id(g)][0]))
705 712
 				for tg in g.tasks_gen:
706 713
 					if not tg.path.is_child_of(ln):
707 714
 						continue
  715
+					if Logs.verbose:
  716
+						Logs.debug('group: %s' % tg)
708 717
 					tg.post()
709 718
 
710 719
 	def env_of_name(self, name):
2  tools/wafadmin/Configure.py
@@ -125,7 +125,7 @@ def post_init(self):
125 125
 		except (OSError, IOError):
126 126
 			self.fatal('could not open %r for writing' % path)
127 127
 
128  
-		app = getattr(Utils.g_module, 'APPNAME', '')
  128
+		app = Utils.g_module.APPNAME
129 129
 		if app:
130 130
 			ver = getattr(Utils.g_module, 'VERSION', '')
131 131
 			if ver:
6  tools/wafadmin/Constants.py
@@ -9,9 +9,9 @@
9 9
 """
10 10
 
11 11
 # do not touch these three lines, they are updated automatically
12  
-HEXVERSION = 0x105014
13  
-WAFVERSION="1.5.14"
14  
-WAFREVISION = "7363M"
  12
+HEXVERSION = 0x105015
  13
+WAFVERSION="1.5.15"
  14
+WAFREVISION = "7505M"
15 15
 ABI = 7
16 16
 
17 17
 # permissions
7  tools/wafadmin/Node.py
@@ -204,7 +204,7 @@ def find_or_declare(self, lst):
204 204
 		if node:
205 205
 			tp = node.id & 3
206 206
 			if tp != BUILD:
207  
-				raise Utils.WafError("find_or_declare returns a build node, not a source nor a directory %r" % lst)
  207
+				raise Utils.WafError('find_or_declare cannot return a build node (build files in the source directory %r?)' % lst)
208 208
 			return node
209 209
 		node = self.__class__(name, parent, BUILD)
210 210
 		return node
@@ -461,8 +461,9 @@ def bldpath(self, env=None):
461 461
 		"path seen from the build dir default/src/foo.cpp"
462 462
 		if self.id & 3 == FILE:
463 463
 			return self.relpath_gen(self.__class__.bld.bldnode)
464  
-		if self.path_to_parent(self.__class__.bld.srcnode) is not '':
465  
-			return os.path.join(env.variant(), self.path_to_parent(self.__class__.bld.srcnode))
  464
+		p = self.path_to_parent(self.__class__.bld.srcnode)
  465
+		if p is not '':
  466
+			return env.variant() + os.sep + p
466 467
 		return env.variant()
467 468
 
468 469
 	def srcpath(self, env=None):
8  tools/wafadmin/Runner.py
@@ -190,11 +190,15 @@ def start(self):
190 190
 			try:
191 191
 				st = tsk.runnable_status()
192 192
 			except Exception, e:
193  
-				tsk.err_msg = Utils.ex_stack()
194  
-				tsk.hasrun = EXCEPTION
195 193
 				self.processed += 1
  194
+				if self.stop and not Options.options.keep:
  195
+					tsk.hasrun = SKIPPED
  196
+					self.manager.add_finished(tsk)
  197
+					continue
196 198
 				self.error_handler(tsk)
197 199
 				self.manager.add_finished(tsk)
  200
+				tsk.hasrun = EXCEPTION
  201
+				tsk.err_msg = Utils.ex_stack()
198 202
 				continue
199 203
 
200 204
 			if st == ASK_LATER:
10  tools/wafadmin/Scripting.py
@@ -412,7 +412,7 @@ def build_impl(bld):
412 412
 
413 413
 	bld.install()
414 414
 
415  
-excludes = '.bzr .bzrignore .git .gitignore .svn CVS .cvsignore .arch-ids {arch} SCCS BitKeeper .hg _MTN _darcs Makefile Makefile.in config.log'.split()
  415
+excludes = '.bzr .bzrignore .git .gitignore .svn CVS .cvsignore .arch-ids {arch} SCCS BitKeeper .hg _MTN _darcs Makefile Makefile.in config.log .gitattributes .hgignore .hgtags'.split()
416 416
 dist_exts = '~ .rej .orig .pyc .pyo .bak .tar.bz2 tar.gz .zip .swp'.split()
417 417
 def dont_dist(name, src, build_dir):
418 418
 	global excludes, dist_exts
@@ -486,8 +486,8 @@ def dist(appname='', version=''):
486 486
 	# return return (distdirname, tarballname)
487 487
 	import tarfile
488 488
 
489  
-	if not appname: appname = getattr(Utils.g_module, APPNAME, 'noname')
490  
-	if not version: version = getattr(Utils.g_module, VERSION, '1.0')
  489
+	if not appname: appname = Utils.g_module.APPNAME
  490
+	if not version: version = Utils.g_module.VERSION
491 491
 
492 492
 	tmp_folder = appname + '-' + version
493 493
 	if g_gz in ['gz', 'bz2']:
@@ -545,8 +545,8 @@ def distcheck(appname='', version=''):
545 545
 	'''checks if the sources compile (tarball from 'dist')'''
546 546
 	import tempfile, tarfile
547 547
 
548  
-	if not appname: appname = getattr(Utils.g_module, APPNAME, 'noname')
549  
-	if not version: version = getattr(Utils.g_module, VERSION, '1.0')
  548
+	if not appname: appname = Utils.g_module.APPNAME
  549
+	if not version: version = Utils.g_module.VERSION
550 550
 
551 551
 	waf = os.path.abspath(sys.argv[0])
552 552
 	tarball = dist(appname, version)
45  tools/wafadmin/Task.py
@@ -578,22 +578,25 @@ def signature(self):
578 578
 		try: return self.cache_sig[0]
579 579
 		except AttributeError: pass
580 580
 
581  
-		m = md5()
  581
+		self.m = md5()
582 582
 
583 583
 		# explicit deps
584 584
 		exp_sig = self.sig_explicit_deps()
585  
-		m.update(exp_sig)
586  
-
587  
-		# implicit deps
588  
-		imp_sig = self.scan and self.sig_implicit_deps() or SIG_NIL
589  
-		m.update(imp_sig)
590 585
 
591 586
 		# env vars
592 587
 		var_sig = self.sig_vars()
593  
-		m.update(var_sig)
  588
+
  589
+		# implicit deps
  590
+
  591
+		imp_sig = SIG_NIL
  592
+		if self.scan:
  593
+			try:
  594
+				imp_sig = self.sig_implicit_deps()
  595
+			except ValueError:
  596
+				return self.signature()
594 597
 
595 598
 		# we now have the signature (first element) and the details (for debugging)
596  
-		ret = m.digest()
  599
+		ret = self.m.digest()
597 600
 		self.cache_sig = (ret, exp_sig, imp_sig, var_sig)
598 601
 		return ret
599 602
 
@@ -771,7 +774,7 @@ def v(x):
771 774
 
772 775
 	def sig_explicit_deps(self):
773 776
 		bld = self.generator.bld
774  
-		m = md5()
  777
+		up = self.m.update
775 778
 
776 779
 		# the inputs
777 780
 		for x in self.inputs + getattr(self, 'dep_nodes', []):
@@ -780,7 +783,7 @@ def sig_explicit_deps(self):
780 783
 
781 784
 			variant = x.variant(self.env)
782 785
 			try:
783  
-				m.update(bld.node_sigs[variant][x.id])
  786
+				up(bld.node_sigs[variant][x.id])
784 787
 			except KeyError:
785 788
 				raise Utils.WafError('Missing node signature for %r (required by %r)' % (x, self))
786 789
 
@@ -803,29 +806,28 @@ def sig_explicit_deps(self):
803 806
 							raise Utils.WafError('Missing node signature for %r (required by %r)' % (v, self))
804 807
 					elif hasattr(v, '__call__'):
805 808
 						v = v() # dependency is a function, call it
806  
-					m.update(v)
  809
+					up(v)
807 810
 
808 811
 		for x in self.deps_nodes:
809 812
 			v = bld.node_sigs[x.variant(self.env)][x.id]
810  
-			m.update(v)
  813
+			up(v)
811 814
 
812  
-		return m.digest()
  815
+		return self.m.digest()
813 816
 
814 817
 	def sig_vars(self):
815  
-		m = md5()
816 818
 		bld = self.generator.bld
817 819
 		env = self.env
818 820
 
819 821
 		# dependencies on the environment vars
820 822
 		act_sig = bld.hash_env_vars(env, self.__class__.vars)
821  
-		m.update(act_sig)
  823
+		self.m.update(act_sig)
822 824
 
823 825
 		# additional variable dependencies, if provided
824 826
 		dep_vars = getattr(self, 'dep_vars', None)
825 827
 		if dep_vars:
826  
-			m.update(bld.hash_env_vars(env, dep_vars))
  828
+			self.m.update(bld.hash_env_vars(env, dep_vars))
827 829
 
828  
-		return m.digest()
  830
+		return self.m.digest()
829 831
 
830 832
 	#def scan(self, node):
831 833
 	#	"""this method returns a tuple containing:
@@ -852,6 +854,8 @@ def sig_implicit_deps(self):
852 854
 					return prev_sigs[2]
853 855
 			except (KeyError, OSError):
854 856
 				pass
  857
+			del bld.task_sigs[key]
  858
+			raise ValueError('rescan')
855 859
 
856 860
 		# no previous run or the signature of the dependencies has changed, rescan the dependencies
857 861
 		(nodes, names) = self.scan()
@@ -878,8 +882,7 @@ def compute_sig_implicit_deps(self):
878 882
 		"""it is intended for .cpp and inferred .h files
879 883
 		there is a single list (no tree traversal)
880 884
 		this is the hot spot so ... do not touch"""
881  
-		m = md5()
882  
-		upd = m.update
  885
+		upd = self.m.update
883 886
 
884 887
 		bld = self.generator.bld
885 888
 		tstamp = bld.node_sigs
@@ -897,7 +900,7 @@ def compute_sig_implicit_deps(self):
897 900
 			else:
898 901
 				upd(tstamp[env.variant()][k.id])
899 902
 
900  
-		return m.digest()
  903
+		return self.m.digest()
901 904
 
902 905
 def funex(c):
903 906
 	dc = {}
@@ -1132,7 +1135,7 @@ def extract_deps(tasks):
1132 1135
 		except: # this is on purpose
1133 1136
 			pass
1134 1137
 
1135  
-		variant = x.env.variant()
  1138
+		v = x.env.variant()
1136 1139
 		key = x.unique_id()
1137 1140
 		for k in x.generator.bld.node_deps.get(x.unique_id(), []):
1138 1141
 			try: dep_to_task[(v, k.id)].append(x)
3  tools/wafadmin/TaskGen.py
@@ -527,6 +527,9 @@ def exec_rule(self):
527 527
 				raise Utils.WafError('input file %r could not be found (%r)' % (x, self.path.abspath()))
528 528
 			tsk.inputs.append(y)
529 529
 
  530
+	if self.allnodes:
  531
+		tsk.inputs.extend(self.allnodes)
  532
+
530 533
 	if getattr(self, 'scan', None):
531 534
 		cls.scan = self.scan
532 535
 
7  tools/wafadmin/Tools/config_c.py
@@ -186,7 +186,8 @@ def exec_cfg(self, kw):
186 186
 		vars = Utils.to_list(kw['variables'])
187 187
 		for v in vars:
188 188
 			val = self.cmd_and_log('%s --variable=%s %s' % (kw['path'], v, kw['package']), kw).strip()
189  
-			env.append_unique('%s_%s' % (uselib, v), val)
  189
+			var = '%s_%s' % (uselib, v)
  190
+			env[var] = val
190 191
 		if not 'okmsg' in kw:
191 192
 			kw['okmsg'] = 'ok'
192 193
 		return
@@ -541,10 +542,8 @@ def run_c_code(self, *k, **kw):
541 542
 
542 543
 	# if we need to run the program, try to get its result
543 544
 	if kw['execute']:
544  
-		ak = {} # syntax for python < 2.5, don't touch
545  
-		ak['stdout'] = ak['stderr'] = Utils.pproc.PIPE
546 545
 		args = Utils.to_list(kw.get('exec_args', []))
547  
-		proc = Utils.pproc.Popen([lastprog], *args, **ak)
  546
+		proc = Utils.pproc.Popen([lastprog] + args, stdout=Utils.pproc.PIPE, stderr=Utils.pproc.PIPE)
548 547
 		(out, err) = proc.communicate()
549 548
 		w = self.log.write
550 549
 		w(str(out))
10  tools/wafadmin/Tools/d.py
@@ -289,8 +289,8 @@ def apply_d_libs(self):
289 289
 		# object has ancestors to process (shared libraries): add them to the end of the list
290 290
 		if getattr(y, 'uselib_local', None):
291 291
 			lst = y.to_list(y.uselib_local)
292  
-			if 'dshlib' in y.features or 'cprogram' in y.features:
293  
-				lst = [x for x in lst if not 'cstaticlib' in self.name_to_obj(x).features]
  292
+			if 'dshlib' in y.features or 'dprogram' in y.features:
  293
+				lst = [x for x in lst if not 'dstaticlib' in self.name_to_obj(x).features]
294 294
 			tmp.extend(lst)
295 295
 
296 296
 		# link task and flags
@@ -386,6 +386,12 @@ def apply_d_vars(self):
386 386
 	# now process the library paths
387 387
 	# apply same path manipulation as used with import paths
388 388
 	for path in libpaths:
  389
+		if not os.path.isabs(path):
  390
+			node = self.path.find_resource(path)
  391
+			if not node:
  392
+				raise Utils.WafError('could not find libpath %r from %r' % (path, self))
  393
+			path = node.abspath(self.env)
  394
+
389 395
 		env.append_unique('DLINKFLAGS', libpath_st % path)
390 396
 
391 397
 	# add libraries
1  tools/wafadmin/Tools/gas.py
@@ -34,4 +34,5 @@ def asm_incflags(self):
34 34
 def detect(conf):
35 35
 	conf.find_program(['gas', 'as'], var='AS')
36 36
 	if not conf.env.AS: conf.env.AS = conf.env.CC
  37
+	#conf.env.ASFLAGS = ['-c'] <- may be necesary for .S files
37 38
 
2  tools/wafadmin/Tools/gnu_dirs.py
@@ -65,7 +65,7 @@ def get_param(varname, default):
65 65
 
66 66
 	env = conf.env
67 67
 	env['EXEC_PREFIX'] = get_param('EXEC_PREFIX', env['PREFIX'])
68  
-	env['PACKAGE'] = getattr(Utils.g_module, 'APPNAME', None) or env['PACKAGE']
  68
+	env['PACKAGE'] = Utils.g_module.APPNAME
69 69
 
70 70
 	complete = False
71 71
 	iter = 0
14  tools/wafadmin/Tools/msvc.py
@@ -724,7 +724,17 @@ def exec_mf(self):
724 724
 	self.do_manifest = False
725 725
 
726 726
 	outfile = self.outputs[0].bldpath(env)
727  
-	manifest = self.outputs[-1].bldpath(env)
  727
+	
  728
+	manifest = None
  729
+	for out_node in self.outputs:
  730
+		if out_node.name.endswith('.manifest'):
  731
+			manifest = out_node.bldpath(env)
  732
+			break
  733
+	if manifest is None:
  734
+		# Should never get here.  If we do, it means the manifest file was 
  735
+		# never added to the outputs list, thus we don't have a manifest file 
  736
+		# to embed, so we just return.
  737
+		return 0
728 738
 
729 739
 	# embedding mode. Different for EXE's and DLL's.
730 740
 	# see: http://msdn2.microsoft.com/en-us/library/ms235591(VS.80).aspx
@@ -738,7 +748,7 @@ def exec_mf(self):
738 748
 	#flags = ' '.join(env['MTFLAGS'] or [])
739 749
 
740 750
 	lst = []
741  
-	lst.extend(Utils.to_list(env['MT']))
  751
+	lst.extend([env['MT']])
742 752
 	lst.extend(Utils.to_list(env['MTFLAGS']))
743 753
 	lst.extend(Utils.to_list("-manifest"))
744 754
 	lst.extend(Utils.to_list(manifest))
6  tools/wafadmin/Tools/preproc.py
@@ -35,6 +35,10 @@ class PreprocError(Utils.WafError):
35 35
 
36 36
 POPFILE = '-'
37 37
 
  38
+
  39
+recursion_limit = 100
  40
+"do not loop too much on header inclusion"
  41
+
38 42
 go_absolute = 0
39 43
 "set to 1 to track headers on files in /usr/include - else absolute paths are ignored"
40 44
 
@@ -636,7 +640,7 @@ def addlines(self, node):
636 640
 		filepath = node.abspath(self.env)
637 641
 
638 642
 		self.count_files += 1
639  
-		if self.count_files > 30000: raise PreprocError("recursion limit exceeded")
  643
+		if self.count_files > recursion_limit: raise PreprocError("recursion limit exceeded")
640 644
 		pc = self.parse_cache
641 645
 		debug('preproc: reading file %r', filepath)
642 646
 		try:
4  tools/wafadmin/Tools/python.py
@@ -55,7 +55,7 @@ def init_pyembed(self):
55 55
 
56 56
 @extension(EXT_PY)
57 57
 def process_py(self, node):
58  
-	if not (self.bld.is_install or self.install_path):
  58
+	if not (self.bld.is_install and self.install_path):
59 59
 		return
60 60
 	def inst_py(ctx):
61 61
 		install_pyfile(self, node)
@@ -122,7 +122,7 @@ def _get_python_variables(python_exe, variables, imports=['import sys']):
122 122
 	except KeyError:
123 123
 		pass
124 124
 	proc = Utils.pproc.Popen([python_exe, "-c", '\n'.join(program)], stdout=Utils.pproc.PIPE, env=os_env)
125  
-	output = proc.communicate()[0].split("\n")
  125
+	output = proc.communicate()[0].split("\n") # do not touch, python3
126 126
 	if proc.returncode:
127 127
 		if Options.options.verbose:
128 128
 			warn("Python program to extract python configuration variables failed:\n%s"
45  tools/wafadmin/Tools/qt4.py
@@ -96,31 +96,25 @@ def add_moc_tasks(self):
96 96
 			if d in mocfiles:
97 97
 				error("paranoia owns")
98 98
 				continue
  99
+
99 100
 			# process that base.moc only once
100 101
 			mocfiles.append(d)
101 102
 
102  
-			# find the extension - this search is done only once
103  
-			ext = ''
104  
-			try: ext = Options.options.qt_header_ext
105  
-			except AttributeError: pass
106  
-
107  
-			if not ext:
108  
-				base2 = d[:-4]
109  
-				paths = [node.parent.srcpath(self.env), node.parent.bldpath(self.env)]
110  
-				poss = [(x, y) for x in MOC_H for y in paths]
111  
-				for (i, path) in poss:
112  
-					try:
113  
-						# TODO we could use find_resource
114  
-						os.stat(os.path.join(path, base2+i))
115  
-					except OSError:
116  
-						pass
117  
-					else:
118  
-						ext = i
  103
+			# find the extension (performed only when the .cpp has changes)
  104
+			base2 = d[:-4]
  105
+			for path in [node.parent] + self.generator.env['INC_PATHS']:
  106
+				tree.rescan(path)
  107
+				vals = getattr(Options.options, 'qt_header_ext', '') or MOC_H
  108
+				for ex in vals:
  109
+					h_node = path.find_resource(base2 + ex)
  110
+					if h_node:
119 111
 						break
120  
-				if not ext: raise Utils.WafError("no header found for %s which is a moc file" % str(d))
  112
+				else:
  113
+					continue
  114
+				break
  115
+			else:
  116
+				raise Utils.WafError("no header found for %s which is a moc file" % str(d))
121 117
 
122  
-			# next time we will not search for the extension (look at the 'for' loop below)
123  
-			h_node = node.parent.find_resource(base2+i)
124 118
 			m_node = h_node.change_ext('.moc')
125 119
 			tree.node_deps[(self.inputs[0].parent.id, self.env.variant(), m_node.name)] = h_node
126 120
 
@@ -246,7 +240,8 @@ def apply_qt4(self):
246 240
 			if update:
247 241
 				trans.append(t.inputs[0])
248 242
 
249  
-		if update and Options.options.trans_qt4:
  243
+		trans_qt4 = getattr(Options.options, 'trans_qt4', False)
  244
+		if update and trans_qt4:
250 245
 			# we need the cpp files given, except the rcc task we create after
251 246
 			# FIXME may be broken
252 247
 			u = Task.TaskCmd(translation_update, self.env, 2)
@@ -426,6 +421,11 @@ def find_bin(lst, var):
426 421
 						env.append_unique(kind + 'LIB_' + uselib, lib + d + ext)
427 422
 						conf.check_message_2('ok ' + path, 'GREEN')
428 423
 						break
  424
+					path = os.path.join(qtbin, pat % (lib + d + ext))
  425
+					if os.path.exists(path):
  426
+						env.append_unique(kind + 'LIB_' + uselib, lib + d + ext)
  427
+						conf.check_message_2('ok ' + path, 'GREEN')
  428
+						break
429 429
 				else:
430 430
 					conf.check_message_2('not found', 'YELLOW')
431 431
 					continue
@@ -461,7 +461,8 @@ def process_lib(vars_, coreval):
461 461
 	process_lib(vars_debug, 'LIBPATH_QTCORE_DEBUG')
462 462
 
463 463
 	# rpath if wanted
464  
-	if Options.options.want_rpath:
  464
+	want_rpath = getattr(Options.options, 'want_rpath', 1)
  465
+	if want_rpath:
465 466
 		def process_rpath(vars_, coreval):
466 467
 			for d in vars_:
467 468
 				var = d.upper()
3  tools/wafadmin/Tools/suncc.py
@@ -17,9 +17,10 @@ def find_scc(conf):
17 17
 	#if not cc: cc = conf.find_program('gcc', var='CC')
18 18
 	if not cc: cc = conf.find_program('cc', var='CC')
19 19
 	if not cc: conf.fatal('suncc was not found')
  20
+	cc = conf.cmd_to_list(cc)
20 21
 
21 22
 	try:
22  
-		if not Utils.cmd_output('%s -flags' % cc):
  23
+		if not Utils.cmd_output(cc + ['-flags']):
23 24
 			conf.fatal('suncc %r was not found' % cc)
24 25
 	except ValueError:
25 26
 		conf.fatal('suncc -flags could not be executed')
10  tools/wafadmin/Tools/suncxx.py
@@ -14,10 +14,16 @@ def find_sxx(conf):
14 14
 	cc = None
15 15
 	if v['CXX']: cc = v['CXX']
16 16
 	elif 'CXX' in conf.environ: cc = conf.environ['CXX']
17  
-	#if not cc: cc = conf.find_program('g++', var='CXX')
18 17
 	if not cc: cc = conf.find_program('c++', var='CXX')
19  
-	if not cc: cc = conf.find_program('CC', var='CXX') #studio
20 18
 	if not cc: conf.fatal('sunc++ was not found')
  19
+	cc = conf.cmd_to_list(cc)
  20
+
  21
+	try:
  22
+		if not Utils.cmd_output(cc + ['-flags']):
  23
+			conf.fatal('sunc++ %r was not found' % cc)
  24
+	except ValueError:
  25
+		conf.fatal('sunc++ -flags could not be executed')
  26
+
21 27
 	v['CXX']  = cc
22 28
 	v['CXX_NAME'] = 'sun'
23 29
 
56  tools/wafadmin/Tools/vala.py
@@ -3,7 +3,7 @@
3 3
 # Ali Sabil, 2007
4 4
 
5 5
 import os.path, shutil
6  
-import Task, Runner, Utils, Logs, Build, Node
  6
+import Task, Runner, Utils, Logs, Build, Node, Options
7 7
 from TaskGen import extension, after, before
8 8
 
9 9
 EXT_VALA = ['.vala', '.gs']
@@ -29,6 +29,9 @@ def run(self):
29 29
 		if self.threading:
30 30
 			cmd.append('--thread')
31 31
 
  32
+		if self.profile:
  33
+			cmd.append('--profile=%s' % self.profile)
  34
+
32 35
 		if self.target_glib:
33 36
 			cmd.append('--target-glib=%s' % self.target_glib)
34 37
 
@@ -134,13 +137,15 @@ def vala_file(self, node):
134 137
 		valatask = self.create_task('valac')
135 138
 		self.valatask = valatask
136 139
 		self.includes = Utils.to_list(getattr(self, 'includes', []))
  140
+		self.uselib = self.to_list(self.uselib)
137 141
 		valatask.packages = []
138 142
 		valatask.packages_private = Utils.to_list(getattr(self, 'packages_private', []))
139 143
 		valatask.vapi_dirs = []
140 144
 		valatask.target = self.target
141 145
 		valatask.threading = False
142 146
 		valatask.install_path = self.install_path
143  
-		valatask.target_glib = None
  147
+		valatask.profile = getattr (self, 'profile', 'gobject')
  148
+		valatask.target_glib = None #Deprecated
144 149
 
145 150
 		packages = Utils.to_list(getattr(self, 'packages', []))
146 151
 		vapi_dirs = Utils.to_list(getattr(self, 'vapi_dirs', []))
@@ -197,14 +202,24 @@ def vala_file(self, node):
197 202
 			except AttributeError:
198 203
 				Logs.warn("Unable to locate include directory: '%s'" % include)
199 204
 
200  
-		if hasattr(self, 'threading'):
201  
-			valatask.threading = self.threading
202  
-			self.uselib = self.to_list(self.uselib)
203  
-			if not 'GTHREAD' in self.uselib:
204  
-				self.uselib.append('GTHREAD')
  205
+		if valatask.profile == 'gobject':
  206
+			if hasattr(self, 'target_glib'):
  207
+				Logs.warn ('target_glib on vala tasks is deprecated --vala-target-glib=MAJOR.MINOR from the vala tool options')
  208
+
  209
+			if getattr(Options.options, 'vala_target_glib', None):
  210
+				valatask.target_glib = Options.options.vala_target_glib
205 211
 
206  
-		if hasattr(self, 'target_glib'):
207  
-			valatask.target_glib = self.target_glib
  212
+			if not 'GOBJECT' in self.uselib:
  213
+				self.uselib.append('GOBJECT')
  214
+
  215
+		if hasattr(self, 'threading'):
  216
+			if valatask.profile == 'gobject':
  217
+				valatask.threading = self.threading
  218
+				if not 'GTHREAD' in self.uselib:
  219
+					self.uselib.append('GTHREAD')
  220
+			else:
  221
+				#Vala doesn't have threading support for dova nor posix
  222
+				Logs.warn("Profile %s does not have threading support" % valatask.profile)
208 223
 
209 224
 		if hasattr(self, 'gir'):
210 225
 			valatask.gir = self.gir
@@ -244,8 +259,23 @@ def detect(conf):
244 259
 
245 260
 	valac = conf.find_program('valac', var='VALAC', mandatory=True)
246 261
 
  262
+	if not conf.env["HAVE_GOBJECT"]:
  263
+		pkg_args = {'package':      'gobject-2.0',
  264
+		            'uselib_store': 'GOBJECT',
  265
+		            'args':         '--cflags --libs'}
  266
+		if getattr(Options.options, 'vala_target_glib', None):
  267
+			pkg_args['atleast_version'] = Options.options.vala_target_glib
  268
+
  269
+		conf.check_cfg(**pkg_args)
  270
+
247 271
 	if not conf.env["HAVE_GTHREAD"]:
248  
-		conf.check_cfg(package='gthread-2.0', uselib_store='GTHREAD', args='--cflags --libs')
  272
+		pkg_args = {'package':      'gthread-2.0',
  273
+		            'uselib_store': 'GTHREAD',
  274
+		            'args':         '--cflags --libs'}
  275
+		if getattr(Options.options, 'vala_target_glib', None):
  276
+			pkg_args['atleast_version'] = Options.options.vala_target_glib
  277
+
  278
+		conf.check_cfg(**pkg_args)
249 279
 
250 280
 	try:
251 281
 		output = Utils.cmd_output(valac + " --version", silent=True)
@@ -269,3 +299,9 @@ def detect(conf):
269 299
 	conf.env['VALAC_VERSION'] = valac_version
270 300
 	conf.env['VALAFLAGS'] = ''
271 301
 
  302
+def set_options (opt):
  303
+	valaopts = opt.add_option_group('Vala Compiler Options')
  304
+	valaopts.add_option ('--vala-target-glib', default=None,
  305
+	                     dest='vala_target_glib', metavar='MAJOR.MINOR',
  306
+	                     help='Target version of glib for Vala GObject code generation')
  307
+
35  tools/wafadmin/Utils.py
@@ -130,18 +130,22 @@ def h_file(filename):
130 130
 
131 131
 except ImportError:
132 132
 	try:
133  
-		from hashlib import md5
  133
+		try:
  134
+			from hashlib import md5
  135
+		except ImportError:
  136
+			from md5 import md5
  137
+
  138
+		def h_file(filename):
  139
+			f = open(filename, 'rb')
  140
+			m = md5()
  141
+			while (filename):
  142
+				filename = f.read(100000)
  143
+				m.update(filename)
  144
+			f.close()
  145
+			return m.digest()
134 146
 	except ImportError:
135  
-		from md5 import md5
136  
-
137  
-	def h_file(filename):
138  
-		f = open(filename, 'rb')
139  
-		m = md5()
140  
-		while (filename):
141  
-			filename = f.read(100000)
142  
-			m.update(filename)
143  
-		f.close()
144  
-		return m.digest()
  147
+		# portability fixes may be added elsewhere (although, md5 should be everywhere by now)
  148
+		md5 = None
145 149
 
146 150
 class ordered_dict(UserDict):
147 151
 	def __init__(self, dict = None):
@@ -282,6 +286,15 @@ def set_main_module(file_path):
282 286
 	g_module = load_module(file_path, 'wscript_main')
283 287
 	g_module.root_path = file_path
284 288
 
  289
+	try:
  290
+		g_module.APPNAME
  291
+	except:
  292
+		g_module.APPNAME = 'noname'
  293
+	try:
  294
+		g_module.VERSION
  295
+	except:
  296
+		g_module.VERSION = '1.0'
  297
+
285 298
 	# note: to register the module globally, use the following:
286 299
 	# sys.modules['wscript_main'] = g_module
287 300
 
2  tools/wafadmin/py3kfixes.py
@@ -100,7 +100,7 @@ def r7(code):
100 100
 
101 101
 @subst('Tools/python.py')
102 102
 def r8(code):
103  
-	code = code.replace('p.communicate()[0]', 'p.communicate()[0].decode("utf-8")')
  103
+	code = code.replace('proc.communicate()[0]', 'proc.communicate()[0].decode("utf-8")')
104 104
 	return code
105 105
 
106 106
 @subst('Tools/glib2.py')

0 notes on commit 01f7d44

Please sign in to comment.
Something went wrong with that request. Please try again.