feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change
on this file since 926f0f6 was
0fa325b,
checked in by Paul Brossier <piem@piem.org>, 11 years ago
|
waf: unpack
|
-
Property mode set to
100644
|
File size:
1.8 KB
|
Line | |
---|
1 | #! /usr/bin/env python |
---|
2 | # encoding: utf-8 |
---|
3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file |
---|
4 | |
---|
5 | import re |
---|
6 | from waflib import Utils,Task,TaskGen,Logs |
---|
7 | from waflib.TaskGen import feature,before_method,after_method,extension |
---|
8 | from waflib.Configure import conf |
---|
9 | INC_REGEX="""(?:^|['">]\s*;)\s*INCLUDE\s+(?:\w+_)?[<"'](.+?)(?=["'>])""" |
---|
10 | USE_REGEX="""(?:^|;)\s*USE(?:\s+|(?:(?:\s*,\s*(?:NON_)?INTRINSIC)?\s*::))\s*(\w+)""" |
---|
11 | MOD_REGEX="""(?:^|;)\s*MODULE(?!\s*PROCEDURE)(?:\s+|(?:(?:\s*,\s*(?:NON_)?INTRINSIC)?\s*::))\s*(\w+)""" |
---|
12 | re_inc=re.compile(INC_REGEX,re.I) |
---|
13 | re_use=re.compile(USE_REGEX,re.I) |
---|
14 | re_mod=re.compile(MOD_REGEX,re.I) |
---|
15 | class fortran_parser(object): |
---|
16 | def __init__(self,incpaths): |
---|
17 | self.seen=[] |
---|
18 | self.nodes=[] |
---|
19 | self.names=[] |
---|
20 | self.incpaths=incpaths |
---|
21 | def find_deps(self,node): |
---|
22 | txt=node.read() |
---|
23 | incs=[] |
---|
24 | uses=[] |
---|
25 | mods=[] |
---|
26 | for line in txt.splitlines(): |
---|
27 | m=re_inc.search(line) |
---|
28 | if m: |
---|
29 | incs.append(m.group(1)) |
---|
30 | m=re_use.search(line) |
---|
31 | if m: |
---|
32 | uses.append(m.group(1)) |
---|
33 | m=re_mod.search(line) |
---|
34 | if m: |
---|
35 | mods.append(m.group(1)) |
---|
36 | return(incs,uses,mods) |
---|
37 | def start(self,node): |
---|
38 | self.waiting=[node] |
---|
39 | while self.waiting: |
---|
40 | nd=self.waiting.pop(0) |
---|
41 | self.iter(nd) |
---|
42 | def iter(self,node): |
---|
43 | path=node.abspath() |
---|
44 | incs,uses,mods=self.find_deps(node) |
---|
45 | for x in incs: |
---|
46 | if x in self.seen: |
---|
47 | continue |
---|
48 | self.seen.append(x) |
---|
49 | self.tryfind_header(x) |
---|
50 | for x in uses: |
---|
51 | name="USE@%s"%x |
---|
52 | if not name in self.names: |
---|
53 | self.names.append(name) |
---|
54 | for x in mods: |
---|
55 | name="MOD@%s"%x |
---|
56 | if not name in self.names: |
---|
57 | self.names.append(name) |
---|
58 | def tryfind_header(self,filename): |
---|
59 | found=None |
---|
60 | for n in self.incpaths: |
---|
61 | found=n.find_resource(filename) |
---|
62 | if found: |
---|
63 | self.nodes.append(found) |
---|
64 | self.waiting.append(found) |
---|
65 | break |
---|
66 | if not found: |
---|
67 | if not filename in self.names: |
---|
68 | self.names.append(filename) |
---|
Note: See
TracBrowser
for help on using the repository browser.