Skip to content

Commit a612902

Browse files
fix(ci): add missing deps to requirements-ci.txt and fix safe_name path validation
- requirements-ci.txt: add click, rich, psutil, beautifulsoup4, lxml (all imported by concore_cli which test_cli.py and test_graph.py depend on) - mkconcore.py: validate only basename in safe_name() so absolute paths passed by run.py are not rejected (/ was in forbidden charset)
1 parent 7e60fdc commit a612902

2 files changed

Lines changed: 22 additions & 17 deletions

File tree

mkconcore.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,22 @@ def safe_name(value, context):
8686
raise ValueError(f"Unsafe {context}: '{value}' contains illegal characters.")
8787
return value
8888

89-
MKCONCORE_VER = "22-09-18"
90-
91-
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
92-
93-
def _resolve_concore_path():
94-
script_concore = os.path.join(SCRIPT_DIR, "concore.py")
95-
if os.path.exists(script_concore):
96-
return SCRIPT_DIR
97-
cwd_concore = os.path.join(os.getcwd(), "concore.py")
98-
if os.path.exists(cwd_concore):
99-
return os.getcwd()
100-
return SCRIPT_DIR
101-
102-
GRAPHML_FILE = sys.argv[1]
103-
TRIMMED_LOGS = True
104-
CONCOREPATH = _resolve_concore_path()
89+
MKCONCORE_VER = "22-09-18"
90+
91+
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
92+
93+
def _resolve_concore_path():
94+
script_concore = os.path.join(SCRIPT_DIR, "concore.py")
95+
if os.path.exists(script_concore):
96+
return SCRIPT_DIR
97+
cwd_concore = os.path.join(os.getcwd(), "concore.py")
98+
if os.path.exists(cwd_concore):
99+
return os.getcwd()
100+
return SCRIPT_DIR
101+
102+
GRAPHML_FILE = sys.argv[1]
103+
TRIMMED_LOGS = True
104+
CONCOREPATH = _resolve_concore_path()
105105
CPPWIN = "g++" #Windows C++ 6/22/21
106106
CPPEXE = "g++" #Ubuntu/macOS C++ 6/22/21
107107
VWIN = "iverilog" #Windows verilog 6/25/21
@@ -143,7 +143,7 @@ def _resolve_concore_path():
143143
outdir = sys.argv[3]
144144

145145
# Validate outdir argument
146-
safe_name(outdir, "Output directory argument")
146+
safe_name(os.path.basename(outdir), "Output directory argument")
147147

148148
if not os.path.isdir(sourcedir):
149149
logging.error(f"{sourcedir} does not exist")

requirements-ci.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,8 @@ pytest
44
ruff
55
pyzmq
66
numpy
7+
click>=8.0.0
8+
rich>=10.0.0
9+
psutil>=5.8.0
10+
beautifulsoup4
11+
lxml

0 commit comments

Comments
 (0)