Skip to content

Commit b9c7d5e

Browse files
committed
Merged in feature/PROTO-270-include-the-source-code-folder (pull request #198)
Feature/PROTO-270 include the source code folder
2 parents cd6639c + 153668d commit b9c7d5e

File tree

7 files changed

+68
-3
lines changed

7 files changed

+68
-3
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
# Building and running unit tests
3+
To build the unit tests use: `./build_test.sh`
4+
To run the unit tests use: `./build/test/test_EmbeddedProto`
5+
6+
# Buildin the python package
7+
Activate the virtual env if not already active: `source ./venv/bin/activate`
8+
Build the package: `build_package.sh`
9+

.github/workflows/distribute_pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
run: python3 -m pip install build --user
1919

2020
- name: Build a binary wheel and a source tarball
21-
run: python3 -m build
21+
run: ./build_package.sh
2222

2323
- name: Store the distribution packages
2424
uses: actions/upload-artifact@v4

EmbeddedProto/EmbeddedProto.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ def run_protoc(argv=sys.argv):
4646
# Remove the program name
4747
argv.pop(0)
4848

49+
# Check if the --cpp-src-location parameter is present
50+
if "--cpp-src-location" in argv:
51+
# Get the location of the src folder
52+
src_location = str((resources.files("EmbeddedProto") / "src").resolve())
53+
print(src_location)
54+
# Exit the script after printing the source location
55+
return
56+
4957
# Check if the well known types should be included.
5058
argv = ["-I" + get_well_known_types_location() if x == "--IncludeWellKnownTypes" else x for x in argv]
5159

EmbeddedProto/templates/TypeDefMsg.h.jinja2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ class {{ typedef.get_name() }} final: public ::EmbeddedProto::MessageInterface
314314
using namespace ::EmbeddedProto;
315315
return
316316
{% for field in typedef.fields %}
317-
{{" +" if not loop.first }}{{field.get_type()}}::max_serialized_size(static_cast<uint32_t>(FieldNumber::{{field.variable_id_name}}))
317+
{{"+ " if not loop.first }}{{field.get_type()}}::max_serialized_size(static_cast<uint32_t>(FieldNumber::{{field.variable_id_name}}))
318318
{% endfor %}
319319
{% for oneof in typedef.oneofs %}
320320
{{"+ " if not loop.first or typedef.fields|length != 0}}max_serialized_size_{{oneof.get_name()}}()

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ This document details the following:
2727

2828
To stay up to date, signup for our [User Update](https://EmbeddedProto.com/signup).
2929

30+
## 4.0.0
31+
* TODO Installation via pip3: `pip install EmbeddedProto`. This will also install a matching version of protoc. So you do not need to install the protoc compiler yourself.
32+
* TODO Run EmbeddedProto as an executable: `embeddedproto -I YOUR_FOLDER YOUR_PROTO_FILE.proto`
33+
* Included the C++ source files in the python package. You can get the location of these C++ source files by running: `embeddedproto --cpp-src-location`.
34+
3035
## 3.6.0
3136
* Update to Protobuf version 32.0.
3237
* Increated the minimum python version to 3.10.

build_package.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (C) 2020-2025 Embedded AMS B.V. - All Rights Reserved
4+
#
5+
# This file is part of Embedded Proto.
6+
#
7+
# Embedded Proto is open source software: you can redistribute it and/or
8+
# modify it under the terms of the GNU General Public License as published
9+
# by the Free Software Foundation, version 3 of the license.
10+
#
11+
# Embedded Proto is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with Embedded Proto. If not, see <https://www.gnu.org/licenses/>.
18+
#
19+
# For commercial and closed source application please visit:
20+
# <https://embeddedproto.com/pricing/>.
21+
#
22+
# Embedded AMS B.V.
23+
# Info:
24+
# info at EmbeddedProto dot com
25+
#
26+
# Postal address:
27+
# Atoomweg 2
28+
# 1627 LE, Hoorn
29+
# the Netherlands
30+
#
31+
32+
# Remove old builds
33+
rm -rf dist/*
34+
rm -rf EmbeddedProto.egg-info
35+
36+
# Copy src/ to EmbeddedProto/src/
37+
cp -r src EmbeddedProto/
38+
39+
# Run the build
40+
python3 -m build
41+
42+
# Clean up
43+
rm -rf EmbeddedProto/src

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ protoc-gen-eams = "EmbeddedProto.main:main_plugin"
2727
embeddedproto = "EmbeddedProto.EmbeddedProto:run_protoc"
2828

2929
[tool.setuptools.package-data]
30-
EmbeddedProto = ["templates/*", "version.json"]
30+
EmbeddedProto = ["templates/*", "version.json", "src/*"]
3131

3232
[build-system]
3333
requires = ["setuptools>=64", "grpcio-tools==1.75.0"]

0 commit comments

Comments
 (0)