build: remove unused poetry files and fix shellcheck warnings

Remove the `extra/poetry` directory to eliminate high-severity vulnerabilities
flagged in unused protobuf dependencies. Also remove the reference to it from
`tools/set_version.sh` and fix existing shellcheck warnings in the script.
This commit is contained in:
Nick Cooke committed 2026-07-29 14:30:39 -04:00
1 parent f93018e682
commit b8f45c33bf
3 files changed
+5 -42

No files matched your search

-9
View File
@@ -1,9 +0,0 @@
#!/bin/bash
rm -rf nanopb
mkdir nanopb
cp -pr ../../generator nanopb/
touch nanopb/__init__.py nanopb/generator/__init__.py
cp -pr ../../README.md .
sed -i -e 's/\(version =.*\)-dev.*/\1-dev'$(git rev-list HEAD --count)'"/' pyproject.toml
poetry build
-26
View File
@@ -1,26 +0,0 @@
[tool.poetry]
name = "nanopb"
version = "0.3.9.10"
description = "Nanopb is a small code-size Protocol Buffers implementation in ansi C. It is especially suitable for use in microcontrollers, but fits any memory restricted system."
authors = ["Petteri Aimonen <jpa@npb.mail.kapsi.fi>"]
license = "Zlib"
repository = "https://github.com/nanopb/nanopb/"
readme = "README.md"
homepage = "https://jpa.kapsi.fi/nanopb/"
documentation = "https://jpa.kapsi.fi/nanopb/docs/index.html"
keywords = ["protobuf", "protoc"]
classifiers = ["Topic :: Software Development :: Build Tools"]
[tool.poetry.scripts]
nanopb_generator = "nanopb.generator.nanopb_generator:main_cli"
protoc-gen-nanopb = "nanopb.generator.nanopb_generator:main_plugin"
[tool.poetry.dependencies]
python = ">=2.7"
protobuf = ">=3.6"
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
+5 -7
View File
@@ -4,13 +4,11 @@
# e.g. user@localhost:~/nanopb$ tools/set_version.sh nanopb-0.1.9-dev
# It sets the version number in pb.h and generator/nanopb_generator.py.
sed -i -e 's/nanopb_version\s*=\s*"[^"]*"/nanopb_version = "'$1'"/' generator/nanopb_generator.py
sed -i -e 's/#define\s*NANOPB_VERSION\s*.*/#define NANOPB_VERSION '$1'/' pb.h
sed -i -e 's/set(\s*nanopb_VERSION_STRING\s*[^)]*)/set(nanopb_VERSION_STRING '$1')/' CMakeLists.txt
sed -i -e 's/nanopb_version\s*=\s*"[^"]*"/nanopb_version = "'"$1"'"/' generator/nanopb_generator.py
sed -i -e 's/#define\s*NANOPB_VERSION\s*.*/#define NANOPB_VERSION '"$1"'/' pb.h
sed -i -e 's/set(\s*nanopb_VERSION_STRING\s*[^)]*)/set(nanopb_VERSION_STRING '"$1"')/' CMakeLists.txt
VERSION_ONLY=$(echo $1 | sed 's/nanopb-//')
VERSION_ONLY="${1#nanopb-}"
if [[ $1 != *dev ]]
then sed -i -e 's/"version":\s*"[^"]*"/"version": "'$VERSION_ONLY'"/' library.json
then sed -i -e 's/"version":\s*"[^"]*"/"version": "'"$VERSION_ONLY"'"/' library.json
fi
sed -i -e 's/version =.*/version = "'$VERSION_ONLY'"/' extra/poetry/pyproject.toml