From 7f5f7314d12ce70d53f137b6b3d74726165d9d0d Mon Sep 17 00:00:00 2001 From: mpeterv Date: Thu, 26 Nov 2015 14:22:56 +0300 Subject: [PATCH] Don't complile regexps --- hererocks.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hererocks.py b/hererocks.py index ffc6ca4..81113f8 100755 --- a/hererocks.py +++ b/hererocks.py @@ -118,14 +118,13 @@ clever_http_git_whitelist = [ ] git_branch_accepts_tags = None -git_version_regexp = re.compile("(\d+)\.(\d+)\.?(\d*)") def set_git_branch_accepts_tags(): global git_branch_accepts_tags if git_branch_accepts_tags is None: version_output = exec_command(True, "git --version") - match = git_version_regexp.search(version_output) + match = re.search("(\d+)\.(\d+)\.?(\d*)", version_output) if match: major = int(match.group(1)) @@ -223,13 +222,11 @@ def fetch(versions, version, temp_dir, targz=True): commit = exec_command(True, "git rev-parse HEAD").strip() return result_dir, [name, "git", url_to_name(repo), url_to_name(commit)] -lua_version_regexp = re.compile("^\\s*#define\\s+LUA_VERSION_NUM\\s+50(\d)\\s*$") - def detect_lua_version(lua_path): lua_h = open(os.path.join(lua_path, "src", "lua.h")) for line in lua_h: - match = lua_version_regexp.match(line) + match = re.match("^\\s*#define\\s+LUA_VERSION_NUM\\s+50(\d)\\s*$", line) if match: return "5." + match.group(1)