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

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

ankit kariryaa's avatar
ankit kariryaa committed
8
9
10
11
object ExcitingParser extends SimpleExternalParserGenerator(
  name = "ExcitingParser",
  parserInfo = jn.JObject(
    ("name" -> jn.JString("ExcitingParser")) ::
12
13
      ("parserId" -> jn.JString("ExcitingParser" + lab.ExcitingVersionInfo.version)) ::
      ("versionInfo" -> jn.JObject(
14
15
16
        ("nomadCoreVersion" -> jn.JObject(lab.NomadCoreVersionInfo.toMap.map {
          case (k, v) => k -> jn.JString(v.toString)
        }(breakOut): List[(String, jn.JString)])) ::
ankit kariryaa's avatar
ankit kariryaa committed
17
18
19
          (lab.ExcitingVersionInfo.toMap.map {
            case (key, value) =>
              (key -> jn.JString(value.toString))
20
21
22
          }(breakOut): List[(String, jn.JString)])
      )) :: Nil
  ),
ankit kariryaa's avatar
ankit kariryaa committed
23
  mainFileTypes = Seq("text/.*"),
24
25
26
  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
27
28
29
30
  cmd = Seq(DefaultPythonInterpreter.python2Exe(), "${envDir}/parsers/exciting/parser/parser-exciting/parser_exciting.py",
    "--uri", "${mainFileUri}", "${mainFilePath}"),
  resList = Seq(
    "parser-exciting/parser_exciting.py",
31
    "parser-exciting/exciting_parser_dos.py",
ankit kariryaa's avatar
ankit kariryaa committed
32
    "parser-exciting/setup_paths.py",
33
    "nomad_meta_info/public.nomadmetainfo.json",
ankit kariryaa's avatar
ankit kariryaa committed
34
35
36
37
38
39
40
    "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",
ankit kariryaa's avatar
ankit kariryaa committed
41
42
    "python" -> "python-common/common/python/nomadcore"
  ) ++ DefaultPythonInterpreter.commonDirMapping()
ankit kariryaa's avatar
ankit kariryaa committed
43
)