Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 0 additions & 2 deletions kuksa-client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ RUN pip install --upgrade pip build pyinstaller
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 python3 -m proto

RUN python3 -m build
# We install globally on build container, so pyinstaller can easily gather all files
Expand Down
31 changes: 27 additions & 4 deletions kuksa-client/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,28 @@
from setuptools.command.develop import develop as _develop


class BuildGenerateProtos(setuptools.Command):
def run(self):
self.run_command('generate_proto')
return super().run()


class GenerateProtosCommand(setuptools.Command):
"""Command to run proto.py script."""
user_options = []

def initialize_options(self):
pass

def finalize_options(self):
pass

def run(self):
import subprocess # pylint: disable=import-outside-toplevel

subprocess.call(['python', 'proto.py'])


class BuildPackageProtos(setuptools.Command):
def run(self):
self.run_command('build_pb2')
Expand All @@ -42,19 +64,19 @@ def run(self):
command.build_package_protos(".", strict_mode=True)


class BuildCommand(BuildPackageProtos, build.build):
class BuildCommand(BuildGenerateProtos, BuildPackageProtos, build.build):
...


class BuildPyCommand(BuildPackageProtos, build_py.build_py): # pylint: disable=too-many-ancestors
class BuildPyCommand(BuildGenerateProtos, BuildPackageProtos, build_py.build_py): # pylint: disable=too-many-ancestors
...


class SDistCommand(BuildPackageProtos, sdist.sdist):
class SDistCommand(BuildGenerateProtos, BuildPackageProtos, sdist.sdist):
...


class DevelopCommand(BuildPackageProtos, _develop):
class DevelopCommand(BuildGenerateProtos, BuildPackageProtos, _develop):

def run(self):
self.run_command("build_pb2")
Expand All @@ -63,6 +85,7 @@ def run(self):

setuptools.setup(
cmdclass={
"generate_proto": GenerateProtosCommand,
"build": BuildCommand,
"build_pb2": BuildPackageProtosCommand,
"build_py": BuildPyCommand, # Used for editable installs but also for building wheels
Expand Down