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

Makefile updates #234

Merged
merged 12 commits into from
Jan 27, 2024
4 changes: 2 additions & 2 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/setup-python@v4
- run: pip install flake8
- name: Style check
run: make check
run: make check-style

rst:
name: Check reStructuredText
Expand All @@ -40,7 +40,7 @@ jobs:
- name: Examples check
run: |
. venv
make test-examples
make check-examples

test:
name: Run test suite
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Contribution Checklist

make docker-test

* Make sure the style check passes for every commit::
* Make sure the static analysis (style checks, etc.) passes for every commit::

make check

Expand Down
9 changes: 3 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Route plain 'make' to Sphinx help
.PHONY: all
all: help
.PHONY: default
default: help

subdirs := . test doc src/hawkmoth docker

include $(subdirs:%=%/Makefile.local)
include Makefile.rules
include $(shell find -name Makefile.local)
28 changes: 14 additions & 14 deletions Makefile.local
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
# -*- makefile -*-
# Copyright (c) 2018, Jani Nikula <[email protected]>
# Licensed under the terms of BSD 2-Clause, see LICENSE for details.
#
# Helpers for packaging and releasing.
#
# FIXME:
#
# * Add helpers for releasing
# - release checks
# - updating the version
# - tagging
# - uploading tagged versions to pypi
#

dir := .

RST := $(RST) CHANGELOG.rst CONTRIBUTING.rst README.rst

# Static analysis
.PHONY: check
check:
check: check-style check-rst check-examples

.PHONY: check-style
check-style:
flake8 src/hawkmoth test

.PHONY: check-rst
Expand All @@ -44,4 +34,14 @@ test-upload:
upload:
twine upload dist/*

.PHONY: clean
clean:
rm -rf $(CLEAN)

.PHONY: distclean
distclean: clean
rm -rf $(DISTCLEAN)

.SUFFIXES:

DISTCLEAN := $(DISTCLEAN) build dist hawkmoth.egg-info
29 changes: 0 additions & 29 deletions Makefile.rules

This file was deleted.

5 changes: 1 addition & 4 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
all:
$(MAKE) -C .. all

.DEFAULT:
.DEFAULT default:
$(MAKE) -C .. $@
11 changes: 4 additions & 7 deletions doc/Makefile.local
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,20 @@
# Makefile for Sphinx documentation
#

dir := doc

# dir may get overwritten, make a copy
docdir := $(dir)
doc_dir := doc

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?= -t use-installed-hawkmoth
SPHINXBUILD ?= sphinx-build
SOURCEDIR = $(docdir)
BUILDDIR = $(docdir)/_build
SOURCEDIR = $(doc_dir)
BUILDDIR = $(doc_dir)/_build

CLEAN := $(CLEAN) $(BUILDDIR)

.PHONY: update-examples
update-examples:
$(test_dir)/update-examples.py > $(docdir)/examples.rst
$(test_dir)/update-examples.py > $(doc_dir)/examples.rst

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
Expand Down
5 changes: 1 addition & 4 deletions docker/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
all:
$(MAKE) -C .. all

.DEFAULT:
.DEFAULT default:
$(MAKE) -C .. $@
5 changes: 1 addition & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
all:
$(MAKE) -C .. all

.DEFAULT:
.DEFAULT default:
$(MAKE) -C .. $@
7 changes: 2 additions & 5 deletions src/hawkmoth/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
all:
$(MAKE) -C .. all

.DEFAULT:
$(MAKE) -C .. $@
.DEFAULT default:
$(MAKE) -C ../.. $@
4 changes: 2 additions & 2 deletions src/hawkmoth/Makefile.local
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- makefile -*-

dir := src/hawkmoth
src_dir := src/hawkmoth
Copy link
Collaborator

Choose a reason for hiding this comment

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

Being overly pedantic here, but this would fit better with the 1st commit. No biggie though.

Copy link
Owner Author

Choose a reason for hiding this comment

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

I guess I made this drive-by change, and that inspired me to do the docdir change.


CLEAN := $(CLEAN) $(dir)/hawkmoth.pyc $(dir)/cautodoc.pyc $(dir)/__init__.pyc
CLEAN := $(CLEAN) $(shell find $(src_dir) -type d -name __pycache__)
5 changes: 1 addition & 4 deletions test/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
all:
$(MAKE) -C .. all

.DEFAULT:
.DEFAULT default:
$(MAKE) -C .. $@
12 changes: 9 additions & 3 deletions test/Makefile.local
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,27 @@ RST := $(RST) $(test_dir)/README.rst
test:
pytest -n auto

.PHONY: test-verbose
test-verbose:
pytest -n auto -vv

# Ensure a) update-examples works, and b) examples have been updated.
test-examples:
$(test_dir)/update-examples.py | diff -u $(docdir)/examples.rst -
.PHONY: check-examples
check-examples:
$(test_dir)/update-examples.py | diff -u $(doc_dir)/examples.rst -

.PHONY: quick-test
quick-test:
pytest -n auto -m "not full"

.PHONY: test-coverage
test-coverage:
pytest -n auto --cov=src/hawkmoth --cov-report=term

.PHONY: test-coverage-html
test-coverage-html:
pytest -n auto --cov=src/hawkmoth --cov-report=term --cov-report=html:$(test_dir)/coverage-report
@echo "Coverage report: file://$(CURDIR)/$(test_dir)/coverage-report/index.html"

CLEAN := $(CLEAN) .coverage $(test_dir)/coverage-report
CLEAN := $(CLEAN) .coverage $(test_dir)/coverage-report \
$(shell find $(test_dir) -type d -name __pycache__)
Loading