Commit 25320c3d authored by Oskar Skog's avatar Oskar Skog

Test; Pre 0.2.16

parent e21d8a6a
2016-07-16 Oskar Skog <[email protected]>
0.2.16
* anonymine_engine.py (hiscores): Force UTF-8 on the file.
- Functions may return unicode objects as strings on Python 2, but
that's no problem as unicode and str can be combined as long as
the str only contains bytes in the ASCII range.
- add_entry, will decode the str object on Python 2 using
locale.getprefferedencoding() as encoding
- The maxsize key now refers to the number of bytes on both
Pythons.
2016-07-15 Oskar Skog <[email protected]>
0.2.15
* Makefile.static (print-destinations): \t doesn't work on FreeBSD;
......
......@@ -12,7 +12,7 @@
NAME := anonymine
NAME_C := Anonymine
DESCRIPTION = Minesweeper without guessing
VERSION := 0.2.15
VERSION := 0.2.16
# Five more variables are required: sysconfdir, vargamesdir, EXECUTABLES and
# MODULES, and MODULES_OTHERVER which may be set to "non-existent".
......
......@@ -63,7 +63,7 @@ except:
GAME_NAME = 'Anonymine'
GAME_FILENAME = GAME_NAME.lower().replace(' ', '-')
GAME_VERSION = (0, 2, 15)
GAME_VERSION = (0, 2, 16)
# GAME_VERSION MAY lag behind the version of the package when no change has
# been made to this file.
GAME_CRAPTEXT = """{0} version {1}.{2}.{3}
......
......@@ -46,6 +46,7 @@ import signal
import sys
import math
import getpass
import locale
# Allow module names to be changed later.
import anonymine_solver as solver
......@@ -166,11 +167,11 @@ class hiscores():
def line_to_entry(line):
return tuple(line.split(':', 4))
try:
f = open(self.hiscorefile)
f = open(self.hiscorefile, 'rb')
except IOError as err:
self.display_caption = 'IO error on read: ' + err.strerror
return
filecontent = f.read()
filecontent = f.read().decode('utf-8')
lines = list(filter(None, filecontent.split('\n')))
self.hiscores = list(map(line_to_entry, lines))
......@@ -179,9 +180,10 @@ class hiscores():
content = ''
for entry in self.hiscores:
content += ':'.join(entry) + '\n'
content = content.encode('utf-8')
if len(content) <= self.maxsize:
try:
f = open(self.hiscorefile, 'w')
f = open(self.hiscorefile, 'wb')
except IOError as err:
self.display_caption = 'IO error on write: ' + err.strerror
return
......@@ -249,6 +251,8 @@ class hiscores():
'You made it to #{0}'.format(position + 1),
'Nickname'
)
if sys.version_info[0] == 2:
nick = nick.decode(locale.getpreferredencoding())
# Load the list again (inputfunction may take a very long time)
# and add the nickname to the entry.
new_entry[4] = nick
......
......@@ -5,13 +5,13 @@ if [ $# -eq 1 ]; then
if [ "$1" = $help_option ]; then
if [ -z "$PAGER" ]; then PAGER=false; fi
$PAGER INSTALL || pager INSTALL || less INSTALL \
|| more INSTALL || echo Read '"'INSTALL'"'
|| more INSTALL || echo Read '"INSTALL"'
exit
fi
done
for version_option in -V --version; do
if [ "$1" = $version_option ]; then
echo Anonymine 0.2.15
echo Anonymine 0.2.16
echo Handmade configure and configure.py
echo Version info from ./configure may lag behind.
exit
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment