From ab4f6113cff3789b0a8cc1a21383e9612da64ccb Mon Sep 17 00:00:00 2001 From: Teo Koon Peng Date: Mon, 5 Aug 2024 04:49:08 +0000 Subject: [PATCH] add __init__.py so older setuptools sees ros_pydantic Signed-off-by: Teo Koon Peng --- package.json | 4 ++-- .../api-server/api_server/models/ros_pydantic/__init__.py | 0 .../ros-translator/ros_translator/pydantic/__init__.py | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 packages/api-server/api_server/models/ros_pydantic/__init__.py diff --git a/package.json b/package.json index 1e2e2dd0d..647e597e4 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,8 @@ "prettier --write" ], "**/*.py": [ - ".venv/bin/isort", - ".venv/bin/black" + ".venv/bin/pipenv run isort", + ".venv/bin/pipenv run black" ] }, "overrides": { diff --git a/packages/api-server/api_server/models/ros_pydantic/__init__.py b/packages/api-server/api_server/models/ros_pydantic/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/packages/ros-translator/ros_translator/pydantic/__init__.py b/packages/ros-translator/ros_translator/pydantic/__init__.py index f17060eb0..35fe055df 100644 --- a/packages/ros-translator/ros_translator/pydantic/__init__.py +++ b/packages/ros-translator/ros_translator/pydantic/__init__.py @@ -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") @@ -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")