@@ -51,7 +51,7 @@ def repo_image_key(self) -> str:
51
51
hash_object .update (str (self .setup_script ).encode ("utf-8" ))
52
52
hash_value = hash_object .hexdigest ()
53
53
val = hash_value [:22 ] # 22 characters is still very likely to be unique
54
- repo = self .repo .split ("/" )[- 1 ]
54
+ repo = self .repo .split ("/" )[- 1 ]. split ( '__' )[ - 1 ]. split ( '-' )[ 0 ]
55
55
# this is the image name created locally
56
56
# once this image created, it will be tagged with repo_image_tag
57
57
return f"commit0.repo.{ repo } .{ val } :v0" .lower ()
@@ -60,7 +60,15 @@ def repo_image_key(self) -> str:
60
60
def repo_image_tag (self ) -> str :
61
61
"""Repo image tag that will be used throughout."""
62
62
repo = self .repo .split ("/" )[- 1 ]
63
- return f"wentingzhao/{ repo } :v0" .lower ()
63
+ tag = f"wentingzhao/{ repo } :v0" .lower ()
64
+ if '__' in repo : # this is a swebench instance
65
+ repo = repo .split ('__' )[- 1 ].split ('-' )[0 ]
66
+ hash_object = hashlib .sha256 ()
67
+ hash_object .update (str (self .setup_script ).encode ("utf-8" ))
68
+ hash_value = hash_object .hexdigest ()
69
+ val = hash_value [:22 ] # 22 characters is still very likely to be unique
70
+ tag = f"wentingzhao/{ repo } .{ val } :v0" .lower ()
71
+ return tag
64
72
65
73
def get_container_name (self , run_id : Optional [str ] = None ) -> str :
66
74
repo = self .repo .split ("/" )[- 1 ]
@@ -106,7 +114,6 @@ def make_repo_script_list(instance: RepoInstance, repo_directory: str) -> list[s
106
114
f"git clone -o origin https://github.com/{ repo } { repo_directory } " ,
107
115
f"chmod -R 777 { repo_directory } " , # So nonroot user can run tests
108
116
f"cd { repo_directory } " ,
109
- f"git reset --hard { env_setup_commit } " ,
110
117
# Remove the remote so the agent won't see newer commits.
111
118
"git remote remove origin" ,
112
119
f"uv venv --python { specs ['python' ]} " ,
@@ -155,33 +162,34 @@ def make_repo_script_list(instance: RepoInstance, repo_directory: str) -> list[s
155
162
pip_packages = " " .join (pip_packages )
156
163
cmd = f"uv pip install { pip_packages } "
157
164
setup_commands .append (cmd )
158
-
159
- if "install" in specs and specs ["install" ] is not None :
160
- if specs ["install" ].startswith ("python -m pip install" ):
161
- specs ["install" ] = specs ["install" ].replace ("python -m " , "" )
162
- if specs ["install" ].startswith ("pip" ):
163
- install = "uv " + specs ["install" ]
164
- elif specs ["install" ].startswith ("python setup.py" ):
165
- install = specs ["install" ].replace ("python " , "uv run " )
166
- else :
167
- raise ValueError (
168
- f"install command should always start with pip or python setup.py, but you have { specs ['install' ]} "
169
- )
170
- setup_commands .append (install )
171
165
setup_commands .append (
172
166
"uv pip install -U pytest pytest-cov coverage pytest-json-report"
173
167
)
174
- setup_commands .append (f"git reset --hard { base_commit } " )
175
168
return setup_commands
176
169
177
170
178
171
def make_eval_script_list (instance : RepoInstance , repo_directory : str ) -> list [str ]:
179
172
"""Run the tests."""
173
+ specs = instance ["setup" ]
174
+ if "install" in specs and specs ["install" ] is not None :
175
+ installs = specs ["install" ].split ('; ' )
176
+ results = []
177
+ for one in installs :
178
+ if one .startswith ("python -m pip install" ):
179
+ install = one .replace ("python -m " , "" )
180
+ else :
181
+ install = one
182
+ if install .startswith ("pip" ):
183
+ install = "uv " + install
184
+ elif install .startswith ("python setup.py" ):
185
+ install = install .replace ("python " , "uv run " )
186
+ results .append (install )
180
187
eval_script_list = [
181
188
f"cd { repo_directory } " ,
182
189
"source .venv/bin/activate" ,
183
190
f"git reset --hard { instance ['base_commit' ]} " ,
184
191
"git apply --allow-empty -v /patch.diff" ,
192
+ ] + results + [
185
193
"git status" ,
186
194
f"{ instance ['test' ]['test_cmd' ]} --json-report --json-report-file=report.json --continue-on-collection-errors{{coverage}} {{test_ids}} > test_output.txt 2>&1" ,
187
195
"echo $? > pytest_exit_code.txt" ,
0 commit comments