@@ -344,11 +344,17 @@ def _vmRun(self, vm, workdir, command, benchmarks, bmSuiteArgs):
344
344
345
345
if not hasattr (self , "prepared" ):
346
346
self .prepared = True
347
- mx .run (
348
- ["hg" , "clone" , "https://foss.heptapod.net/pypy/benchmarks" ],
349
- cwd = workdir ,
350
- )
351
- mx .run (["hg" , "up" , "-C" , self .VERSION ], cwd = join (workdir , "benchmarks" ))
347
+ if artifact := os .environ .get ("PYPY_BENCHMARKS_DIR" ):
348
+ shutil .copytree (artifact , join (workdir , "benchmarks" ))
349
+ else :
350
+ mx .warn ("PYPY_BENCHMARKS_DIR is not set, cloning repository" )
351
+ mx .run (
352
+ ["hg" , "clone" , "https://foss.heptapod.net/pypy/benchmarks" ],
353
+ cwd = workdir ,
354
+ )
355
+ mx .run (
356
+ ["hg" , "up" , "-C" , self .VERSION ], cwd = join (workdir , "benchmarks" )
357
+ )
352
358
353
359
# workaround for pypy's benchmarks script issue
354
360
with open (join (workdir , "benchmarks" , "nullpython.py" )) as f :
@@ -412,25 +418,28 @@ def _vmRun(self, vm, workdir, command, benchmarks, bmSuiteArgs):
412
418
413
419
if not hasattr (self , "prepared" ):
414
420
self .prepared = True
415
- mx .run (
416
- [
417
- "git" ,
418
- "clone" ,
419
- "--depth" ,
420
- "1" ,
421
- "https://github.com/numpy/numpy.git" ,
422
- "--branch" ,
423
- self .VERSION ,
424
- "--single-branch" ,
425
- ],
426
- cwd = workdir ,
427
- )
428
- mx .run (
429
- ["git" , "branch" , "main" ], cwd = join (workdir , "numpy" )
430
- ) # workaround for asv, which expects a main branch
431
- mx .run (
432
- ["git" , "branch" , "master" ], cwd = join (workdir , "numpy" )
433
- ) # workaround for asv, which expects some branches
421
+ npdir = join (workdir , "numpy" )
422
+ if artifact := os .environ .get ("NUMPY_BENCHMARKS_DIR" ):
423
+ shutil .copytree (artifact , npdir )
424
+ mx .run (["git" , "init" , "." ], cwd = npdir , nonZeroIsFatal = False )
425
+ mx .run (["git" , "branch" , self .VERSION ], cwd = npdir , nonZeroIsFatal = False )
426
+ else :
427
+ mx .warn ("NUMPY_BENCHMARKS_DIR is not set, cloning numpy repository" )
428
+ mx .run (
429
+ [
430
+ "git" ,
431
+ "clone" ,
432
+ "--depth" ,
433
+ "1" ,
434
+ "https://github.com/numpy/numpy.git" ,
435
+ "--branch" ,
436
+ self .VERSION ,
437
+ "--single-branch" ,
438
+ ],
439
+ cwd = workdir ,
440
+ )
441
+ mx .run (["git" , "branch" , "main" ], cwd = npdir , nonZeroIsFatal = False )
442
+ mx .run (["git" , "branch" , "master" ], cwd = npdir , nonZeroIsFatal = False )
434
443
435
444
vm .run (workdir , ["-m" , "venv" , vm_venv ])
436
445
mx .run (
0 commit comments