Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
62188f61
Commit
62188f61
authored
6 years ago
by
Julian Oes
Committed by
Beat Küng
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
px_romfs_pruner.py: PEP8 and comments fixes
parent
177d14c8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tools/px_romfs_pruner.py
+9
-7
9 additions, 7 deletions
Tools/px_romfs_pruner.py
with
9 additions
and
7 deletions
Tools/px_romfs_pruner.py
+
9
−
7
View file @
62188f61
#!/usr/bin/env python
############################################################################
#
# Copyright (C) 2014-201
6
PX4 Development Team. All rights reserved.
# Copyright (C) 2014-201
8
PX4 Development Team. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
...
...
@@ -35,10 +35,10 @@
"""
px_romfs_pruner.py:
Try to keep size of ROMFS minimal.
Try to keep size of
the
ROMFS minimal.
This script goes through the temporarily copied ROMFS data and deletes all
comments, empty lines and
leading
whitespace.
comments, empty lines and
unnecessary
whitespace.
It also deletes hidden files such as auto-saved backups that a text editor
might have left in the tree.
...
...
@@ -91,12 +91,14 @@ def main():
board_excluded
=
False
with
io
.
open
(
file_path
,
"
r
"
,
newline
=
None
)
as
f
:
for
line
in
f
:
if
re
.
search
(
r
'
\b{0} exclude\b
'
.
format
(
args
.
board
),
line
):
board_excluded
=
True
;
if
re
.
search
(
r
'
\b{0} exclude\b
'
.
format
(
args
.
board
),
line
):
board_excluded
=
True
# handle mixer files differently than startup files
if
file_path
.
endswith
(
"
.mix
"
):
if
line
.
startswith
((
"
Z:
"
,
"
M:
"
,
"
R:
"
,
"
O:
"
,
"
S:
"
,
"
H:
"
,
"
T:
"
,
"
P:
"
)):
# reduce multiple consecutive spaces into a single space
if
line
.
startswith
((
"
Z:
"
,
"
M:
"
,
"
R:
"
,
"
O:
"
,
"
S:
"
,
"
H:
"
,
"
T:
"
,
"
P:
"
)):
# reduce multiple consecutive spaces into a
# single space
line_reduced
=
re
.
sub
(
'
+
'
,
'
'
,
line
)
pruned_content
+=
line_reduced
else
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment