Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kernel-bitbake-parser
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kernel-bitbake-parser
Commits
5a668049
Commit
5a668049
authored
Apr 20, 2015
by
YuriNenakhov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed path compression algorithm
parent
1f891bcf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
21 deletions
+16
-21
kbparse.py
kbparse.py
+16
-21
No files found.
kbparse.py
View file @
5a668049
...
@@ -19,9 +19,8 @@ is_inc_abspath = re.compile('^\s\/[^\s]*$')
...
@@ -19,9 +19,8 @@ is_inc_abspath = re.compile('^\s\/[^\s]*$')
is_inc_relpath
=
re
.
compile
(
'^
\
s[
\
w][^
\
s]*$'
)
is_inc_relpath
=
re
.
compile
(
'^
\
s[
\
w][^
\
s]*$'
)
is_workdir
=
re
.
compile
(
'Entering directory'
)
is_workdir
=
re
.
compile
(
'Entering directory'
)
is_def_symbol
=
re
.
compile
(
'
\
s-D[
\
s]*([^
\
s
\n
]+)'
)
is_def_symbol
=
re
.
compile
(
'
\
s-D[
\
s]*([^
\
s
\n
]+)'
)
is_src_path
=
re
.
compile
(
'
\
s([^
\
s]+
\
/[
\
w
]+
\
.c)
\
s'
)
is_src_path
=
re
.
compile
(
'
\
s([^
\
s]+
\
/[
^
\
s
]+
\
.c)
\
s'
)
is_extra_include
=
re
.
compile
(
'-include[
\
s]+([^
\
s]+
\
.h)[
\
s
\n
]'
)
is_extra_include
=
re
.
compile
(
'-include[
\
s]+([^
\
s]+
\
.h)[
\
s
\n
]'
)
is_src_file
=
re
.
compile
(
'.*
\
.c$'
)
leading_project_name
=
re
.
compile
(
'
\\
'
+
proj_dir
+
'
\
/'
)
leading_project_name
=
re
.
compile
(
'
\\
'
+
proj_dir
+
'
\
/'
)
inc_receiving
=
0
inc_receiving
=
0
inc_paths
=
[]
inc_paths
=
[]
...
@@ -48,14 +47,15 @@ for line in sys.stdin:
...
@@ -48,14 +47,15 @@ for line in sys.stdin:
line
=
line
.
split
(
'`'
)[
1
]
line
=
line
.
split
(
'`'
)[
1
]
line
=
re
.
sub
(
"[
\
s
\'\n
]"
,
""
,
line
)
line
=
re
.
sub
(
"[
\
s
\'\n
]"
,
""
,
line
)
if
(
line
not
in
workdirs
):
if
(
line
not
in
workdirs
):
print
(
line
)
workdirs
.
append
(
line
)
workdirs
.
append
(
line
)
workdir
=
line
workdir
=
line
cmd
=
'find -L '
+
workdir
+
' -type d'
cmd
=
'find -L '
+
workdir
+
' -type d'
for
i
in
os
.
popen
(
cmd
):
for
i
in
os
.
popen
(
cmd
):
i
=
abs2wrklink
(
i
)[:
-
1
]
i
=
abs2wrklink
(
i
)[:
-
1
]
+
"/"
if
workdir
not
in
i
:
if
workdir
not
in
i
:
all_paths
.
append
(
i
)
all_paths
.
append
(
i
)
cmd
=
'find -L '
+
workdir
+
' -
path
\"
*.c
\
"
'
cmd
=
'find -L '
+
workdir
+
' -
regextype sed -regex ".*
\
.[c]*
"'
for
i
in
os
.
popen
(
cmd
):
for
i
in
os
.
popen
(
cmd
):
i
=
abs2wrklink
(
i
)[:
-
1
]
i
=
abs2wrklink
(
i
)[:
-
1
]
if
workdir
not
in
i
:
if
workdir
not
in
i
:
...
@@ -97,20 +97,6 @@ for line in sys.stdin:
...
@@ -97,20 +97,6 @@ for line in sys.stdin:
for
i
in
all_paths
:
for
i
in
all_paths
:
if
i
in
srcdir
:
if
i
in
srcdir
:
all_paths
.
remove
(
i
)
all_paths
.
remove
(
i
)
print
(
" ╔════════════════════╗
\n
║ include paths ║
\n
╚════════════════════╝"
)
for
i
in
inc_paths
:
print
(
"<listOptionValue builtIn=
\"
false
\"
value=
\"
"${workspace_loc:"
+
i
+
"}"
\"
/>"
)
all_paths
.
sort
()
for
i
in
range
(
len
(
all_paths
)):
try
:
while
all_paths
[
i
+
1
]
.
startswith
(
all_paths
[
i
]):
#print("removing "+all_paths[i+1]+" because of "+all_paths[i])
all_paths
.
pop
(
i
+
1
)
except
IndexError
:
pass
print
(
" ╔════════════════════╗
\n
║ define symbols ║
\n
╚════════════════════╝"
)
print
(
" ╔════════════════════╗
\n
║ define symbols ║
\n
╚════════════════════╝"
)
xml_defs
=
""
xml_defs
=
""
for
i
in
defsyms
:
for
i
in
defsyms
:
...
@@ -124,12 +110,21 @@ for i in defsyms:
...
@@ -124,12 +110,21 @@ for i in defsyms:
xml_defs
=
xml_defs
[:
-
1
]
xml_defs
=
xml_defs
[:
-
1
]
print
(
xml_defs
)
print
(
xml_defs
)
print
(
" ╔════════════════════╗
\n
║ include paths ║
\n
╚════════════════════╝"
)
for
i
in
inc_paths
:
print
(
"<listOptionValue builtIn=
\"
false
\"
value=
\"
"${workspace_loc:"
+
i
+
"}"
\"
/>"
)
all_paths
.
sort
()
for
i
in
range
(
len
(
all_paths
)):
try
:
while
all_paths
[
i
+
1
]
.
startswith
(
all_paths
[
i
]):
all_paths
.
pop
(
i
+
1
)
except
IndexError
:
pass
print
(
" ╔════════════════════╗
\n
║ source paths ║
\n
╚════════════════════╝"
)
print
(
" ╔════════════════════╗
\n
║ source paths ║
\n
╚════════════════════╝"
)
xml_src
=
"<entry excluding=
\"
"
xml_src
=
"<entry excluding=
\"
"
for
i
in
all_paths
:
for
i
in
all_paths
:
i
=
i
.
replace
(
proj_dir
+
src_dir
+
"/"
,
""
)
i
=
i
.
replace
(
proj_dir
+
src_dir
+
"/"
,
""
)
if
not
is_src_file
.
search
(
i
):
i
+=
"/"
xml_src
+=
i
xml_src
+=
i
xml_src
+=
"|"
xml_src
+=
"|"
xml_src
=
xml_src
[:
-
1
]
+
"
\"
flags=
\"
VALUE_WORKSPACE_PATH
\"
kind=
\"
sourcePath
\"
name=
\"
"
+
src_dir
[
1
:]
+
"
\"
/>"
xml_src
=
xml_src
[:
-
1
]
+
"
\"
flags=
\"
VALUE_WORKSPACE_PATH
\"
kind=
\"
sourcePath
\"
name=
\"
"
+
src_dir
[
1
:]
+
"
\"
/>"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment