Skip to content

LCM ppath / package-prefix mix results in unexpected behaviour #600

@gregor-pr

Description

@gregor-pr

My project looks like this:

src
  lcm
    message1.lcm
    message2.lcm
  python
    interfaces
      lcm_generated

I want to generate python messages into lcm_generated. When I run
lcm-gen -p --ppath src/python --package-prefix interfaces.lcm_generated src/lcm-types/*.lcm, I get an odd result, where the __init__.py in lcm_generated/package_name/__init__.py contains a subset of the LCM types, for example:

"""LCM package __init__.py file
This file automatically generated by lcm-gen.
DO NOT MODIFY BY HAND!!!!
lcm-gen 1.5.1
"""

from .message1 import foo as foo

if I run the same command with a broken package prefix (notice the / instead of . to separate modules), e.g. lcm-gen -p --ppath src/python --package-prefix interfaces/lcm_generated src/lcm-types/*.lcm,

I get a complete list of the LCM types, such as

"""LCM package __init__.py file
This file automatically generated by lcm-gen.
DO NOT MODIFY BY HAND!!!!
lcm-gen 1.5.1
"""

from .message1 import foo as foo
from .message2 import foo as foo

but the actual message1/2.py files will contain the broken prefix:

import interfaces/lcm_generated.std

if I set the prefix to just one module, the generated files are fine:
lcm-gen -p --ppath src/python --package-prefix lcm_generated src/lcm-types/*.lcm but they'll be generated in the wrong folder. I can extend the ppath like
lcm-gen -p --ppath src/python/interfaces --package-prefix lcm_generated src/lcm-types/*.lcm but that has other implications for my code.

No good solution other than keeping the generated code in the top level python path folder 🤷

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions