[game-data-packager] 17/18: Open all text files as UTF-8
Simon McVittie
smcv at debian.org
Thu Jan 22 12:40:42 UTC 2015
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch master
in repository game-data-packager.
commit 980caccb6121cc3f3d433643c9cb0e5dde3cee1e
Author: Simon McVittie <smcv at debian.org>
Date: Thu Jan 22 12:14:30 2015 +0000
Open all text files as UTF-8
---
game_data_packager/__init__.py | 12 +++++++-----
game_data_packager/config.py | 2 +-
game_data_packager/games/doom_common.py | 23 +++++++++++++++--------
game_data_packager/version.py | 2 +-
4 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index d49273a..3ca2e75 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -1152,7 +1152,7 @@ class GameData(object):
return [wanted.download]
for mirror_list, details in wanted.download.items():
try:
- f = open(os.path.join(ETCDIR, mirror_list))
+ f = open(os.path.join(ETCDIR, mirror_list), encoding='utf-8')
for line in f:
url = line.strip()
if not url:
@@ -1483,8 +1483,9 @@ class GameData(object):
return
if os.path.exists(copy_from + '.in'):
- copy_with_substitutions(open(copy_from + '.in'),
- open(copy_to, 'w'),
+ copy_with_substitutions(open(copy_from + '.in',
+ encoding='utf-8'),
+ open(copy_to, 'w', encoding='utf-8'),
PACKAGE=package.name)
return
@@ -1608,7 +1609,8 @@ class GameData(object):
os.chmod(os.path.join(destdir, 'DEBIAN/md5sums'), 0o644)
try:
- control_in = open(self.get_control_template(package))
+ control_in = open(self.get_control_template(package),
+ encoding='utf-8')
control = Deb822(control_in)
except FileNotFoundError:
control = Deb822()
@@ -2218,7 +2220,7 @@ def load_yaml_games(workdir=None):
g = os.path.basename(yamlfile)
g = g[:len(g) - 5]
- yaml_data = yaml.load(open(yamlfile))
+ yaml_data = yaml.load(open(yamlfile, encoding='utf-8'))
plugin = yaml_data.get('plugin', g)
diff --git a/game_data_packager/config.py b/game_data_packager/config.py
index 628846c..35cdad0 100644
--- a/game_data_packager/config.py
+++ b/game_data_packager/config.py
@@ -32,7 +32,7 @@ def read_config():
config = { 'install': False, 'preserve': True }
try:
- with open(CONFIG) as conffile:
+ with open(CONFIG, encoding='utf-8') as conffile:
lineno = 0
for line in conffile:
lineno += 1
diff --git a/game_data_packager/games/doom_common.py b/game_data_packager/games/doom_common.py
index de84c28..0bc2d0d 100644
--- a/game_data_packager/games/doom_common.py
+++ b/game_data_packager/games/doom_common.py
@@ -110,13 +110,17 @@ class DoomGameData(GameData):
main_wad = package.main_wad
copy_with_substitutions(
- open(os.path.join(DATADIR, 'doom-common.README.Debian.in')),
- open(os.path.join(docdir, 'README.Debian'), 'w'),
+ open(os.path.join(DATADIR, 'doom-common.README.Debian.in'),
+ encoding='utf-8'),
+ open(os.path.join(docdir, 'README.Debian'), 'w',
+ encoding='utf-8'),
PACKAGE=package.name,
GAME=(package.longname or self.longname))
copy_with_substitutions(
- open(os.path.join(DATADIR, 'doom-common.copyright.in')),
- open(os.path.join(docdir, 'copyright'), 'w'),
+ open(os.path.join(DATADIR, 'doom-common.copyright.in'),
+ encoding='utf-8'),
+ open(os.path.join(docdir, 'copyright'), 'w',
+ encoding='utf-8'),
PACKAGE=package.name,
IWAD=main_wad)
@@ -142,9 +146,10 @@ class DoomGameData(GameData):
for basename in (package.name, 'doom-common'):
from_ = os.path.join(DATADIR, basename + '.desktop.in')
if os.path.exists(from_):
- copy_with_substitutions(open(from_),
+ copy_with_substitutions(open(from_,
+ encoding='utf-8'),
open(os.path.join(appdir, '%s.desktop' % package.name),
- 'w'),
+ 'w', encoding='utf-8'),
GAME=wad_base,
LONG=(package.longname or self.longname),
ENGINE=(package.engine or self.engine))
@@ -155,8 +160,10 @@ class DoomGameData(GameData):
debdir = os.path.join(destdir, 'DEBIAN')
mkdir_p(debdir)
copy_with_substitutions(
- open(os.path.join(DATADIR, 'doom-common.preinst.in')),
- open(os.path.join(debdir, 'preinst'), 'w'),
+ open(os.path.join(DATADIR, 'doom-common.preinst.in'),
+ encoding='utf-8'),
+ open(os.path.join(debdir, 'preinst'), 'w',
+ encoding='utf-8'),
IWAD=main_wad)
os.chmod(os.path.join(debdir, 'preinst'), 0o755)
diff --git a/game_data_packager/version.py b/game_data_packager/version.py
index 50d4157..c2bbf78 100644
--- a/game_data_packager/version.py
+++ b/game_data_packager/version.py
@@ -5,5 +5,5 @@
from debian.changelog import Changelog
-cl = Changelog(open('debian/changelog'), strict=False)
+cl = Changelog(open('debian/changelog', encoding='utf-8'), strict=False)
GAME_PACKAGE_VERSION = str(cl.full_version)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git
More information about the Pkg-games-commits
mailing list