ExcitingParser.scala 1.67 KB
Newer Older
ankit kariryaa's avatar
ankit kariryaa committed
1
package eu.nomad_lab.parsers
2
3

import eu.{nomad_lab=>lab}
ankit kariryaa's avatar
ankit kariryaa committed
4
5
import eu.nomad_lab.DefaultPythonInterpreter
import org.{json4s => jn}
6
7
import scala.collection.breakOut

ankit kariryaa's avatar
ankit kariryaa committed
8
9
10
11
12

object ExcitingParser extends SimpleExternalParserGenerator(
  name = "ExcitingParser",
  parserInfo = jn.JObject(
    ("name" -> jn.JString("ExcitingParser")) ::
13
14
15
16
17
18
19
20
      ("parserId" -> jn.JString("ExcitingParser" + lab.ExcitingVersionInfo.version)) ::
      ("versionInfo" -> jn.JObject(
        ("nomadCoreVersion" -> jn.JString(lab.NomadCoreVersionInfo.version)) ::
          (lab.ExcitingVersionInfo.toMap.map{ case (key, value) =>
            (key -> jn.JString(value.toString))
          }(breakOut): List[(String, jn.JString)])
      )) :: Nil
  ),
ankit kariryaa's avatar
ankit kariryaa committed
21
  mainFileTypes = Seq("text/.*"),
22
23
24
  mainFileRe = """\s*=================================================+\s*
\s*\|\s*EXCITING\s(?<version>\S*) started\s*=
(?:\s*\|\sversion hash id:\s*(?<hashId>\S*)\s*=)?""".r,
ankit kariryaa's avatar
ankit kariryaa committed
25
26
27
28
  cmd = Seq(DefaultPythonInterpreter.python2Exe(), "${envDir}/parsers/exciting/parser/parser-exciting/parser_exciting.py",
    "--uri", "${mainFileUri}", "${mainFilePath}"),
  resList = Seq(
    "parser-exciting/parser_exciting.py",
29
    "parser-exciting/exciting_parser_dos.py",
ankit kariryaa's avatar
ankit kariryaa committed
30
31
32
33
34
35
36
37
38
39
    "parser-exciting/setup_paths.py",
    "nomad_meta_info/common.nomadmetainfo.json",
    "nomad_meta_info/meta_types.nomadmetainfo.json",
    "nomad_meta_info/exciting.nomadmetainfo.json"
  ) ++ DefaultPythonInterpreter.commonFiles(),
  dirMap = Map(
    "parser-exciting" -> "parsers/exciting/parser/parser-exciting/",
    "nomad_meta_info" -> "nomad-meta-info/meta_info/nomad_meta_info",
    "python" -> "python-common/common/python/nomadcore") ++ DefaultPythonInterpreter.commonDirMapping()
)