mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-22 15:53:56 -04:00
Tools: flake8 fixes for build_binaries.py
This commit is contained in:
parent
cbd72cb7c6
commit
9da18cd6bc
@ -16,7 +16,7 @@ import shutil
|
|||||||
import time
|
import time
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import zlib, gzip
|
import gzip
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
import generate_manifest
|
import generate_manifest
|
||||||
@ -134,7 +134,7 @@ is bob we will attempt to checkout bob-AVR'''
|
|||||||
self.run_git_update_submodules()
|
self.run_git_update_submodules()
|
||||||
self.run_git(["log", "-1"])
|
self.run_git(["log", "-1"])
|
||||||
return True
|
return True
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError:
|
||||||
self.progress("Checkout branch %s failed" % branch)
|
self.progress("Checkout branch %s failed" % branch)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -158,10 +158,10 @@ is bob we will attempt to checkout bob-AVR'''
|
|||||||
break
|
break
|
||||||
if idx != -1:
|
if idx != -1:
|
||||||
line = line[idx+len(needle):-1]
|
line = line[idx+len(needle):-1]
|
||||||
line = line.replace("'","")
|
line = line.replace("'", "")
|
||||||
line = line.replace(" ","")
|
line = line.replace(" ", "")
|
||||||
boards = line.split(",")
|
boards = line.split(",")
|
||||||
return not board in boards
|
return board not in boards
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
if e.errno != 2:
|
if e.errno != 2:
|
||||||
raise
|
raise
|
||||||
@ -358,7 +358,7 @@ is bob we will attempt to checkout bob-AVR'''
|
|||||||
if os.path.exists(self.buildroot):
|
if os.path.exists(self.buildroot):
|
||||||
shutil.rmtree(self.buildroot)
|
shutil.rmtree(self.buildroot)
|
||||||
|
|
||||||
self.remove_tmpdir();
|
self.remove_tmpdir()
|
||||||
|
|
||||||
self.progress("Configuring for %s in %s" %
|
self.progress("Configuring for %s in %s" %
|
||||||
(board, self.buildroot))
|
(board, self.buildroot))
|
||||||
@ -369,14 +369,14 @@ is bob we will attempt to checkout bob-AVR'''
|
|||||||
"clean"]
|
"clean"]
|
||||||
waf_opts.extend(self.board_options(board))
|
waf_opts.extend(self.board_options(board))
|
||||||
self.run_waf(waf_opts)
|
self.run_waf(waf_opts)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError:
|
||||||
self.progress("waf configure failed")
|
self.progress("waf configure failed")
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
target = os.path.join("bin",
|
target = os.path.join("bin",
|
||||||
"".join([binaryname, framesuffix]))
|
"".join([binaryname, framesuffix]))
|
||||||
self.run_waf(["build", "--targets", target])
|
self.run_waf(["build", "--targets", target])
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError:
|
||||||
msg = ("Failed build of %s %s%s %s" %
|
msg = ("Failed build of %s %s%s %s" %
|
||||||
(vehicle, board, framesuffix, tag))
|
(vehicle, board, framesuffix, tag))
|
||||||
self.progress(msg)
|
self.progress(msg)
|
||||||
@ -412,7 +412,7 @@ is bob we will attempt to checkout bob-AVR'''
|
|||||||
board_list = self.run_program('BB-WAF', ['./waf', 'list_boards'])
|
board_list = self.run_program('BB-WAF', ['./waf', 'list_boards'])
|
||||||
board_list = board_list.split(' ')
|
board_list = board_list.split(' ')
|
||||||
self.checkout(vehicle, "latest")
|
self.checkout(vehicle, "latest")
|
||||||
if not 'px4-v2' in board_list:
|
if 'px4-v2' not in board_list:
|
||||||
print("Skipping px4 builds")
|
print("Skipping px4 builds")
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -465,7 +465,7 @@ is bob we will attempt to checkout bob-AVR'''
|
|||||||
try:
|
try:
|
||||||
self.run_waf(["configure", "--board", px4_v,
|
self.run_waf(["configure", "--board", px4_v,
|
||||||
"--out", self.buildroot, "clean"])
|
"--out", self.buildroot, "clean"])
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError:
|
||||||
self.progress("waf configure failed")
|
self.progress("waf configure failed")
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
@ -474,7 +474,7 @@ is bob we will attempt to checkout bob-AVR'''
|
|||||||
"--targets",
|
"--targets",
|
||||||
os.path.join("bin",
|
os.path.join("bin",
|
||||||
"".join([binaryname, framesuffix]))])
|
"".join([binaryname, framesuffix]))])
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError:
|
||||||
msg = ("Failed build of %s %s%s %s for %s" %
|
msg = ("Failed build of %s %s%s %s for %s" %
|
||||||
(vehicle, board, framesuffix, tag, v))
|
(vehicle, board, framesuffix, tag, v))
|
||||||
self.progress(msg)
|
self.progress(msg)
|
||||||
@ -620,7 +620,7 @@ is bob we will attempt to checkout bob-AVR'''
|
|||||||
new_json_filepath_gz = os.path.join(self.binaries,
|
new_json_filepath_gz = os.path.join(self.binaries,
|
||||||
"manifest.json.gz.new")
|
"manifest.json.gz.new")
|
||||||
with gzip.open(new_json_filepath_gz, 'wb') as gf:
|
with gzip.open(new_json_filepath_gz, 'wb') as gf:
|
||||||
gz.write(content)
|
gf.write(content)
|
||||||
json_filepath = os.path.join(self.binaries, "manifest.json")
|
json_filepath = os.path.join(self.binaries, "manifest.json")
|
||||||
json_filepath_gz = os.path.join(self.binaries, "manifest.json.gz")
|
json_filepath_gz = os.path.join(self.binaries, "manifest.json.gz")
|
||||||
shutil.move(new_json_filepath, json_filepath)
|
shutil.move(new_json_filepath, json_filepath)
|
||||||
@ -664,7 +664,7 @@ is bob we will attempt to checkout bob-AVR'''
|
|||||||
os.environ["TMPDIR"] = self.tmpdir
|
os.environ["TMPDIR"] = self.tmpdir
|
||||||
|
|
||||||
print(self.tmpdir)
|
print(self.tmpdir)
|
||||||
self.remove_tmpdir();
|
self.remove_tmpdir()
|
||||||
|
|
||||||
self.progress("Building in %s" % self.tmpdir)
|
self.progress("Building in %s" % self.tmpdir)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user