[Python][CI] Fix formatting check by using an image with toml. (#1906)

This is required by the yapf tool we use to enforce formatting. Switch
back to using bash syntax for this check. Also re-format a few spots
that slipped in while the check was broken. Fixes #1162.
This commit is contained in:
mikeurbach 2021-09-30 09:40:37 -06:00 committed by GitHub
parent 51a53e48eb
commit 33e975e855
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 9 deletions

View File

@ -15,7 +15,7 @@ jobs:
name: Build LLVM
runs-on: ubuntu-latest
container:
image: ghcr.io/circt/images/circt-ci-build:20210811055218
image: ghcr.io/circt/images/circt-ci-build:20210929220136
steps:
# Clone the CIRCT repo and its submodules. Do shallow clone to save clone
# time.
@ -88,7 +88,7 @@ jobs:
needs: build-llvm
runs-on: ubuntu-latest
container:
image: ghcr.io/circt/images/circt-ci-build:20210811055218
image: ghcr.io/circt/images/circt-ci-build:20210929220136
steps:
- name: Configure Environment
run: echo "$GITHUB_WORKSPACE/llvm/install/bin" >> $GITHUB_PATH
@ -252,9 +252,10 @@ jobs:
# Run yapf to check Python formatting.
- name: python-format
if: ${{ always() }}
shell: bash
run: |
files=$(git diff --name-only $DIFF_COMMIT | grep .py || echo -n)
if [ ! -z $files ]; then
if [[ ! -z $files ]]; then
yapf --diff $files
fi

View File

@ -51,8 +51,8 @@ class Instance:
def path_attr(self) -> msft.RootedInstancePathAttr:
return msft.RootedInstancePathAttr.get(
ir.FlatSymbolRefAttr.get(
ir.StringAttr(
self.root_module._pycde_mod.circt_mod.attributes["sym_name"]).value),
ir.StringAttr(self.root_module._pycde_mod.circt_mod.
attributes["sym_name"]).value),
[x.name_attr for x in self.path[:-1]])
@property

View File

@ -96,8 +96,8 @@ with Context() as ctx, Location.unknown():
# CHECK: hw.instance "inst6" @one_input<BANKS: i32 = 2>(a:
one_input.create("inst6",
a=inst1.a,
parameters={"BANKS": IntegerAttr.get(i32, 2)})
a=inst1.a,
parameters={"BANKS": IntegerAttr.get(i32, 2)})
instance_builder_tests = hw.HWModuleOp(name="instance_builder_tests",
body_builder=instance_builder_body)

View File

@ -36,7 +36,8 @@ config.substitutions.append(('%shlibext', config.llvm_shlib_ext))
config.substitutions.append(('%shlibdir', config.circt_shlib_dir))
config.substitutions.append(('%INC%', config.circt_include_dir))
config.substitutions.append(('%PYTHON%', config.python_executable))
config.substitutions.append(('%TCL_PATH%', config.circt_src_root + '/build/lib/Bindings/Tcl/'))
config.substitutions.append(
('%TCL_PATH%', config.circt_src_root + '/build/lib/Bindings/Tcl/'))
config.substitutions.append(('%CIRCT_SOURCE%', config.circt_src_root))
llvm_config.with_system_environment(['HOME', 'INCLUDE', 'LIB', 'TMP', 'TEMP'])
@ -73,7 +74,8 @@ if config.bindings_python_enabled:
append_path=True)
tool_dirs = [
config.circt_tools_dir, config.circt_utils_dir, config.mlir_tools_dir, config.llvm_tools_dir
config.circt_tools_dir, config.circt_utils_dir, config.mlir_tools_dir,
config.llvm_tools_dir
]
tools = [
'circt-opt', 'circt-translate', 'firtool', 'circt-rtl-sim.py',