[game-data-packager] 05/17: umod: cope with unexpected sections
Simon McVittie
smcv at debian.org
Wed Dec 30 22:57:20 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 279266c800bb2c6527f44d12831e474eb8f8d421
Author: Simon McVittie <smcv at debian.org>
Date: Wed Dec 30 21:56:32 2015 +0000
umod: cope with unexpected sections
One of the Unreal 227i patches has an unused section.
---
game_data_packager/unpack/umod.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/game_data_packager/unpack/umod.py b/game_data_packager/unpack/umod.py
index f1dd84a..6b0ed26 100644
--- a/game_data_packager/unpack/umod.py
+++ b/game_data_packager/unpack/umod.py
@@ -16,12 +16,15 @@
# /usr/share/common-licenses/GPL-2.
import io
+import logging
import os
import struct
import re
from . import (StreamUnpackable, UnpackableEntry)
+logger = logging.getLogger(__name__)
+
# Arbitrary limit to avoid reading too much binary data if something goes wrong
MAX_LINE_LENGTH = 1024
@@ -351,9 +354,9 @@ class Umod(StreamUnpackable):
line = line[1:-1]
if line not in expected_sections:
- raise ValueError('Unexpected section [%s]' % line)
+ logger.warning('Unexpected section [%s]' % line)
- self.__parse_section(manifest, expected_sections.pop(line))
+ self.__parse_section(manifest, expected_sections.pop(line, None))
for x in self:
assert isinstance(x, UmodEntry)
@@ -367,7 +370,10 @@ class Umod(StreamUnpackable):
break
k, v = line.split('=', 1)
- section._consume_line(self, k, v)
+ if section is None:
+ logger.debug('%s=%s', k, v)
+ else:
+ section._consume_line(self, k, v)
def __enter__(self):
return self
--
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