mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-19 22:09:07 +08:00
Read only permissions for generated types
This commit is contained in:
parent
c035dd4436
commit
fdfe5938c2
@ -18,6 +18,7 @@ from pyuavcan import dsdl
|
||||
|
||||
MAX_BITLEN_FOR_ENUM = 31
|
||||
CPP_HEADER_EXTENSION = 'hpp'
|
||||
CPP_HEADER_PERMISSIONS = 0o444 # Read only for all
|
||||
TEMPLATE_FILENAME = os.path.join(os.path.dirname(__file__), 'data_type_template.hpp')
|
||||
|
||||
# -----------------
|
||||
@ -64,8 +65,12 @@ def run_generator(types, dest_dir):
|
||||
text = generate_one_type(t)
|
||||
with open(file_path, 'w') as f:
|
||||
f.write(text)
|
||||
try:
|
||||
os.chmod(file_path, CPP_HEADER_PERMISSIONS)
|
||||
except (OSError, IOError) as ex:
|
||||
logging.warning('Failed to set permissions for %s: %s', file_path, ex)
|
||||
except Exception as ex:
|
||||
logging.info('Generator error', exc_info=True)
|
||||
logging.info('Generator failure', exc_info=True)
|
||||
die(str(ex))
|
||||
|
||||
def type_to_cpp_type(t):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user