diff options
author | W. Trevor King <wking@tremily.us> | 2013-01-23 20:56:57 -0500 |
---|---|---|
committer | W. Trevor King <wking@tremily.us> | 2013-01-23 20:56:57 -0500 |
commit | b9e5c33dc96da7255740cc23660a183baafbadd4 (patch) | |
tree | 0bdcb8497848fbede3821fc84340b10c8292867a /libbe/storage | |
parent | 128a651dd55523d00095ea2669683e6cbb8a4259 (diff) | |
download | bugseverywhere-b9e5c33dc96da7255740cc23660a183baafbadd4.tar.gz |
storage:util:upgrade: Strip any trailing space from the version
Not just '\n'. Mark Mikofski reported an error on the upgrade from
1.4 to 1.5 on MS Windows:
> upgrading bugdir from "Bugs Everywhere Directory v1.4" to "Bugs Everywhere Directory v1.5"
> Traceback (most recent call last):
> ...
> File "c:\...\libbe\storage\util\upgrade.py", line 141, in check_initial_version
> assert version == self.initial_version, '%s: %s' % (path, version)
> AssertionError: c:\...\.be\version: Bugs Everywhere Directory v1.4
>
> **notes:** I set a breakpoint and it does seem that they are not the same
> (Pdb) self.initial_version
> 'Bugs Everywhere Directory v1.4'
> (Pdb) version
> u'Bugs Everywhere Directory v1.4\r'
We don't need to convert to Unicode, because on Python 2.7:
$ python2.7 -c "print('a' == u'a')"
True
Strange, but true ;). One day we'll migrate BE to Python 3...
Diffstat (limited to 'libbe/storage')
-rw-r--r-- | libbe/storage/util/upgrade.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libbe/storage/util/upgrade.py b/libbe/storage/util/upgrade.py index ddc434a..c3a5df1 100644 --- a/libbe/storage/util/upgrade.py +++ b/libbe/storage/util/upgrade.py @@ -137,7 +137,7 @@ class Upgrader (object): def check_initial_version(self): path = self.get_path('version') - version = encoding.get_file_contents(path, decode=True).rstrip('\n') + version = encoding.get_file_contents(path, decode=True).rstrip() assert version == self.initial_version, '%s: %s' % (path, version) def set_version(self): |