From 6aa7fe7c82f29658ef20f7bd36c32df833e3190b Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Thu, 6 Apr 2017 19:32:05 -0700 Subject: [PATCH] Welcome: handle local dev versions (with +, not -) correctly The Welcome class prints a message if the server recommends a CLI version that's newer than what the client is currently using, but only if the client is running a "release" version, not a "local" development one. "local" versions have a "+" in them (at least when Versioneer creates it), but Welcome was looking for "-" as an indicator. So it was printing the warning when it shouldn't be. --- src/wormhole/cli/welcome.py | 4 ++-- src/wormhole/test/test_cli.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wormhole/cli/welcome.py b/src/wormhole/cli/welcome.py index f763eae..50a60a4 100644 --- a/src/wormhole/cli/welcome.py +++ b/src/wormhole/cli/welcome.py @@ -10,9 +10,9 @@ class CLIWelcomeHandler(_WelcomeHandler): def handle_welcome(self, welcome): # Only warn if we're running a release version (e.g. 0.0.6, not - # 0.0.6-DISTANCE-gHASH). Only warn once. + # 0.0.6+DISTANCE.gHASH). Only warn once. if ("current_cli_version" in welcome - and "-" not in self._current_version + and "+" not in self._current_version and not self._version_warning_displayed and welcome["current_cli_version"] != self._current_version): print("Warning: errors may occur unless both sides are running the same version", file=self.stderr) diff --git a/src/wormhole/test/test_cli.py b/src/wormhole/test/test_cli.py index fb8fd10..086f18c 100644 --- a/src/wormhole/test/test_cli.py +++ b/src/wormhole/test/test_cli.py @@ -932,7 +932,7 @@ class Welcome(unittest.TestCase): def test_version_unreleased(self): stderr = self.do({"current_cli_version": "3.0"}, - my_version="2.5-middle-something") + my_version="2.5+middle.something") self.assertEqual(stderr, "") def test_motd(self):