Compare commits
5 Commits
a4c736e4e7
...
45fc27f1a8
Author | SHA1 | Date |
---|---|---|
ktyl | 45fc27f1a8 | |
ktyl | b615241f8c | |
ktyl | 0a89675cca | |
ktyl | 1c1265c6fe | |
ktyl | 62af4e0210 |
10
ppp.py
10
ppp.py
|
@ -11,6 +11,8 @@ if argc < 3:
|
||||||
print_usage()
|
print_usage()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
includes = sys.argv[2:]
|
||||||
|
|
||||||
# figure out src dir from root argument
|
# figure out src dir from root argument
|
||||||
sep="/"
|
sep="/"
|
||||||
src_dir = sep.join(sys.argv[2].split(sep)[:-1])
|
src_dir = sep.join(sys.argv[2].split(sep)[:-1])
|
||||||
|
@ -26,7 +28,7 @@ def preprocess_file(path):
|
||||||
|
|
||||||
with open(path) as f:
|
with open(path) as f:
|
||||||
content = f.readlines()
|
content = f.readlines()
|
||||||
content = [x.strip() for x in content]
|
content = [x.strip('\n') for x in content]
|
||||||
lines=len(content)
|
lines=len(content)
|
||||||
|
|
||||||
for l in content:
|
for l in content:
|
||||||
|
@ -36,7 +38,11 @@ def preprocess_file(path):
|
||||||
include_path = l.split(" ")[1]
|
include_path = l.split(" ")[1]
|
||||||
|
|
||||||
# prepend directory
|
# prepend directory
|
||||||
include_path = "/".join([src_dir, include_path])
|
#include_path = "/".join([src_dir, include_path])
|
||||||
|
for inc in includes:
|
||||||
|
if os.path.basename(inc) == include_path:
|
||||||
|
include_path = inc
|
||||||
|
break
|
||||||
|
|
||||||
preprocess_file(include_path)
|
preprocess_file(include_path)
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue