summaryrefslogtreecommitdiff
path: root/py/waf/info.py
blob: 50164581a5000b793e666100fe9a727f9feeaec7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
from waflib.ConfigSet import ConfigSet

def system(ctx):
	info = {}

	from waflib.Utils import unversioned_sys_platform
	info["platform_waf"] = unversioned_sys_platform()

	from multiprocessing import cpu_count
	info["cpu_count"] = cpu_count()

	# platform information
	import platform
	methods = [
		"machine",
		"platform",
		"processor",
		"python_build",
		"python_version",
		"python_version_tuple",
		"system",
#		"system_alias",
		"release",
#		"version",
#		"uname",
		"win32_ver",
		"mac_ver",
		"linux_distribution"
	]
	for method in methods:
		info[method] = getattr(platform, method)()

	return info


def rtems(ctx):
	info = {}

	c = ConfigSet("build/c4che/_cache.py")


	info["version"] = c.RTEMS_VERSION

	info["bsp"] = {}
	for bsp in c.BSP:
		a, b = bsp.split("/")
		c = ConfigSet("build/c4che/%s/%s_cache.py" % (a, b))

		b = {}

		info["bsp"][bsp] = b

	return info


def rtems_cmd_info(ctx):
	info = {}

	info["system"] = system(ctx)
	info["rtems"] = rtems(ctx)


	for val in sorted(info):
		print("\n%s" % val)
		for v in sorted(info[val]):
			print("    %s = %s" % (v, info[val][v]))

#	import pprint
#	pp = pprint.PrettyPrinter(indent=4)
#	pp.pprint(info)