mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-06 19:00:27 +08:00
Tools: allowed_subsystems.py fix to support AC_PosControl
This commit is contained in:
@@ -70,11 +70,6 @@ class AllowedSubsystems(object):
|
||||
'Replay',
|
||||
'AP_Periph',
|
||||
'AP_Bootloader',
|
||||
# class / sub-library prefixes in common use that are not their own
|
||||
# libraries/ directory
|
||||
'AC_PosControl',
|
||||
'AC_Circle',
|
||||
'AP_MotorsHeli',
|
||||
'mavlink',
|
||||
}
|
||||
|
||||
@@ -102,6 +97,14 @@ class AllowedSubsystems(object):
|
||||
('Tools/Replay/', ['Replay']),
|
||||
]
|
||||
|
||||
# prefixes that are used but do not match the directory they are in
|
||||
# list includes the directory name and alternative prefixes that may be used
|
||||
SPECIAL_SUBSYSTEMS = {
|
||||
'AC_AttitudeControl': ['AC_PosControl'],
|
||||
'AC_WPNav': ['AC_Circle'],
|
||||
'AP_Motors': ['AP_MotorsHeli'],
|
||||
}
|
||||
|
||||
# Top-level directory (other than vehicles, libraries and the special cases
|
||||
# above) -> ordered candidate subsystems.
|
||||
TOPLEVEL_DIR_SUBSYSTEMS = {
|
||||
@@ -171,8 +174,14 @@ class AllowedSubsystems(object):
|
||||
created_dirs is an iterable of libraries/ subdirectory names that a
|
||||
commit creates; they are allowed even if they do not yet exist on disk.
|
||||
'''
|
||||
special_subsystems = {
|
||||
sub_prefix
|
||||
for sub_prefixes in self.SPECIAL_SUBSYSTEMS.values()
|
||||
for sub_prefix in sub_prefixes
|
||||
}
|
||||
return (self.library_dirs()
|
||||
| set(self.CURATED_SUBSYSTEMS)
|
||||
| special_subsystems
|
||||
| set(created_dirs))
|
||||
|
||||
def subsystems_for_path(self, path):
|
||||
@@ -203,6 +212,11 @@ class AllowedSubsystems(object):
|
||||
# libraries/<HAL>/hwdef/... belongs to hwdef as well as the HAL
|
||||
if len(parts) >= 4 and parts[2] == 'hwdef':
|
||||
return [lib, 'hwdef']
|
||||
# allow special prefixes from SPECIAL_SUBSYSTEMS
|
||||
filename = parts[-1]
|
||||
for sub_prefix in self.SPECIAL_SUBSYSTEMS.get(lib, []):
|
||||
if filename.startswith(sub_prefix):
|
||||
return [lib, sub_prefix]
|
||||
return [lib]
|
||||
|
||||
# most-specific-first special directory rules
|
||||
|
||||
Reference in New Issue
Block a user