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

Moved .done files into a subdirectory #424

Merged
merged 1 commit into from
Nov 22, 2023
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

# Make targets
/*.done
/done/*.done

# Make build
/build/
Expand Down
33 changes: 18 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ doc_dependent_files := \
examples/hmccreds.yaml \
$(package_py_files) \

# Directory for .done files
done_dir := done

# Packages whose dependencies are checked using pip-missing-reqs
check_reqs_packages := pip_check_reqs pipdeptree build pytest coverage coveralls flake8 pylint sphinx twine

Expand Down Expand Up @@ -206,33 +209,33 @@ ifeq (,$(package_version))
endif

.PHONY: install
install: install_$(pymn)_$(PACKAGE_LEVEL).done
install: $(done_dir)/install_$(pymn)_$(PACKAGE_LEVEL).done
@echo "Makefile: $@ done."

.PHONY: develop
develop: develop_$(pymn)_$(PACKAGE_LEVEL).done
develop: $(done_dir)/develop_$(pymn)_$(PACKAGE_LEVEL).done
@echo "Makefile: $@ done."

.PHONY: check
check: develop_$(pymn)_$(PACKAGE_LEVEL).done
check: $(done_dir)/develop_$(pymn)_$(PACKAGE_LEVEL).done
@echo "Makefile: Performing flake8 checks with PACKAGE_LEVEL=$(PACKAGE_LEVEL)"
flake8 --config .flake8 $(package_py_files) $(test_py_files) setup.py $(doc_dir)/conf.py
@echo "Makefile: Done performing flake8 checks"
@echo "Makefile: $@ done."

.PHONY: pylint
pylint: develop_$(pymn)_$(PACKAGE_LEVEL).done
pylint: $(done_dir)/develop_$(pymn)_$(PACKAGE_LEVEL).done
@echo "Makefile: Performing pylint checks with PACKAGE_LEVEL=$(PACKAGE_LEVEL)"
pylint --rcfile=.pylintrc --disable=fixme $(package_py_files) $(test_py_files) setup.py $(doc_dir)/conf.py
@echo "Makefile: Done performing pylint checks"
@echo "Makefile: $@ done."

.PHONY: safety
safety: safety_$(pymn)_$(PACKAGE_LEVEL).done
safety: $(done_dir)/safety_$(pymn)_$(PACKAGE_LEVEL).done
@echo "Makefile: $@ done."

.PHONY: check_reqs
check_reqs: develop_$(pymn)_$(PACKAGE_LEVEL).done minimum-constraints.txt requirements.txt
check_reqs: $(done_dir)/develop_$(pymn)_$(PACKAGE_LEVEL).done minimum-constraints.txt requirements.txt
@echo "Makefile: Checking missing dependencies of this package"
# TODO-PYPI: Re-enable once a new version of prometheus-client (after 2023-11-09) has been released on Pypi
# pip-missing-reqs $(package_name) --requirements-file=requirements.txt
Expand All @@ -248,15 +251,15 @@ else
endif
@echo "Makefile: $@ done."

safety_$(pymn)_$(PACKAGE_LEVEL).done: develop_$(pymn)_$(PACKAGE_LEVEL).done Makefile $(safety_policy_file) minimum-constraints.txt
$(done_dir)/safety_$(pymn)_$(PACKAGE_LEVEL).done: $(done_dir)/develop_$(pymn)_$(PACKAGE_LEVEL).done Makefile $(safety_policy_file) minimum-constraints.txt
@echo "Makefile: Running Safety"
-$(call RM_FUNC,$@)
safety check --policy-file $(safety_policy_file) -r minimum-constraints.txt --full-report
echo "done" >$@
@echo "Makefile: Done running Safety"

.PHONY: test
test: develop_$(pymn)_$(PACKAGE_LEVEL).done $(pytest_cov_files)
test: $(done_dir)/develop_$(pymn)_$(PACKAGE_LEVEL).done $(pytest_cov_files)
@echo "Makefile: Performing unit tests and coverage with PACKAGE_LEVEL=$(PACKAGE_LEVEL)"
@echo "Makefile: Note that the warning about an unknown metric is part of the tests"
pytest $(pytest_cov_opts) -s $(test_dir)
Expand All @@ -276,7 +279,7 @@ all: install develop check_reqs check pylint test build builddoc check_reqs
@echo "Makefile: $@ done."

.PHONY: all
docker: _check_version docker_$(pymn)_$(PACKAGE_LEVEL).done
docker: _check_version $(done_dir)/docker_$(pymn)_$(PACKAGE_LEVEL).done
@echo "Makefile: $@ done."

.PHONY: upload
Expand Down Expand Up @@ -308,29 +311,29 @@ clobber: clean
-$(call RM_FUNC,*.done)
@echo "Makefile: $@ done."

install_base_$(pymn)_$(PACKAGE_LEVEL).done:
$(done_dir)/install_base_$(pymn)_$(PACKAGE_LEVEL).done:
@echo "Makefile: Installing base packages with PACKAGE_LEVEL=$(PACKAGE_LEVEL)"
-$(call RM_FUNC,$@)
bash -c 'pv=$$($(PYTHON_CMD) -m pip --version); if [[ $$pv =~ (^pip [1-8]\..*) ]]; then $(PYTHON_CMD) -m pip install pip==9.0.1; fi'
$(PYTHON_CMD) -m pip install $(pip_level_opts) pip setuptools wheel
@echo "Makefile: Done installing base packages"
echo "done" >$@

install_$(pymn)_$(PACKAGE_LEVEL).done: install_base_$(pymn)_$(PACKAGE_LEVEL).done requirements.txt setup.py
$(done_dir)/install_$(pymn)_$(PACKAGE_LEVEL).done: $(done_dir)/install_base_$(pymn)_$(PACKAGE_LEVEL).done requirements.txt setup.py
@echo "Makefile: Installing package and its prerequisites with PACKAGE_LEVEL=$(PACKAGE_LEVEL)"
-$(call RM_FUNC,$@)
$(PYTHON_CMD) -m pip install $(pip_level_opts) -e .
@echo "Makefile: Done installing package and its prerequisites"
echo "done" >$@

develop_$(pymn)_$(PACKAGE_LEVEL).done: install_$(pymn)_$(PACKAGE_LEVEL).done dev-requirements.txt
$(done_dir)/develop_$(pymn)_$(PACKAGE_LEVEL).done: $(done_dir)/install_$(pymn)_$(PACKAGE_LEVEL).done dev-requirements.txt
@echo "Makefile: Installing prerequisites for development with PACKAGE_LEVEL=$(PACKAGE_LEVEL)"
-$(call RM_FUNC,$@)
$(PYTHON_CMD) -m pip install $(pip_level_opts) -r dev-requirements.txt
@echo "Makefile: Done installing prerequisites for development"
echo "done" >$@

$(doc_build_file): develop_$(pymn)_$(PACKAGE_LEVEL).done $(doc_dependent_files)
$(doc_build_file): $(done_dir)/develop_$(pymn)_$(PACKAGE_LEVEL).done $(doc_dependent_files)
@echo "Makefile: Generating HTML documentation with main file: $@"
sphinx-build -b html -v $(doc_dir) $(doc_build_dir)
@echo "Makefile: Done generating HTML documentation"
Expand All @@ -354,13 +357,13 @@ endif
# regenerate MANIFEST. Otherwise, changes in MANIFEST.in will not be used.
# Note: Deleting build is a safeguard against picking up partial build products
# which can lead to incorrect hashbangs in scripts in wheel archives.
$(bdist_file) $(sdist_file): _check_version develop_$(pymn)_$(PACKAGE_LEVEL).done Makefile MANIFEST.in $(dist_included_files)
$(bdist_file) $(sdist_file): _check_version $(done_dir)/develop_$(pymn)_$(PACKAGE_LEVEL).done Makefile MANIFEST.in $(dist_included_files)
-$(call RM_FUNC,MANIFEST)
-$(call RMDIR_FUNC,build $(package_name).egg-info .eggs)
$(PYTHON_CMD) -m build --outdir $(dist_dir)
@echo 'Done: Created distribution archives: $@'

docker_$(pymn)_$(PACKAGE_LEVEL).done: develop_$(pymn)_$(PACKAGE_LEVEL).done Dockerfile .dockerignore Makefile MANIFEST.in $(dist_included_files)
$(done_dir)/docker_$(pymn)_$(PACKAGE_LEVEL).done: $(done_dir)/develop_$(pymn)_$(PACKAGE_LEVEL).done Dockerfile .dockerignore Makefile MANIFEST.in $(dist_included_files)
@echo "Makefile: Building Docker image $(docker_registry):latest"
-$(call RM_FUNC,$@)
docker build -t $(docker_registry):latest .
Expand Down
Empty file added done/.dummy
Empty file.