File: c_aliases.py

package info (click to toggle)
ladish 1%2Bdfsg0-5.1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 3,996 kB
  • ctags: 4,600
  • sloc: ansic: 36,414; python: 11,237; cpp: 705; makefile: 22; ruby: 20; sh: 17
file content (67 lines) | stat: -rw-r--r-- 1,486 bytes parent folder | download | duplicates (3)
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
#! /usr/bin/env python
# encoding: utf-8
# WARNING! All changes made to this file will be lost!

import os,sys,re
from waflib import Utils,Build
from waflib.Configure import conf
def get_extensions(lst):
	ret=[]
	for x in Utils.to_list(lst):
		try:
			if not isinstance(x,str):
				x=x.name
			ret.append(x[x.rfind('.')+1:])
		except:
			pass
	return ret
def sniff_features(**kw):
	exts=get_extensions(kw['source'])
	type=kw['_type']
	if'cxx'in exts or'cpp'in exts or'c++'in exts or'cc'in exts:
		if type=='program':
			return'cxx cxxprogram'
		if type=='shlib':
			return'cxx cxxshlib'
		if type=='stlib':
			return'cxx cxxstlib'
		return'cxx'
	if'd'in exts:
		if type=='program':
			return'd dprogram'
		if type=='shlib':
			return'd dshlib'
		if type=='stlib':
			return'd dstlib'
		return'd'
	if'vala'in exts or'c'in exts:
		if type=='program':
			return'c cprogram'
		if type=='shlib':
			return'c cshlib'
		if type=='stlib':
			return'c cstlib'
		return'c'
	if'java'in exts:
		return'java'
	return''
def set_features(kw,_type):
	kw['_type']=_type
	kw['features']=Utils.to_list(kw.get('features',[]))+Utils.to_list(sniff_features(**kw))
def program(bld,*k,**kw):
	set_features(kw,'program')
	return bld(*k,**kw)
def shlib(bld,*k,**kw):
	set_features(kw,'shlib')
	return bld(*k,**kw)
def stlib(bld,*k,**kw):
	set_features(kw,'stlib')
	return bld(*k,**kw)
def objects(bld,*k,**kw):
	set_features(kw,'objects')
	return bld(*k,**kw)

conf(program)
conf(shlib)
conf(stlib)
conf(objects)