mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-28 18:53:57 -04:00
Tools: generate_manifest.py: make flake8 clean
This commit is contained in:
parent
4008df1314
commit
3f5cde4bb1
@ -1,6 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import copy
|
'''
|
||||||
|
AP_FLAKE8_CLEAN
|
||||||
|
'''
|
||||||
|
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import gen_stable
|
import gen_stable
|
||||||
import gzip
|
import gzip
|
||||||
@ -111,6 +114,7 @@ brand_map = {
|
|||||||
"GEPRC_TAKER_H743": ("TAKER H743 BT", "GEPRC"),
|
"GEPRC_TAKER_H743": ("TAKER H743 BT", "GEPRC"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class Firmware():
|
class Firmware():
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
date=None,
|
date=None,
|
||||||
@ -198,7 +202,7 @@ class ManifestGenerator():
|
|||||||
'''parses get-version.txt (as emitted by build_binaries.py, returns
|
'''parses get-version.txt (as emitted by build_binaries.py, returns
|
||||||
git sha from it'''
|
git sha from it'''
|
||||||
content = open(filepath).read()
|
content = open(filepath).read()
|
||||||
sha_regex = re.compile("APMVERSION: \S+\s+(\S+)")
|
sha_regex = re.compile(r"APMVERSION: \S+\s+(\S+)")
|
||||||
m = sha_regex.search(content)
|
m = sha_regex.search(content)
|
||||||
if m is None:
|
if m is None:
|
||||||
raise Exception(
|
raise Exception(
|
||||||
@ -349,7 +353,7 @@ class ManifestGenerator():
|
|||||||
vehicletype,
|
vehicletype,
|
||||||
releasetype="dev"):
|
releasetype="dev"):
|
||||||
'''accumulate additional information about firmwares from directory'''
|
'''accumulate additional information about firmwares from directory'''
|
||||||
variant_firmware_regex = re.compile("[^-]+-(?P<variant>v\d+)[.px4]")
|
variant_firmware_regex = re.compile(r"[^-]+-(?P<variant>v\d+)[.px4]")
|
||||||
if not os.path.isdir(dir):
|
if not os.path.isdir(dir):
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
@ -393,7 +397,7 @@ class ManifestGenerator():
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
print("malformed firmware-version.txt at (%s)" % (firmware_version_file,), file=sys.stderr)
|
print("malformed firmware-version.txt at (%s)" % (firmware_version_file,), file=sys.stderr)
|
||||||
continue
|
continue
|
||||||
except Exception as ex:
|
except Exception:
|
||||||
print("bad file %s" % firmware_version_file, file=sys.stderr)
|
print("bad file %s" % firmware_version_file, file=sys.stderr)
|
||||||
# this exception is swallowed.... the current archive
|
# this exception is swallowed.... the current archive
|
||||||
# is incomplete.
|
# is incomplete.
|
||||||
@ -488,7 +492,7 @@ class ManifestGenerator():
|
|||||||
def walk_directory(self, basedir):
|
def walk_directory(self, basedir):
|
||||||
'''walks directory structure created by build_binaries, returns Python
|
'''walks directory structure created by build_binaries, returns Python
|
||||||
structure representing releases in that structure'''
|
structure representing releases in that structure'''
|
||||||
year_month_regex = re.compile("(?P<year>\d{4})-(?P<month>\d{2})")
|
year_month_regex = re.compile(r"(?P<year>\d{4})-(?P<month>\d{2})")
|
||||||
|
|
||||||
firmwares = []
|
firmwares = []
|
||||||
|
|
||||||
@ -568,7 +572,6 @@ class ManifestGenerator():
|
|||||||
|
|
||||||
self.add_USB_IDs(some_json)
|
self.add_USB_IDs(some_json)
|
||||||
|
|
||||||
#print(some_json['url'])
|
|
||||||
firmware_json.append(some_json)
|
firmware_json.append(some_json)
|
||||||
|
|
||||||
# now the features the firmware supports...
|
# now the features the firmware supports...
|
||||||
@ -649,6 +652,7 @@ class ManifestGenerator():
|
|||||||
'''write generated features JSON content to path'''
|
'''write generated features JSON content to path'''
|
||||||
self.write_json(self.json_features(), path)
|
self.write_json(self.json_features(), path)
|
||||||
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
return '''Usage:
|
return '''Usage:
|
||||||
generate-manifest.py basedir'''
|
generate-manifest.py basedir'''
|
||||||
|
Loading…
Reference in New Issue
Block a user