From 3a72154055d234f75083151c5acf0622d378ae1b Mon Sep 17 00:00:00 2001 From: Byron Lathi Date: Mon, 14 Jul 2025 12:45:49 -0700 Subject: [PATCH] Expand env vars --- init_env.sh | 2 ++ pyproject.toml | 2 +- src/rtl_manifest/rtl_manifest.py | 4 +++- test/other_file.txt | 0 test/sources.list | 2 ++ 5 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 test/other_file.txt diff --git a/init_env.sh b/init_env.sh index 76d7008..c57a743 100644 --- a/init_env.sh +++ b/init_env.sh @@ -1,3 +1,5 @@ python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt + +export TOP_DIR=$(git rev-parse --show-toplevel) diff --git a/pyproject.toml b/pyproject.toml index dd7e62e..1df9e30 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ name = "rtl-manifest" # REQUIRED, is the only field that cannot be marked as dy # https://packaging.python.org/guides/single-sourcing-package-version/ # dynamic = ["version"] -version = "0.3.1" # REQUIRED, although can be dynamic +version = "0.4.0" # REQUIRED, although can be dynamic # This is a one-line description or tagline of what your project does. This # corresponds to the "Summary" metadata field: diff --git a/src/rtl_manifest/rtl_manifest.py b/src/rtl_manifest/rtl_manifest.py index 42fa26e..b125920 100644 --- a/src/rtl_manifest/rtl_manifest.py +++ b/src/rtl_manifest/rtl_manifest.py @@ -3,6 +3,8 @@ import argparse from typing import List, Tuple import pathlib +import os + def rtl_manifest_main(): parser = argparse.ArgumentParser( @@ -38,7 +40,7 @@ def parse(source_file: str) -> Tuple[List[str], List[str]]: base_dir = pathlib.Path(source_file).parent with open(source_file, "r") as file: for line in file: - path = line.strip() + path = os.path.expandvars(line.strip()) if path.startswith("#"): continue if path == "": diff --git a/test/other_file.txt b/test/other_file.txt new file mode 100644 index 0000000..e69de29 diff --git a/test/sources.list b/test/sources.list index 01537e2..c9a4d86 100644 --- a/test/sources.list +++ b/test/sources.list @@ -4,3 +4,5 @@ src/example.sv # ^ above was a blank line `include . + +$TOP_DIR/src/other_file.txt