diff --git a/tinkerparser/TINKERCommon.py b/tinkerparser/TINKERCommon.py index b597ee1e671e5fce45be8706e96686ab350c3e79..320cc3ab883219265198175c4875c7115a7e6e18 100644 --- a/tinkerparser/TINKERCommon.py +++ b/tinkerparser/TINKERCommon.py @@ -1,11 +1,11 @@ # Copyright 2018-2018 Berk Onat -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -14,6 +14,7 @@ import logging import os +import metainfo PARSERNAME = "TINKER" PROGRAMNAME = "tinker" @@ -22,13 +23,13 @@ PARSERMETANAME = PARSERNAME.lower() PARSERTAG = 'x_' + PARSERMETANAME PARSER_INFO_DEFAULT = { - 'name' : PARSERMETANAME+'-parser', + 'name' : PARSERMETANAME+'-parser', 'version': PARSERVERSION } META_INFO_PATH = os.path.normpath(os.path.join( - os.path.dirname(os.path.abspath(__file__)), - "../../../../nomad-meta-info/meta_info/nomad_meta_info/"+PARSERMETANAME+".nomadmetainfo.json")) + os.path.dirname(os.path.abspath(metainfo.__file__)), + PARSERMETANAME+".nomadmetainfo.json")) LOGGER = logging.getLogger("nomad."+PROGRAMNAME+"Parser") diff --git a/tinkerparser/TINKERParser.py b/tinkerparser/TINKERParser.py index 3b93c3bc74abb0c38d3c41034a7a964ac13c51a1..4b26515202daf3232fbc0e4cbbda237653fcf6c9 100644 --- a/tinkerparser/TINKERParser.py +++ b/tinkerparser/TINKERParser.py @@ -22,11 +22,14 @@ import sys import datetime import io import fnmatch +from nomadcore.simple_parser import mainFunction ############################################################ # This is the parser for the main file of TINKER. ############################################################ +parser = None + #PRINTABLE = re.compile(r"\W+") TEXTCHARS = bytearray({7,8,9,10,12,13,27} | set(range(0x20, 0x100)) - {0x7f}) @@ -2825,6 +2828,7 @@ class TINKERParserInterface(): backend = self.backend_factory("tinker.nomadmetainfo.json") parserInfo = {'name': 'tinker-parser', 'version': '1.0'} context = TINKERParser() + context.coverageIgnore = re.compile(r"^(?:" + r"|".join(context.coverageIgnoreList) + r")$") with patch.object(sys, 'argv', ['<exe>', '--uri', 'nmd://uri', mainfile]): mainFunction( mainFileDescription=context.mainFileDescription(), diff --git a/tinkerparser/__init__.py b/tinkerparser/__init__.py index f9b04ff01c66bde6f9dfac5e6beba995b0b7f871..ac941a63b78bc42c18ff4bca23018ca2b2e82caf 100644 --- a/tinkerparser/__init__.py +++ b/tinkerparser/__init__.py @@ -1 +1 @@ -from .TINKERParser import TINKERParserInterface as TINKERParser \ No newline at end of file +from .TINKERParser import TINKERParserInterface as TinkerParser \ No newline at end of file