From 047dcd52c1d650c65b2fda3fb354f0811a0f650e Mon Sep 17 00:00:00 2001 From: MatthewFlamm <39341281+MatthewFlamm@users.noreply.github.com> Date: Wed, 30 Jun 2021 14:48:24 -0400 Subject: [PATCH] add typed packages to dev (#74) --- generate_phacc/generate_phacc.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/generate_phacc/generate_phacc.py b/generate_phacc/generate_phacc.py index d848722..4f9e6a1 100755 --- a/generate_phacc/generate_phacc.py +++ b/generate_phacc/generate_phacc.py @@ -1,6 +1,7 @@ #! /usr/bin/env python import pathlib +import re import shutil import os @@ -75,13 +76,27 @@ with open(REQUIREMENTS_FILE, "r") as original_file: data = original_file.readlines() - + + +def is_test_requirement(requirement): + # if == not in d this is either a comment or unkown package, include + if "==" not in requirement: + return True + + regex = re.compile('types-.+') + if re.match(regex, requirement): + return False + + if d.split("==")[0] in requirements_remove: + return False + + return True + + new_data = [] removed_data = [] for d in data: - if "==" not in d: - new_data.append(d) - elif d.split("==")[0] not in requirements_remove: + if is_test_requirement(d): new_data.append(d) else: removed_data.append(d)