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]> 2016-07-15 Oskar Skog <[email protected]>
0.2.15 0.2.15
* Makefile.static (print-destinations): \t doesn't work on FreeBSD; * Makefile.static (print-destinations): \t doesn't work on FreeBSD;
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
NAME := anonymine NAME := anonymine
NAME_C := Anonymine NAME_C := Anonymine
DESCRIPTION = Minesweeper without guessing DESCRIPTION = Minesweeper without guessing
VERSION := 0.2.15 VERSION := 0.2.16
# Five more variables are required: sysconfdir, vargamesdir, EXECUTABLES and # Five more variables are required: sysconfdir, vargamesdir, EXECUTABLES and
# MODULES, and MODULES_OTHERVER which may be set to "non-existent". # MODULES, and MODULES_OTHERVER which may be set to "non-existent".
......
...@@ -63,7 +63,7 @@ except: ...@@ -63,7 +63,7 @@ except:
GAME_NAME = 'Anonymine' GAME_NAME = 'Anonymine'
GAME_FILENAME = GAME_NAME.lower().replace(' ', '-') 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 # GAME_VERSION MAY lag behind the version of the package when no change has
# been made to this file. # been made to this file.
GAME_CRAPTEXT = """{0} version {1}.{2}.{3} GAME_CRAPTEXT = """{0} version {1}.{2}.{3}
......
...@@ -46,6 +46,7 @@ import signal ...@@ -46,6 +46,7 @@ import signal
import sys import sys
import math import math
import getpass import getpass
import locale
# Allow module names to be changed later. # Allow module names to be changed later.
import anonymine_solver as solver import anonymine_solver as solver
...@@ -166,11 +167,11 @@ class hiscores(): ...@@ -166,11 +167,11 @@ class hiscores():
def line_to_entry(line): def line_to_entry(line):
return tuple(line.split(':', 4)) return tuple(line.split(':', 4))
try: try:
f = open(self.hiscorefile) f = open(self.hiscorefile, 'rb')
except IOError as err: except IOError as err:
self.display_caption = 'IO error on read: ' + err.strerror self.display_caption = 'IO error on read: ' + err.strerror
return return
filecontent = f.read() filecontent = f.read().decode('utf-8')
lines = list(filter(None, filecontent.split('\n'))) lines = list(filter(None, filecontent.split('\n')))
self.hiscores = list(map(line_to_entry, lines)) self.hiscores = list(map(line_to_entry, lines))
...@@ -179,9 +180,10 @@ class hiscores(): ...@@ -179,9 +180,10 @@ class hiscores():
content = '' content = ''
for entry in self.hiscores: for entry in self.hiscores:
content += ':'.join(entry) + '\n' content += ':'.join(entry) + '\n'
content = content.encode('utf-8')
if len(content) <= self.maxsize: if len(content) <= self.maxsize:
try: try:
f = open(self.hiscorefile, 'w') f = open(self.hiscorefile, 'wb')
except IOError as err: except IOError as err:
self.display_caption = 'IO error on write: ' + err.strerror self.display_caption = 'IO error on write: ' + err.strerror
return return
...@@ -249,6 +251,8 @@ class hiscores(): ...@@ -249,6 +251,8 @@ class hiscores():
'You made it to #{0}'.format(position + 1), 'You made it to #{0}'.format(position + 1),
'Nickname' 'Nickname'
) )
if sys.version_info[0] == 2:
nick = nick.decode(locale.getpreferredencoding())
# Load the list again (inputfunction may take a very long time) # Load the list again (inputfunction may take a very long time)
# and add the nickname to the entry. # and add the nickname to the entry.
new_entry[4] = nick new_entry[4] = nick
......
...@@ -5,13 +5,13 @@ if [ $# -eq 1 ]; then ...@@ -5,13 +5,13 @@ if [ $# -eq 1 ]; then
if [ "$1" = $help_option ]; then if [ "$1" = $help_option ]; then
if [ -z "$PAGER" ]; then PAGER=false; fi if [ -z "$PAGER" ]; then PAGER=false; fi
$PAGER INSTALL || pager INSTALL || less INSTALL \ $PAGER INSTALL || pager INSTALL || less INSTALL \
|| more INSTALL || echo Read '"'INSTALL'"' || more INSTALL || echo Read '"INSTALL"'
exit exit
fi fi
done done
for version_option in -V --version; do for version_option in -V --version; do
if [ "$1" = $version_option ]; then if [ "$1" = $version_option ]; then
echo Anonymine 0.2.15 echo Anonymine 0.2.16
echo Handmade configure and configure.py echo Handmade configure and configure.py
echo Version info from ./configure may lag behind. echo Version info from ./configure may lag behind.
exit 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