Skip to content

Commit

Permalink
add __init__.py so older setuptools sees ros_pydantic
Browse files Browse the repository at this point in the history
Signed-off-by: Teo Koon Peng <teokoonpeng@gmail.com>
  • Loading branch information
koonpeng committed Aug 5, 2024
1 parent 535c3d6 commit ab4f611
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"prettier --write"
],
"**/*.py": [
".venv/bin/isort",
".venv/bin/black"
".venv/bin/pipenv run isort",
".venv/bin/pipenv run black"
]
},
"overrides": {
Expand Down
Empty file.
7 changes: 6 additions & 1 deletion packages/ros-translator/ros_translator/pydantic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ def generate_messages(roslib: RosLibrary, pkg: str, outdir: str):


def generate_init(namespace: Namespace, outdir: str):
with open(joinp(outdir, namespace.full_name, "__init__.py"), mode="w") as f:
with open(
joinp(outdir, namespace.full_name, "__init__.py"), mode="w", encoding="utf8"
) as f:
for m in namespace.messages.values():
name = m.structure.namespaced_type.name
f.write(f"from .{name} import {name}\n")
Expand All @@ -140,6 +142,9 @@ def generate_modules(pkgs: Sequence[str], outdir: str):
generate_messages(roslib, pkg_index.pkg_name, outdir)
generate_init(pkg_index.root_ns, outdir)

with open(joinp(outdir, "__init__.py"), mode="w", encoding="utf8"):
pass


def generate(pkgs: Sequence[str], outdir: str):
print("Generating pydantic interfaces")
Expand Down

0 comments on commit ab4f611

Please sign in to comment.