diff --git a/dlpolyparser/SimpleDL_POLYParser.py b/dlpolyparser/SimpleDL_POLYParser.py index a4149bade8fd3503a0bc53c1f77600dbdfd324cf..efd1466e3803709bfffb7192417a316514dd3401 100644 --- a/dlpolyparser/SimpleDL_POLYParser.py +++ b/dlpolyparser/SimpleDL_POLYParser.py @@ -202,9 +202,6 @@ parserInfo = {'name':'dl_poly-parser', 'version': '0.0'} # CUSTOMIZE CACHING cachingLevelForMetaName = {} -import nomad_meta_info -metaInfoPath = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(nomad_meta_info.__file__)), "dl_poly.nomadmetainfo.json")) -metaInfoEnv, warnings = loadJsonFile(filePath = metaInfoPath, dependencyLoader = None, extraArgsHandling = InfoKindEl.ADD_EXTRA_ARGS, uri = None) class DlPolyParser(): """ A proper class envolop for running this parser from within python. """ @@ -215,11 +212,11 @@ class DlPolyParser(): from unittest.mock import patch logging.info('dl-poly parser started') logging.getLogger('nomadcore').setLevel(logging.WARNING) - backend = self.backend_factory(metaInfoEnv) + backend = self.backend_factory("dl_poly.nomadmetainfo.json") with patch.object(sys, 'argv', ['<exe>', '--uri', 'nmd://uri', mainfile]): mainFunction( mainFileDescription=mainFileDescription, - metaInfoEnv=metaInfoEnv, + metaInfoEnv=None, parserInfo = parserInfo, cachingLevelForMetaName = cachingLevelForMetaName, superContext=DL_POLYParserContext(), @@ -228,17 +225,3 @@ class DlPolyParser(): defaultSectionCachingLevel = True) return backend - - -if __name__ == "__main__": - - mainFunction(mainFileDescription, - metaInfoEnv, - parserInfo, - superContext = DL_POLYParserContext(), - cachingLevelForMetaName = cachingLevelForMetaName, - onClose = {}, - defaultSectionCachingLevel = False) - - - diff --git a/dlpolyparser/dlPolyParser.py b/dlpolyparser/dlPolyParser.py index ba06166174ee67733bac1ae831096b65fe2d56db..a3de2e05f27b4319037e2ae69b5c84acf42316ce 100644 --- a/dlpolyparser/dlPolyParser.py +++ b/dlpolyparser/dlPolyParser.py @@ -21,7 +21,6 @@ import logging import numpy as np from nomadcore.local_meta_info import loadJsonFile, InfoKindEl -from nomadcore.parser_backend import JsonParseEventsWriterBackend from contextlib import contextmanager from dlpolyparser.libDlPolyParser import * @@ -110,13 +109,9 @@ class DlPolyParserWrapper(): self.backend_factory = backend def parse(self, mainfile): - import nomad_meta_info - metaInfoPath = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(nomad_meta_info.__file__)), "dl_poly.nomadmetainfo.json")) - metaInfoEnv, warnings = loadJsonFile(filePath = metaInfoPath, dependencyLoader = None, extraArgsHandling = InfoKindEl.ADD_EXTRA_ARGS, uri = None) - from unittest.mock import patch logging.info('dl-poly parser started') logging.getLogger('nomadcore').setLevel(logging.WARNING) - backend = self.backend_factory(metaInfoEnv) + backend = self.backend_factory("dl_poly.nomadmetainfo.json") # Call the old parser without a class. parserInfo = {'name': 'dl_poly-parser', 'version': '0.0'} backend = parse_without_class(mainfile, backend, parserInfo) diff --git a/dlpolyparser/setup_paths.py b/dlpolyparser/setup_paths.py deleted file mode 100644 index 849086c4d47d6692c76226fef7c7199b07eb6670..0000000000000000000000000000000000000000 --- a/dlpolyparser/setup_paths.py +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2016-2018 Carl Poelking, Fawzi Mohamed, Ankit Kariryaa -# -# 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. -# See the License for the specific language governing permissions and -# limitations under the License. - -import sys, os, os.path -baseDir = os.path.dirname(os.path.abspath(__file__)) -commonDir = os.path.normpath(os.path.join(baseDir,"../../../../python-common/common/python")) - -if not commonDir in sys.path: - sys.path.insert(0, commonDir)