Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a few nits dealing with updated makefile #4058

Merged
merged 1 commit into from
Jan 6, 2025
Merged
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
23 changes: 13 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ ALL_EXECUTABLE_SPEC_NAMES = \

# A list of fake targets.
.PHONY: \
check_toc \
clean \
coverage \
detect_errors \
Expand All @@ -39,7 +38,6 @@ NORM = $(shell tput sgr0)

# Print target descriptions.
help:
@echo "make $(BOLD)check_toc$(NORM) -- check table of contents"
@echo "make $(BOLD)clean$(NORM) -- delete all untracked files"
@echo "make $(BOLD)coverage$(NORM) -- run pyspec tests with coverage"
@echo "make $(BOLD)detect_errors$(NORM) -- detect generator errors"
Expand Down Expand Up @@ -85,7 +83,7 @@ $(ETH2SPEC): setup.py | $(VENV)

# Force rebuild/install the eth2spec package.
eth2spec:
$(MAKE) --always-make $(ETH2SPEC)
@$(MAKE) --always-make $(ETH2SPEC)
Copy link
Contributor

Choose a reason for hiding this comment

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

sorry I didn't find it in the previous PR, but here, it seems eth2spec command doesn't trigger the rebuild (compile from markdown file to .py files)?

I think we need to trigger the make pyspec action: @$(PYTHON_VENV) setup.py pyspecdev here, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

These should be separate steps; the generators don't need it. Building eth2spec will compile the markdown files. These will exist in the build & venv dirs. And these are the files which are used by the generators. If I run make clean and make gen_all it will work without make pyspec.

image

But for make test we do need make pyspec. It adds these to the tests directory.

image


# Create the pyspec for all phases.
pyspec: $(VENV) setup.py
Expand All @@ -99,6 +97,8 @@ pyspec: $(VENV) setup.py
TEST_REPORT_DIR = $(PYSPEC_DIR)/test-reports

# Run pyspec tests.
# Note: for debugging output to show, print to stderr.
#
# To run a specific test, append k=<test>, eg:
# make test k=test_verify_kzg_proof
# To run tests for a specific fork, append fork=<fork>, eg:
Expand All @@ -117,6 +117,7 @@ test: $(ETH2SPEC) pyspec
@mkdir -p $(TEST_REPORT_DIR)
@$(PYTHON_VENV) -m pytest \
-n auto \
--capture=no \
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI I usually use -s. It seems the same.

Copy link
Member Author

@jtraglia jtraglia Dec 18, 2024

Choose a reason for hiding this comment

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

Yeah these are the same. I prefer using the long-form options in scripts.

$(MAYBE_TEST) \
$(MAYBE_FORK) \
$(PRESET) \
Expand Down Expand Up @@ -193,10 +194,6 @@ MARKDOWN_FILES = $(wildcard $(SPEC_DIR)/*/*.md) \
$(wildcard $(SPEC_DIR)/_features/*/*/*.md) \
$(wildcard $(SSZ_DIR)/*.md)

# Check all files and error if any ToC were modified.
check_toc: $(MARKDOWN_FILES:=.toc)
@[ "$$(find . -name '*.md.tmp' -print -quit)" ] && exit 1 || exit 0

# Generate ToC sections & save copy of original if modified.
%.toc:
@cp $* $*.tmp; \
Expand All @@ -209,8 +206,12 @@ check_toc: $(MARKDOWN_FILES:=.toc)
echo "\033[1;34m See $*.tmp\033[0m"; \
fi

# Check all files and error if any ToC were modified.
_check_toc: $(MARKDOWN_FILES:=.toc)
@[ "$$(find . -name '*.md.tmp' -print -quit)" ] && exit 1 || exit 0

# Check for mistakes.
lint: $(ETH2SPEC) pyspec check_toc
lint: $(ETH2SPEC) pyspec _check_toc
@$(CODESPELL_VENV) . --skip "./.git,$(VENV),$(PYSPEC_DIR)/.mypy_cache" -I .codespell-whitelist
@$(PYTHON_VENV) -m flake8 --config $(FLAKE8_CONFIG) $(PYSPEC_DIR)/eth2spec
@$(PYTHON_VENV) -m flake8 --config $(FLAKE8_CONFIG) $(TEST_GENERATORS_DIR)
Expand All @@ -235,17 +236,19 @@ gen_list:
done

# Run one generator.
# This will forcibly rebuild eth2spec just in case.
# To check modules for a generator, append modcheck=true, eg:
# make gen_genesis modcheck=true
gen_%: MAYBE_MODCHECK := $(if $(filter true,$(modcheck)),--modcheck)
gen_%: $(ETH2SPEC) pyspec
gen_%: eth2spec
@mkdir -p $(TEST_VECTOR_DIR)
@$(PYTHON_VENV) $(GENERATOR_DIR)/$*/main.py \
--output $(TEST_VECTOR_DIR) \
$(MAYBE_MODCHECK)

# Run all generators then check for errors.
gen_all: $(GENERATOR_TARGETS) detect_errors
gen_all: $(GENERATOR_TARGETS)
@$(MAKE) detect_errors

# Detect errors in generators.
detect_errors: $(TEST_VECTOR_DIR)
Expand Down