Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions flow/util/generate-vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ EXCLUDED_VARS+='|COMMAND_LINE_ARGS'
EXCLUDED_PATTERNS="_EXE$|PATH$|_CMD$|\."

echo 'export FLOW_HOME=${FLOW_HOME:-$(pwd)}' > $1.sh
# *_EXE paths are machine specific and excluded below; default to PATH lookup.
echo 'export PYTHON_EXE=${PYTHON_EXE:-python3}' >> $1.sh
echo 'if { ![info exists env(PYTHON_EXE)] } { set env(PYTHON_EXE) python3 }' > $1.tcl

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using the fully-qualified ::env global namespace is more robust in Tcl than the unqualified env array. This avoids potential scoping issues if the generated Tcl script is sourced within a non-global scope (such as inside a procedure or namespace). It also maintains consistency with how other environment variables are referenced in the codebase (e.g., $::env(FLOW_HOME)).

Suggested change
echo 'if { ![info exists env(PYTHON_EXE)] } { set env(PYTHON_EXE) python3 }' > $1.tcl
echo 'if { ![info exists ::env(PYTHON_EXE)] } { set ::env(PYTHON_EXE) python3 }' > $1.tcl


while read -r VAR; do
if [[ ${VAR} != *"="* ]] ; then
Expand Down
1 change: 0 additions & 1 deletion flow/util/makeIssue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ cat > ${RUN_ME_SCRIPT} <<EOF
#!/usr/bin/env bash
cd "\$(dirname "\$0")"
source ./$(basename ${VARS_BASENAME}).sh
export PYTHON_EXE=\${PYTHON_EXE:-\$(command -v python3)}
yosys ${YOSYS_FLAGS:-} -c \${SCRIPTS_DIR}/${ISSUE_TARGET}.tcl
EOF
else
Expand Down