From 9985ca8b9a94215bb04c0a60b4ccd4e9f8735f94 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Tue, 30 Apr 2019 23:35:10 +0100 Subject: [PATCH 01/15] Revert "Revert "Attempt to fix Protobuf 3.7 builds"" This reverts commit b878fb9d02dd790b305cda89450946191076631f. --- configure.ac | 3 +++ protoc/StrUtil.cpp | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/configure.ac b/configure.ac index 0702a817c7..726ae766b0 100644 --- a/configure.ac +++ b/configure.ac @@ -858,6 +858,9 @@ AS_IF([test "${enable_rdm_tests}" = "yes"], AS_IF([test "x$build_java_libs" = xyes], [PROTOBUF_SUPPORT([2.4.0])], [PROTOBUF_SUPPORT([2.3.0])]) +# Version 3.7 and above of protoc require some additional includes +AC_CHECK_HEADERS([google/protobuf/io/strtod.h google/protobuf/stubs/logging.h \ + google/protobuf/stubs/stl_util.h]) # Doxygen diff --git a/protoc/StrUtil.cpp b/protoc/StrUtil.cpp index 85891a6a46..2914e82f12 100644 --- a/protoc/StrUtil.cpp +++ b/protoc/StrUtil.cpp @@ -41,6 +41,16 @@ #include "protoc/StrUtil.h" +#ifdef HAVE_GOOGLE_PROTOBUF_IO_STRTOD_H +#include +#endif // HAVE_GOOGLE_PROTOBUF_IO_STRTOD_H +#ifdef HAVE_GOOGLE_PROTOBUF_STUBS_LOGGING_H +#include +#endif // HAVE_GOOGLE_PROTOBUF_STUBS_LOGGING_H +#ifdef HAVE_GOOGLE_PROTOBUF_STUBS_STL_UTIL_H +#include +#endif // HAVE_GOOGLE_PROTOBUF_STUBS_STL_UTIL_H + #ifdef _WIN32 // MSVC has only _snprintf, not snprintf. // From 3a7b93ffefb1faa7948faa92ea29c965db9db1b1 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Tue, 30 Apr 2019 23:35:14 +0100 Subject: [PATCH 02/15] Revert "Revert "Add the missing config.h include"" This reverts commit 59ea348f9e4748238705b37db04b5cbfd29939cf. --- protoc/StrUtil.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/protoc/StrUtil.cpp b/protoc/StrUtil.cpp index 2914e82f12..d300b71e86 100644 --- a/protoc/StrUtil.cpp +++ b/protoc/StrUtil.cpp @@ -41,6 +41,11 @@ #include "protoc/StrUtil.h" +#if HAVE_CONFIG_H +#include +#endif // HAVE_CONFIG_H + +// Required for Protobuf 3.7 onwards #ifdef HAVE_GOOGLE_PROTOBUF_IO_STRTOD_H #include #endif // HAVE_GOOGLE_PROTOBUF_IO_STRTOD_H From 250b0b4bf372926bf2e093406625dabcaaf2d757 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Tue, 30 Apr 2019 23:38:30 +0100 Subject: [PATCH 03/15] Revert "Revert "Switch to protobuf 3.7/latest"" This reverts commit 8ec45af9174afc5dace160dce8356c55e02c4751. --- .travis.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index de742d2b26..9965a4d129 100644 --- a/.travis.yml +++ b/.travis.yml @@ -77,6 +77,7 @@ matrix: env: - TASK='compile' - CPPUNIT='1.14' + - PROTOBUF='latest' - LIBFTDI='1' - os: osx osx_image: xcode9.3 @@ -84,6 +85,7 @@ matrix: env: - TASK='compile' - CPPUNIT='1.14' + - PROTOBUF='latest' - LIBFTDI='1' - os: linux dist: xenial @@ -286,7 +288,8 @@ before_cache: install: # Match the version of protobuf being installed via apt - - pip install --user protobuf==3.1.0 +  - if [[ "$PROTOBUF" == "latest" ]]; then pip install --user protobuf; fi + - if [[ "$PROTOBUF" != "latest" ]]; then pip install --user protobuf==3.1.0; fi # We need to use pip rather than apt on Xenial - if [ "$TRAVIS_OS_NAME" == "linux" ]; then pip install --user numpy; fi - if [ "$TASK" = "coverage" ]; then pip install --user cpp-coveralls; fi @@ -304,7 +307,9 @@ before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ccache bison flex protobuf@3.1 liblo libmicrohttpd; fi # ossp-uuid, homebrew/python/numpy and libusb already present - if [ "$TRAVIS_OS_NAME" == "osx" -a "$LIBFTDI" != "1" ]; then brew install libftdi0; fi # install libftdi0 - if [ "$TRAVIS_OS_NAME" == "osx" -a "$LIBFTDI" == "1" ]; then brew install libftdi; fi # install the latest libftdi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link -f protobuf@3.1; export PKG_CONFIG_PATH=/usr/local/opt/protobuf@3.1/lib/pkgconfig; brew install --build-from-source --ignore-dependencies --env=std protobuf-c; fi # While protobuf is not on the latest release + - if [ "$TRAVIS_OS_NAME" == "osx" -a "$PROTOBUF" == "latest" ]; then brew install protobuf; fi + - if [ "$TRAVIS_OS_NAME" == "osx" -a "$PROTOBUF" != "latest" ]; then brew install protobuf@3.1; fi + - if [ "$TRAVIS_OS_NAME" == "osx" -a "$PROTOBUF" != "latest" ]; then brew link -f protobuf@3.1; export PKG_CONFIG_PATH=/usr/local/opt/protobuf@3.1/lib/pkgconfig; brew install --build-from-source --ignore-dependencies --env=std protobuf-c; fi # When protobuf is not on the latest release - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir -p ${HOME}/Library/Python/2.7/lib/python/site-packages; echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> ${HOME}/Library/Python/2.7/lib/python/site-packages/homebrew.pth; fi - if [ "$TRAVIS_OS_NAME" == "osx" -a "$CPPUNIT" != "1.14" ]; then brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/e6e43cf6a3%5E/Formula/cppunit.rb; fi # install a slightly older cppunit, as latest needs C++11 support - if [ "$TRAVIS_OS_NAME" == "osx" -a "$CPPUNIT" == "1.14" ]; then brew install cppunit; fi # install the latest cppunit, which needs C++11 From cb7b1d8ac6593fdc11c564167fe214ab0678cae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20M=C3=BCllner?= Date: Tue, 21 Apr 2020 21:03:02 +0200 Subject: [PATCH 04/15] Eliminate protobuf AddDescriptors() call. See: https://raw.githubusercontent.com/openwrt/packages/master/net/ola/patches/001-Eliminate-protobuf-AddDescriptors-call.patch --- protoc/CppFileGenerator.cpp | 8 -------- protoc/GeneratorHelpers.cpp | 5 ----- protoc/GeneratorHelpers.h | 3 --- 3 files changed, 16 deletions(-) diff --git a/protoc/CppFileGenerator.cpp b/protoc/CppFileGenerator.cpp index 518c17879d..e7dd95ccb0 100644 --- a/protoc/CppFileGenerator.cpp +++ b/protoc/CppFileGenerator.cpp @@ -196,14 +196,6 @@ void FileGenerator::GenerateBuildDescriptors(Printer* printer) { "assigndescriptorsname", GlobalAssignDescriptorsName(m_output_name)); printer->Indent(); - // Make sure the file has found its way into the pool. If a descriptor - // is requested *during* static init then AddDescriptors() may not have - // been called yet, so we call it manually. Note that it's fine if - // AddDescriptors() is called multiple times. - printer->Print( - "$adddescriptorsname$();\n", - "adddescriptorsname", GlobalAddDescriptorsName(m_file->name())); - // Get the file's descriptor from the pool. printer->Print( "const ::google::protobuf::FileDescriptor* file =\n" diff --git a/protoc/GeneratorHelpers.cpp b/protoc/GeneratorHelpers.cpp index 19609181e4..6f619b5c0c 100644 --- a/protoc/GeneratorHelpers.cpp +++ b/protoc/GeneratorHelpers.cpp @@ -104,11 +104,6 @@ string FilenameIdentifier(const string& filename) { return result; } -// Return the name of the AddDescriptors() function for a given file. -string GlobalAddDescriptorsName(const string& filename) { - return "protobuf_AddDesc_" + FilenameIdentifier(filename); -} - // Return the name of the AssignDescriptors() function for a given file. string GlobalAssignDescriptorsName(const string& filename) { return "protobuf_AssignDesc_" + FilenameIdentifier(filename); diff --git a/protoc/GeneratorHelpers.h b/protoc/GeneratorHelpers.h index 35efdbb043..fa91a915dc 100644 --- a/protoc/GeneratorHelpers.h +++ b/protoc/GeneratorHelpers.h @@ -67,9 +67,6 @@ string StripProto(const string& filename); // Convert a file name into a valid identifier. string FilenameIdentifier(const string& filename); -// Return the name of the AddDescriptors() function for a given file. -string GlobalAddDescriptorsName(const string& filename); - // Return the name of the AssignDescriptors() function for a given file. string GlobalAssignDescriptorsName(const string& filename); From 6b89ed4b96c83ad6b24e83e7a4617969bf9bc375 Mon Sep 17 00:00:00 2001 From: Jannis Achstetter Date: Sun, 15 Mar 2020 00:29:18 +0100 Subject: [PATCH 05/15] Change code snippets in our protoc-plugin so the code works with protobuf-3.11 --- protoc/CppFileGenerator.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/protoc/CppFileGenerator.cpp b/protoc/CppFileGenerator.cpp index e7dd95ccb0..1a58f215b0 100644 --- a/protoc/CppFileGenerator.cpp +++ b/protoc/CppFileGenerator.cpp @@ -220,6 +220,10 @@ void FileGenerator::GenerateBuildDescriptors(Printer* printer) { // protobuf_AssignDescriptorsOnce(): The first time it is called, calls // AssignDescriptors(). All later times, waits for the first call to // complete and then returns. + + // We need to generate different code, depending on the version + // of protobuf we compile against +#if GOOGLE_PROTOBUF_VERSION < 3007000 printer->Print( "namespace {\n" "\n" @@ -233,6 +237,19 @@ void FileGenerator::GenerateBuildDescriptors(Printer* printer) { "assigndescriptorsname", GlobalAssignDescriptorsName(m_output_name)); printer->Print("} // namespace\n"); +#else + printer->Print( + "namespace {\n" + "\n" + "inline void protobuf_AssignDescriptorsOnce() {\n" + " static ::google::protobuf::internal::once_flag once;\n" + " ::google::protobuf::internal::call_once(once,\n" + " &$assigndescriptorsname$);\n" + "}\n" + "\n", + "assigndescriptorsname", GlobalAssignDescriptorsName(m_output_name)); + printer->Print("} // namespace\n"); +#endif } } From 2f1b33662fe5f6c5d054218f95e2412cdb4b2f65 Mon Sep 17 00:00:00 2001 From: Jannis Achstetter Date: Wed, 8 Apr 2020 12:25:50 +0200 Subject: [PATCH 06/15] Revert "Throw an error if we don't have an old enough protobuf, until we fix #1192, rather than a confusing compiler error" This reverts commit d999217ef66e33292136fa9e103c5e2d45291227. --- config/ola.m4 | 3 --- 1 file changed, 3 deletions(-) diff --git a/config/ola.m4 b/config/ola.m4 index 6080932e9a..d3b8cc8f8e 100644 --- a/config/ola.m4 +++ b/config/ola.m4 @@ -24,9 +24,6 @@ AC_DEFUN([PROTOBUF_SUPPORT], AC_REQUIRE_CPP() PKG_CHECK_MODULES(libprotobuf, [protobuf >= $1]) -PKG_CHECK_MODULES(libprotobuf2, [protobuf < 3.2], [], - [AC_MSG_ERROR([OLA currently requires protobuf < 3.2, see issue 1192])]) - AC_SUBST([libprotobuf_CFLAGS]) AC_ARG_WITH([protoc], From 35c994235008780c73f609a1930696396874913c Mon Sep 17 00:00:00 2001 From: Jannis Achstetter Date: Thu, 9 Apr 2020 22:05:23 +0200 Subject: [PATCH 07/15] Travis: Fix Protobuf-installation on macOS and add two more macOS builds in allow_failures section. According to https://formulae.brew.sh/formula/protobuf, protobuf@3.6 is the oldest version available. --- .travis.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9965a4d129..ee6a9bf816 100644 --- a/.travis.yml +++ b/.travis.yml @@ -238,6 +238,22 @@ matrix: - TASK='compile' - CPPUNIT='1.14' - LIBFTDI='1' + - os: osx + osx_image: xcode9.3 + compiler: clang + env: + - TASK='compile' + - CPPUNIT='1.14' + - LIBFTDI='1' + - PROTOBUF='latest' + - os: osx + osx_image: xcode9.3 + compiler: gcc + env: + - TASK='compile' + - CPPUNIT='1.14' + - LIBFTDI='1' + - PROTOBUF='latest' - os: linux dist: xenial compiler: gcc @@ -304,12 +320,12 @@ before_install: #Fix a broken homebrew python upgrade - see https://github.com/Homebrew/homebrew-core/issues/26358 - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew upgrade python || true; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then if [ ! -d /usr/local/sbin ]; then sudo mkdir -p /usr/local/sbin && sudo chown -R $(whoami) /usr/local/sbin; fi; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ccache bison flex protobuf@3.1 liblo libmicrohttpd; fi # ossp-uuid, homebrew/python/numpy and libusb already present + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ccache bison flex liblo libmicrohttpd; fi # ossp-uuid, homebrew/python/numpy and libusb already present - if [ "$TRAVIS_OS_NAME" == "osx" -a "$LIBFTDI" != "1" ]; then brew install libftdi0; fi # install libftdi0 - if [ "$TRAVIS_OS_NAME" == "osx" -a "$LIBFTDI" == "1" ]; then brew install libftdi; fi # install the latest libftdi - if [ "$TRAVIS_OS_NAME" == "osx" -a "$PROTOBUF" == "latest" ]; then brew install protobuf; fi - - if [ "$TRAVIS_OS_NAME" == "osx" -a "$PROTOBUF" != "latest" ]; then brew install protobuf@3.1; fi - - if [ "$TRAVIS_OS_NAME" == "osx" -a "$PROTOBUF" != "latest" ]; then brew link -f protobuf@3.1; export PKG_CONFIG_PATH=/usr/local/opt/protobuf@3.1/lib/pkgconfig; brew install --build-from-source --ignore-dependencies --env=std protobuf-c; fi # When protobuf is not on the latest release + - if [ "$TRAVIS_OS_NAME" == "osx" -a "$PROTOBUF" != "latest" ]; then brew install protobuf@3.6; fi + - if [ "$TRAVIS_OS_NAME" == "osx" -a "$PROTOBUF" != "latest" ]; then brew link -f protobuf@3.6; export PKG_CONFIG_PATH=/usr/local/opt/protobuf@3.6/lib/pkgconfig; brew install --build-from-source --ignore-dependencies --env=std protobuf-c; fi # When protobuf is not on the latest release - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir -p ${HOME}/Library/Python/2.7/lib/python/site-packages; echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> ${HOME}/Library/Python/2.7/lib/python/site-packages/homebrew.pth; fi - if [ "$TRAVIS_OS_NAME" == "osx" -a "$CPPUNIT" != "1.14" ]; then brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/e6e43cf6a3%5E/Formula/cppunit.rb; fi # install a slightly older cppunit, as latest needs C++11 support - if [ "$TRAVIS_OS_NAME" == "osx" -a "$CPPUNIT" == "1.14" ]; then brew install cppunit; fi # install the latest cppunit, which needs C++11 From 877acda54ca31c1132656f4d3761ee61affceaf6 Mon Sep 17 00:00:00 2001 From: Jannis Achstetter Date: Tue, 21 Apr 2020 21:24:12 +0200 Subject: [PATCH 08/15] Add Jannis Achstetter to AUTHORS file --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index e04f78657b..d1844f8e92 100644 --- a/AUTHORS +++ b/AUTHORS @@ -12,6 +12,7 @@ Contributors: Hakan Lindestaf, Renard plugin Harry F, for the Eurolite USB Pro code Heikki Junnila, bug fixes for the debian packaging files + Jannis Achstetter, Compile fixes for newer dependencies Laurent (Renzo), Debian packages, FreeBSD & RDM testing. Lukas Erlinghagen, win32 port. Johan Nilsson, Philips Hue trigger config From 3f72d4aac7061a013bb0b124c5ce77fb05983adb Mon Sep 17 00:00:00 2001 From: Jannis Achstetter Date: Tue, 21 Apr 2020 21:26:25 +0200 Subject: [PATCH 09/15] Add compatibiltiy fixes to NEWS file --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index edff8d3c54..3fa8d7b782 100644 --- a/NEWS +++ b/NEWS @@ -32,6 +32,8 @@ x/y/2019 ola-0.10.8 Python API * Renamed RESONSE_INVALID_DESTINATION(sic) to RESPONSE_INVALID_DESTINATION in the ArduinoWidget code + * Fix compatibility with ncurses 6 + * Fix compatibility with newer versions of Protobuf Internal: * From 659f8ea5d172d8e2b9ba255c1b935f450adafd0b Mon Sep 17 00:00:00 2001 From: Jannis Achstetter Date: Fri, 8 May 2020 21:36:16 +0200 Subject: [PATCH 10/15] Make AUTHORS file consistent with the existing entries --- AUTHORS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index bbd81e67e0..084ff0b696 100644 --- a/AUTHORS +++ b/AUTHORS @@ -13,7 +13,7 @@ Contributors: Hakan Lindestaf, Renard plugin Harry F, for the Eurolite USB Pro code Heikki Junnila, bug fixes for the debian packaging files - Jannis Achstetter, Compile fixes for newer dependencies + Jannis Achstetter, compile fixes for newer dependencies Laurent (Renzo), Debian packages, FreeBSD & RDM testing. Lukas Erlinghagen, win32 port. Johan Nilsson, Philips Hue trigger config From a0f34bbb9b1736d16fb3bc85604f0fc1b902cb2c Mon Sep 17 00:00:00 2001 From: Jannis Achstetter Date: Fri, 8 May 2020 21:50:32 +0200 Subject: [PATCH 11/15] Don't remove the old protobuf code but make it depend on protobuf version instead --- protoc/CppFileGenerator.cpp | 11 +++++++++++ protoc/GeneratorHelpers.cpp | 8 ++++++++ protoc/GeneratorHelpers.h | 6 ++++++ 3 files changed, 25 insertions(+) diff --git a/protoc/CppFileGenerator.cpp b/protoc/CppFileGenerator.cpp index 1a58f215b0..ee93afc144 100644 --- a/protoc/CppFileGenerator.cpp +++ b/protoc/CppFileGenerator.cpp @@ -196,6 +196,17 @@ void FileGenerator::GenerateBuildDescriptors(Printer* printer) { "assigndescriptorsname", GlobalAssignDescriptorsName(m_output_name)); printer->Indent(); + // No longer needed since protobuf 3.7 +#if GOOGLE_PROTOBUF_VERSION < 3007000 + // Make sure the file has found its way into the pool. If a descriptor + // is requested *during* static init then AddDescriptors() may not have + // been called yet, so we call it manually. Note that it's fine if + // AddDescriptors() is called multiple times. + printer->Print( + "$adddescriptorsname$();\n", + "adddescriptorsname", GlobalAddDescriptorsName(m_file->name())); +#endif + // Get the file's descriptor from the pool. printer->Print( "const ::google::protobuf::FileDescriptor* file =\n" diff --git a/protoc/GeneratorHelpers.cpp b/protoc/GeneratorHelpers.cpp index 6f619b5c0c..d0939c4309 100644 --- a/protoc/GeneratorHelpers.cpp +++ b/protoc/GeneratorHelpers.cpp @@ -104,6 +104,14 @@ string FilenameIdentifier(const string& filename) { return result; } +// No longer needed since protobuf 3.7 +#if GOOGLE_PROTOBUF_VERSION < 3007000 +// Return the name of the AddDescriptors() function for a given file. +string GlobalAddDescriptorsName(const string& filename) { + return "protobuf_AddDesc_" + FilenameIdentifier(filename); +} +#endif + // Return the name of the AssignDescriptors() function for a given file. string GlobalAssignDescriptorsName(const string& filename) { return "protobuf_AssignDesc_" + FilenameIdentifier(filename); diff --git a/protoc/GeneratorHelpers.h b/protoc/GeneratorHelpers.h index fa91a915dc..2e9d311d0e 100644 --- a/protoc/GeneratorHelpers.h +++ b/protoc/GeneratorHelpers.h @@ -67,6 +67,12 @@ string StripProto(const string& filename); // Convert a file name into a valid identifier. string FilenameIdentifier(const string& filename); +// No longer needed since protobuf 3.7 +#if GOOGLE_PROTOBUF_VERSION < 3007000 +// Return the name of the AddDescriptors() function for a given file. +string GlobalAddDescriptorsName(const string& filename); +#endif + // Return the name of the AssignDescriptors() function for a given file. string GlobalAssignDescriptorsName(const string& filename); From 268d77291c149e816c3a71ae47cb707b998d9d7a Mon Sep 17 00:00:00 2001 From: Jannis Achstetter Date: Fri, 8 May 2020 21:56:42 +0200 Subject: [PATCH 12/15] Update NEWS file to reflect protobug version tested with --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 3fa8d7b782..f10b714202 100644 --- a/NEWS +++ b/NEWS @@ -33,7 +33,7 @@ x/y/2019 ola-0.10.8 * Renamed RESONSE_INVALID_DESTINATION(sic) to RESPONSE_INVALID_DESTINATION in the ArduinoWidget code * Fix compatibility with ncurses 6 - * Fix compatibility with newer versions of Protobuf + * Fix compatibility with newer versions of Protobuf (tested with up to 3.11.4) Internal: * From 81305dca50a6be1ab9d61010d6328c326073706e Mon Sep 17 00:00:00 2001 From: Jannis Achstetter Date: Tue, 12 May 2020 09:37:30 +0200 Subject: [PATCH 13/15] Clarify protobuf versions in NEWS file --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index f10b714202..872ed2900f 100644 --- a/NEWS +++ b/NEWS @@ -33,7 +33,7 @@ x/y/2019 ola-0.10.8 * Renamed RESONSE_INVALID_DESTINATION(sic) to RESPONSE_INVALID_DESTINATION in the ArduinoWidget code * Fix compatibility with ncurses 6 - * Fix compatibility with newer versions of Protobuf (tested with up to 3.11.4) + * Fix compatibility with Protobuf 3.7 and newer (tested with up to 3.11.4) Internal: * From cad596ba67115d71bb384f3f18075a805e2ce0ac Mon Sep 17 00:00:00 2001 From: Jannis Achstetter Date: Tue, 12 May 2020 21:00:20 +0200 Subject: [PATCH 14/15] Fix flake8 issues --- python/examples/ola_rdm_get.py | 8 ++++---- scripts/enforce_licence.py | 8 ++++---- tools/rdm/TestLogger.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/python/examples/ola_rdm_get.py b/python/examples/ola_rdm_get.py index 94f34954fc..06a2542592 100755 --- a/python/examples/ola_rdm_get.py +++ b/python/examples/ola_rdm_get.py @@ -183,7 +183,7 @@ def do_subdevice(self, line): return self._sub_device = sub_device - def do_print(self, l): + def do_print(self, line): """Prints the current universe, UID and sub device.""" print(textwrap.dedent("""\ Universe: %d @@ -193,7 +193,7 @@ def do_print(self, l): self._uid, self._sub_device))) - def do_uids(self, l): + def do_uids(self, line): """List the UIDs for this universe.""" self.client.FetchUIDList(self._universe, self._DisplayUids) self.wrapper.Run() @@ -206,12 +206,12 @@ def _DisplayUids(self, state, uids): print(str(uid)) self.wrapper.Stop() - def do_full_discovery(self, l): + def do_full_discovery(self, line): """Run full RDM discovery for this universe.""" self.client.RunRDMDiscovery(self._universe, True, self._DiscoveryDone) self.wrapper.Run() - def do_incremental_discovery(self, l): + def do_incremental_discovery(self, line): """Run incremental RDM discovery for this universe.""" self.client.RunRDMDiscovery(self._universe, False, self._DiscoveryDone) self.wrapper.Run() diff --git a/scripts/enforce_licence.py b/scripts/enforce_licence.py index b9502598d6..d14cd22722 100755 --- a/scripts/enforce_licence.py +++ b/scripts/enforce_licence.py @@ -144,8 +144,8 @@ def TransformCppToJsLicence(licence): lines = licence.split('\n') output = [] output.append('/**') - for l in lines[1:]: - output.append(TransformJsLine(l[2:])) + for s in lines[1:]: + output.append(TransformJsLine(s[2:])) return '\n'.join(output) @@ -162,8 +162,8 @@ def TransformCppToPythonLicence(licence): """Change a C++ licence to Python style""" lines = licence.split('\n') output = [] - for l in lines[1:]: - output.append(TransformPythonLine(l[3:])) + for s in lines[1:]: + output.append(TransformPythonLine(s[3:])) return '\n'.join(output) diff --git a/tools/rdm/TestLogger.py b/tools/rdm/TestLogger.py index d39560f902..e53e6baa71 100644 --- a/tools/rdm/TestLogger.py +++ b/tools/rdm/TestLogger.py @@ -199,7 +199,7 @@ def _FormatData(self, test_data, requested_category, requested_test_state, if include_description: results_log.append(str(test['doc'])) if include_debug: - results_log.extend(str(l) for l in test.get('debug', [])) + results_log.extend(str(s) for s in test.get('debug', [])) results_log.append('') warnings.extend(str(s) for s in test.get('warnings', [])) advisories.extend(str(s) for s in test.get('advisories', [])) From 260ef8c89071fda84c2281e61a44b2d35389e515 Mon Sep 17 00:00:00 2001 From: Jannis Achstetter Date: Wed, 13 May 2020 07:38:38 +0200 Subject: [PATCH 15/15] Python code readability improvements --- scripts/enforce_licence.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/enforce_licence.py b/scripts/enforce_licence.py index d14cd22722..2e6699474e 100755 --- a/scripts/enforce_licence.py +++ b/scripts/enforce_licence.py @@ -144,8 +144,8 @@ def TransformCppToJsLicence(licence): lines = licence.split('\n') output = [] output.append('/**') - for s in lines[1:]: - output.append(TransformJsLine(s[2:])) + for line in lines[1:]: + output.append(TransformJsLine(line[2:])) return '\n'.join(output) @@ -162,8 +162,8 @@ def TransformCppToPythonLicence(licence): """Change a C++ licence to Python style""" lines = licence.split('\n') output = [] - for s in lines[1:]: - output.append(TransformPythonLine(s[3:])) + for line in lines[1:]: + output.append(TransformPythonLine(line[3:])) return '\n'.join(output)