summaryrefslogtreecommitdiffstats
path: root/Tools/peg_generator/scripts/benchmark.py
diff options
context:
space:
mode:
authorLysandros Nikolaou <lisandrosnik@gmail.com>2020-05-18 18:27:40 (GMT)
committerGitHub <noreply@github.com>2020-05-18 18:27:40 (GMT)
commitdc31800f86fbcd40ee616984820b885d8adaa6a7 (patch)
treeabb3f07fd5a54fb652cc91e192ebe89918903cc5 /Tools/peg_generator/scripts/benchmark.py
parent2135e10dc717c00d10d899d232bebfc59bb25032 (diff)
downloadcpython-dc31800f86fbcd40ee616984820b885d8adaa6a7.zip
cpython-dc31800f86fbcd40ee616984820b885d8adaa6a7.tar.gz
cpython-dc31800f86fbcd40ee616984820b885d8adaa6a7.tar.bz2
bpo-40669: Install PEG benchmarking dependencies in a venv (GH-20183)
Create a `make venv` target, that creates a virtual environment and installs the dependency in that venv. `make time` and all the related targets are changed to use the virtual environment python. Automerge-Triggered-By: @pablogsal
Diffstat (limited to 'Tools/peg_generator/scripts/benchmark.py')
-rw-r--r--Tools/peg_generator/scripts/benchmark.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Tools/peg_generator/scripts/benchmark.py b/Tools/peg_generator/scripts/benchmark.py
index d39ac3d..4942b99 100644
--- a/Tools/peg_generator/scripts/benchmark.py
+++ b/Tools/peg_generator/scripts/benchmark.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.9
+#!/usr/bin/env python3
import argparse
import ast
@@ -6,7 +6,12 @@ import sys
import os
from time import time
-import memory_profiler
+try:
+ import memory_profiler
+except ModuleNotFoundError:
+ print("Please run `make venv` to create a virtual environment and install"
+ " all the dependencies, before running this script.")
+ sys.exit(1)
sys.path.insert(0, os.getcwd())
from peg_extension import parse