Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit export of Objects and py.typed #205

Open
wants to merge 3 commits into
base: rolling
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions rosidl_generator_py/rosidl_generator_py/generate_py_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,36 +130,42 @@ def print_warning_if_reserved_keyword(member_name, interface_type, interface_nam
sorted((value, key) for (key, value) in module_names.items()):
f.write(
f'from {package_name}.{subfolder}.{module_name} import '
f'{idl_stem} # noqa: F401\n')
f'{idl_stem} as {idl_stem} # noqa: F401\n')
if subfolder == 'srv':
f.write(
f'from {package_name}.{subfolder}.{module_name} import '
f'{idl_stem}_Event # noqa: F401\n')
f'{idl_stem}_Event as {idl_stem}_Event # noqa: F401\n')
f.write(
f'from {package_name}.{subfolder}.{module_name} import '
f'{idl_stem}_Request # noqa: F401\n')
f'{idl_stem}_Request as {idl_stem}_Request # noqa: F401\n')
f.write(
f'from {package_name}.{subfolder}.{module_name} import '
f'{idl_stem}_Response # noqa: F401\n')
f'{idl_stem}_Response as {idl_stem}_Response # noqa: F401\n')
elif subfolder == 'action':
f.write(
f'from {package_name}.{subfolder}.{module_name} import '
f'{idl_stem}_GetResult_Event # noqa: F401\n')
f'{idl_stem}_GetResult_Event as {idl_stem}_GetResult_Event'
' # noqa: F401\n')
f.write(
f'from {package_name}.{subfolder}.{module_name} import '
f'{idl_stem}_GetResult_Request # noqa: F401\n')
f'{idl_stem}_GetResult_Request as {idl_stem}_GetResult_Request'
' # noqa: F401\n')
f.write(
f'from {package_name}.{subfolder}.{module_name} import '
f'{idl_stem}_GetResult_Response # noqa: F401\n')
f'{idl_stem}_GetResult_Response as {idl_stem}_GetResult_Response'
' # noqa: F401\n')
f.write(
f'from {package_name}.{subfolder}.{module_name} import '
f'{idl_stem}_SendGoal_Event # noqa: F401\n')
f'{idl_stem}_SendGoal_Event as {idl_stem}_SendGoal_Event'
' # noqa: F401\n')
f.write(
f'from {package_name}.{subfolder}.{module_name} import '
f'{idl_stem}_SendGoal_Request # noqa: F401\n')
f'{idl_stem}_SendGoal_Request as {idl_stem}_SendGoal_Request'
' # noqa: F401\n')
f.write(
f'from {package_name}.{subfolder}.{module_name} import '
f'{idl_stem}_SendGoal_Response # noqa: F401\n')
f'{idl_stem}_SendGoal_Response as {idl_stem}_SendGoal_Response'
' # noqa: F401\n')

# expand templates per available typesupport implementation
template_dir = args['template_dir']
Expand Down Expand Up @@ -192,6 +198,10 @@ def print_warning_if_reserved_keyword(member_name, interface_type, interface_nam
minimum_timestamp=latest_target_timestamp)
generated_files.append(generated_file)

# Generate py.typed to mark the generate files as having type support as according to PEP561.
with open(os.path.join(args['output_dir'], 'py.typed'), 'w', encoding='utf-8'):
pass

return generated_files


Expand Down