Skip to content

Commit

Permalink
Fix Dockerfile and build process
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmittag committed Sep 10, 2024
1 parent 41726d9 commit c6ade4f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
5 changes: 3 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@


[submodule "kuksa-databroker"]
path = submodules/kuksa-databroker
url = https://github.com/SoftwareDefinedVehicle/kuksa-databroker.git
branch = rel-0.5.0
url = https://github.com/boschglobal/kuksa-databroker.git
branch = prep-rel-0.5.0
2 changes: 1 addition & 1 deletion docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cd kuksa-client
Hint: If you want to use another branch than master exchange the first command with

```console
git submodule update --recursive --remote
git submodule update --recursive --remote --init
```

First we suggest you create a dedicated [python virtual environment](https://docs.python.org/3/library/venv.html) for kuksa-client:
Expand Down
3 changes: 3 additions & 0 deletions kuksa-client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ RUN pip install --upgrade pip build pyinstaller
# We must copy the whole repository otherwise version lookup by tag would not work
COPY . /kuksa-python-sdk/
WORKDIR /kuksa-python-sdk/kuksa-client
RUN git submodule update --recursive --remote --init
# install files from submodules to kuksa-client repo to generate protos out of it
RUN pip install -r requirements.txt -e .

RUN python3 -m build
# We install globally on build container, so pyinstaller can easily gather all files
Expand Down
15 changes: 8 additions & 7 deletions kuksa-client/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,7 @@ def finalize_options(self):

def run(self):
from grpc_tools import command # pylint: disable=import-outside-toplevel
for root, dirs, files in os.walk(PROTO_PATH):
for directory in dirs:
# Create an __init__.py file in each subdirectory
init_file = os.path.join(root, directory, "__init__.py")
with open(init_file, "w") as file:
file.write("# This file marks the directory as a Python module")
shutil.copytree(PROTO_PATH, os.getcwd(), dirs_exist_ok=True)

command.build_package_protos(".", strict_mode=True)


Expand All @@ -67,6 +61,13 @@ class SDistCommand(BuildPackageProtos, sdist.sdist):

class DevelopCommand(BuildPackageProtos, _develop):
def run(self):
for root, dirs, files in os.walk(PROTO_PATH):
for directory in dirs:
# Create an __init__.py file in each subdirectory
init_file = os.path.join(root, directory, "__init__.py")
with open(init_file, "w") as file:
file.write("# This file marks the directory as a Python module")
shutil.copytree(PROTO_PATH, os.getcwd(), dirs_exist_ok=True)
self.run_command("build_pb2")
super().run()

Expand Down

0 comments on commit c6ade4f

Please sign in to comment.