summaryrefslogtreecommitdiff
path: root/tools/utils
diff options
context:
space:
mode:
authorKenpachi2k13 <3476227+Kenpachi2k13@users.noreply.github.com>2020-05-05 01:00:27 +0200
committerGitHub <noreply@github.com>2020-05-05 01:00:27 +0200
commit66607bfbfe197a5fec86dd1efe34a2da80929648 (patch)
treeed0e97ddc134c82067a436ea3ffd67f2f46be60b /tools/utils
parent3f6b7497531f9ace331ca74d271898e938245c04 (diff)
parent944d8489f1bcca93e6b2ff06a159084f064dce12 (diff)
downloadhercules-66607bfbfe197a5fec86dd1efe34a2da80929648.tar.gz
hercules-66607bfbfe197a5fec86dd1efe34a2da80929648.tar.bz2
hercules-66607bfbfe197a5fec86dd1efe34a2da80929648.tar.xz
hercules-66607bfbfe197a5fec86dd1efe34a2da80929648.zip
Merge branch 'master' into configure_newopt
Diffstat (limited to 'tools/utils')
-rw-r--r--tools/utils/common.py10
-rw-r--r--tools/utils/libconf.py13
2 files changed, 17 insertions, 6 deletions
diff --git a/tools/utils/common.py b/tools/utils/common.py
index acceb9b30..b4dae0c8c 100644
--- a/tools/utils/common.py
+++ b/tools/utils/common.py
@@ -4,8 +4,8 @@
# This file is part of Hercules.
# http://herc.ws - http://github.com/HerculesWS/Hercules
#
-# Copyright (C) 2018 Hercules Dev Team
-# Copyright (C) 2018 Asheraf
+# Copyright (C) 2018-2020 Hercules Dev Team
+# Copyright (C) 2018 Asheraf
#
# Hercules is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import io
-import libconf as libconf
+import sys
+if sys.version_info >= (3, 0):
+ from utils import libconf as libconf
+else:
+ import libconf as libconf
import os.path
def LoadDBConsts(DBname, mode, serverpath):
diff --git a/tools/utils/libconf.py b/tools/utils/libconf.py
index 635efd07d..3858b93b5 100644
--- a/tools/utils/libconf.py
+++ b/tools/utils/libconf.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf8 -*-
#
-# Copyright (C) 2018 Hercules Dev Team
+# Copyright (C) 2018-2020 Hercules Dev Team
#
# This library is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -226,8 +226,15 @@ class Tokenizer:
for cls, type, regex in self.token_map:
m = regex.match(string, pos=pos)
if m:
- yield cls(type, m.group(0),
- self.filename, self.row, self.column)
+ try:
+ yield cls(type, m.group(0),
+ self.filename, self.row, self.column)
+ except ValueError as e:
+ print("Error parsing file "
+ "{0}, in line:\n{1}\n{2}".format(self.filename,
+ m.group(0),
+ self.row))
+ raise
self.column += len(m.group(0))
pos = m.end()
break