朱东升 commited on
Commit
498e475
·
1 Parent(s): f1270af
Files changed (2) hide show
  1. Dockerfile +3 -0
  2. src/eval_clj.py +14 -2
Dockerfile CHANGED
@@ -1,5 +1,8 @@
1
  FROM ghcr.io/nuprl/multipl-e-evaluation:v3.1
2
 
 
 
 
3
  # Override the default entrypoint of the base image
4
  ENTRYPOINT []
5
  WORKDIR /app
 
1
  FROM ghcr.io/nuprl/multipl-e-evaluation:v3.1
2
 
3
+ # Install GNAT for Ada language support
4
+ RUN apt-get update && apt-get install -y gnat && apt-get clean
5
+
6
  # Override the default entrypoint of the base image
7
  ENTRYPOINT []
8
  WORKDIR /app
src/eval_clj.py CHANGED
@@ -2,13 +2,25 @@
2
  Evaluates a generated Clojure program (.clj).
3
  """
4
  import os
 
5
  from pathlib import Path
6
  from src.safe_subprocess import run
7
  from src.libeval import run_without_exn
8
 
9
 
10
  def eval_script(path: Path):
11
- result = run(["clojure", "-J-Dclojure.main.report=stderr", "-M", str(path)])
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  if result.timeout:
14
  status = "Timeout"
@@ -27,4 +39,4 @@ def eval_script(path: Path):
27
  }
28
 
29
  if __name__ == "__main__":
30
- main()
 
2
  Evaluates a generated Clojure program (.clj).
3
  """
4
  import os
5
+ import tempfile
6
  from pathlib import Path
7
  from src.safe_subprocess import run
8
  from src.libeval import run_without_exn
9
 
10
 
11
  def eval_script(path: Path):
12
+ # Create environment with a writable temporary directory for Clojure cache
13
+ temp_dir = tempfile.mkdtemp(prefix="clojure_home_")
14
+ env = os.environ.copy()
15
+ env["XDG_CONFIG_HOME"] = temp_dir # Set XDG_CONFIG_HOME for Clojure cache
16
+ env["XDG_DATA_HOME"] = temp_dir # Set XDG_DATA_HOME for Clojure data
17
+ env["XDG_CACHE_HOME"] = temp_dir # Set XDG_CACHE_HOME for caches
18
+
19
+ # Run Clojure with the custom environment
20
+ result = run(
21
+ ["clojure", "-J-Dclojure.main.report=stderr", "-M", str(path)],
22
+ env=env
23
+ )
24
 
25
  if result.timeout:
26
  status = "Timeout"
 
39
  }
40
 
41
  if __name__ == "__main__":
42
+ print("This module is not meant to be executed directly.")