-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
684 lines (543 loc) · 18.7 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
##############################################################################
# THIS FILE IS GENERATED BY MXMAKE
#
# DOMAINS:
#: applications.zest-releaser
#: core.base
#: core.mxenv
#: core.mxfiles
#: core.packages
#: docs.sphinx
#: qa.coverage
#: qa.isort
#: qa.mypy
#: qa.ruff
#: qa.test
#
# SETTINGS (ALL CHANGES MADE BELOW SETTINGS WILL BE LOST)
##############################################################################
## core.base
# `deploy` target dependencies.
# No default value.
DEPLOY_TARGETS?=
# target to be executed when calling `make run`
# No default value.
RUN_TARGET?=
# Additional files and folders to remove when running clean target
# No default value.
CLEAN_FS?=
# Optional makefile to include before default targets. This can
# be used to provide custom targets or hook up to existing targets.
# Default: include.mk
INCLUDE_MAKEFILE?=include.mk
# Optional additional directories to be added to PATH in format
# `/path/to/dir/:/path/to/other/dir`. Gets inserted first, thus gets searched
# first.
# No default value.
EXTRA_PATH?=
## core.mxenv
# Primary Python interpreter to use. It is used to create the
# virtual environment if `VENV_ENABLED` and `VENV_CREATE` are set to `true`.
# Default: python3
PRIMARY_PYTHON?=python3
# Minimum required Python version.
# Default: 3.7
PYTHON_MIN_VERSION?=3.9
# Install packages using the given package installer method.
# Supported are `pip` and `uv`. If uv is used, its global availability is
# checked. Otherwise, it is installed, either in the virtual environment or
# using the `PRIMARY_PYTHON`, dependent on the `VENV_ENABLED` setting. If
# `VENV_ENABLED` and uv is selected, uv is used to create the virtual
# environment.
# Default: pip
PYTHON_PACKAGE_INSTALLER?=uv
# Flag whether to use a global installed 'uv' or install
# it in the virtual environment.
# Default: false
MXENV_UV_GLOBAL?=false
# Flag whether to use virtual environment. If `false`, the
# interpreter according to `PRIMARY_PYTHON` found in `PATH` is used.
# Default: true
VENV_ENABLED?=true
# Flag whether to create a virtual environment. If set to `false`
# and `VENV_ENABLED` is `true`, `VENV_FOLDER` is expected to point to an
# existing virtual environment.
# Default: true
VENV_CREATE?=true
# The folder of the virtual environment.
# If `VENV_ENABLED` is `true` and `VENV_CREATE` is true it is used as the
# target folder for the virtual environment. If `VENV_ENABLED` is `true` and
# `VENV_CREATE` is false it is expected to point to an existing virtual
# environment. If `VENV_ENABLED` is `false` it is ignored.
# Default: .venv
VENV_FOLDER?=.venv
# mxdev to install in virtual environment.
# Default: mxdev
MXDEV?=mxdev@git+https://github.com/mxstack/mxdev.git
# mxmake to install in virtual environment.
# Default: mxmake
MXMAKE?=-e .
## qa.ruff
# Source folder to scan for Python files to run ruff on.
# Default: src
RUFF_SRC?=src
## qa.isort
# Source folder to scan for Python files to run isort on.
# Default: src
ISORT_SRC?=src
## docs.sphinx
# Documentation source folder.
# Default: docs/source
DOCS_SOURCE_FOLDER?=docs/source
# Documentation generation target folder.
# Default: docs/html
DOCS_TARGET_FOLDER?=docs/html
# Documentation Python requirements to be installed (via pip).
# No default value.
DOCS_REQUIREMENTS?=
## core.mxfiles
# The config file to use.
# Default: mx.ini
PROJECT_CONFIG?=mx.ini
## core.packages
# Allow prerelease and development versions.
# By default, the package installer only finds stable versions.
# Default: false
PACKAGES_ALLOW_PRERELEASES?=false
## qa.test
# The command which gets executed. Defaults to the location the
# :ref:`run-tests` template gets rendered to if configured.
# Default: .mxmake/files/run-tests.sh
TEST_COMMAND?=.mxmake/files/run-tests.sh
# Additional Python requirements for running tests to be
# installed (via pip).
# Default: pytest
TEST_REQUIREMENTS?=pytest
# Additional make targets the test target depends on.
# No default value.
TEST_DEPENDENCY_TARGETS?=
## qa.coverage
# The command which gets executed. Defaults to the location the
# :ref:`run-coverage` template gets rendered to if configured.
# Default: .mxmake/files/run-coverage.sh
COVERAGE_COMMAND?=.mxmake/files/run-coverage.sh
## qa.mypy
# Source folder for code analysis.
# Default: src
MYPY_SRC?=src
# Mypy Python requirements to be installed (via pip).
# Default: types-setuptools
MYPY_REQUIREMENTS?=types-setuptools types-docutils types-PyYAML
## applications.zest-releaser
# Options to pass to zest.releaser prerelease command.
# No default value.
ZEST_RELEASER_PRERELEASE_OPTIONS?=
# Options to pass to zest.releaser release command.
# No default value.
ZEST_RELEASER_RELEASE_OPTIONS?=
# Options to pass to zest.releaser postrelease command.
# No default value.
ZEST_RELEASER_POSTRELEASE_OPTIONS?=
# Options to pass to zest.releaser fullrelease command.
# No default value.
ZEST_RELEASER_FULLRELEASE_OPTIONS?=
##############################################################################
# END SETTINGS - DO NOT EDIT BELOW THIS LINE
##############################################################################
INSTALL_TARGETS?=
DIRTY_TARGETS?=
CLEAN_TARGETS?=
PURGE_TARGETS?=
CHECK_TARGETS?=
TYPECHECK_TARGETS?=
FORMAT_TARGETS?=
export PATH:=$(if $(EXTRA_PATH),$(EXTRA_PATH):,)$(PATH)
# Defensive settings for make: https://tech.davis-hansson.com/p/make/
SHELL:=bash
.ONESHELL:
# for Makefile debugging purposes add -x to the .SHELLFLAGS
.SHELLFLAGS:=-eu -o pipefail -O inherit_errexit -c
.SILENT:
.DELETE_ON_ERROR:
MAKEFLAGS+=--warn-undefined-variables
MAKEFLAGS+=--no-builtin-rules
# mxmake folder
MXMAKE_FOLDER?=.mxmake
# Sentinel files
SENTINEL_FOLDER?=$(MXMAKE_FOLDER)/sentinels
SENTINEL?=$(SENTINEL_FOLDER)/about.txt
$(SENTINEL): $(firstword $(MAKEFILE_LIST))
@mkdir -p $(SENTINEL_FOLDER)
@echo "Sentinels for the Makefile process." > $(SENTINEL)
##############################################################################
# mxenv
##############################################################################
export OS:=$(OS)
# Determine the executable path
ifeq ("$(VENV_ENABLED)", "true")
export VIRTUAL_ENV=$(abspath $(VENV_FOLDER))
ifeq ("$(OS)", "Windows_NT")
VENV_EXECUTABLE_FOLDER=$(VIRTUAL_ENV)/Scripts
else
VENV_EXECUTABLE_FOLDER=$(VIRTUAL_ENV)/bin
endif
export PATH:=$(VENV_EXECUTABLE_FOLDER):$(PATH)
MXENV_PYTHON=python
else
MXENV_PYTHON=$(PRIMARY_PYTHON)
endif
# Determine the package installer
ifeq ("$(PYTHON_PACKAGE_INSTALLER)","uv")
PYTHON_PACKAGE_COMMAND=uv pip
else
PYTHON_PACKAGE_COMMAND=$(MXENV_PYTHON) -m pip
endif
MXENV_TARGET:=$(SENTINEL_FOLDER)/mxenv.sentinel
$(MXENV_TARGET): $(SENTINEL)
@$(PRIMARY_PYTHON) -c "import sys; vi = sys.version_info; sys.exit(1 if (int(vi[0]), int(vi[1])) >= tuple(map(int, '$(PYTHON_MIN_VERSION)'.split('.'))) else 0)" \
&& echo "Need Python >= $(PYTHON_MIN_VERSION)" && exit 1 || :
@[[ "$(VENV_ENABLED)" == "true" && "$(VENV_FOLDER)" == "" ]] \
&& echo "VENV_FOLDER must be configured if VENV_ENABLED is true" && exit 1 || :
@[[ "$(VENV_ENABLED)$(PYTHON_PACKAGE_INSTALLER)" == "falseuv" ]] \
&& echo "Package installer uv does not work with a global Python interpreter." && exit 1 || :
ifeq ("$(VENV_ENABLED)", "true")
ifeq ("$(VENV_CREATE)", "true")
ifeq ("$(PYTHON_PACKAGE_INSTALLER)$(MXENV_UV_GLOBAL)","uvtrue")
@echo "Setup Python Virtual Environment using package 'uv' at '$(VENV_FOLDER)'"
@uv venv -p $(PRIMARY_PYTHON) --seed $(VENV_FOLDER)
else
@echo "Setup Python Virtual Environment using module 'venv' at '$(VENV_FOLDER)'"
@$(PRIMARY_PYTHON) -m venv $(VENV_FOLDER)
@$(MXENV_PYTHON) -m ensurepip -U
endif
endif
else
@echo "Using system Python interpreter"
endif
ifeq ("$(PYTHON_PACKAGE_INSTALLER)$(MXENV_UV_GLOBAL)","uvfalse")
@echo "Install uv"
@$(MXENV_PYTHON) -m pip install uv
endif
@$(PYTHON_PACKAGE_COMMAND) install -U pip setuptools wheel
@echo "Install/Update MXStack Python packages"
@$(PYTHON_PACKAGE_COMMAND) install -U $(MXDEV) $(MXMAKE)
@touch $(MXENV_TARGET)
.PHONY: mxenv
mxenv: $(MXENV_TARGET)
.PHONY: mxenv-dirty
mxenv-dirty:
@rm -f $(MXENV_TARGET)
.PHONY: mxenv-clean
mxenv-clean: mxenv-dirty
ifeq ("$(VENV_ENABLED)", "true")
ifeq ("$(VENV_CREATE)", "true")
@rm -rf $(VENV_FOLDER)
endif
else
@$(PYTHON_PACKAGE_COMMAND) uninstall -y $(MXDEV)
@$(PYTHON_PACKAGE_COMMAND) uninstall -y $(MXMAKE)
endif
INSTALL_TARGETS+=mxenv
DIRTY_TARGETS+=mxenv-dirty
CLEAN_TARGETS+=mxenv-clean
##############################################################################
# ruff
##############################################################################
RUFF_TARGET:=$(SENTINEL_FOLDER)/ruff.sentinel
$(RUFF_TARGET): $(MXENV_TARGET)
@echo "Install Ruff"
@$(PYTHON_PACKAGE_COMMAND) install ruff
@touch $(RUFF_TARGET)
.PHONY: ruff-check
ruff-check: $(RUFF_TARGET)
@echo "Run ruff check"
@ruff check $(RUFF_SRC)
.PHONY: ruff-format
ruff-format: $(RUFF_TARGET)
@echo "Run ruff format"
@ruff format $(RUFF_SRC)
.PHONY: ruff-dirty
ruff-dirty:
@rm -f $(RUFF_TARGET)
.PHONY: ruff-clean
ruff-clean: ruff-dirty
@test -e $(MXENV_PYTHON) && $(MXENV_PYTHON) -m pip uninstall -y ruff || :
@rm -rf .ruff_cache
INSTALL_TARGETS+=$(RUFF_TARGET)
CHECK_TARGETS+=ruff-check
FORMAT_TARGETS+=ruff-format
DIRTY_TARGETS+=ruff-dirty
CLEAN_TARGETS+=ruff-clean
##############################################################################
# isort
##############################################################################
ISORT_TARGET:=$(SENTINEL_FOLDER)/isort.sentinel
$(ISORT_TARGET): $(MXENV_TARGET)
@echo "Install isort"
@$(PYTHON_PACKAGE_COMMAND) install isort
@touch $(ISORT_TARGET)
.PHONY: isort-check
isort-check: $(ISORT_TARGET)
@echo "Run isort check"
@isort --check $(ISORT_SRC)
.PHONY: isort-format
isort-format: $(ISORT_TARGET)
@echo "Run isort format"
@isort $(ISORT_SRC)
.PHONY: isort-dirty
isort-dirty:
@rm -f $(ISORT_TARGET)
.PHONY: isort-clean
isort-clean: isort-dirty
@test -e $(MXENV_PYTHON) && $(MXENV_PYTHON) -m pip uninstall -y isort || :
INSTALL_TARGETS+=$(ISORT_TARGET)
CHECK_TARGETS+=isort-check
FORMAT_TARGETS+=isort-format
DIRTY_TARGETS+=isort-dirty
CLEAN_TARGETS+=isort-clean
##############################################################################
# sphinx
##############################################################################
# additional targets required for building docs.
DOCS_TARGETS+=
SPHINX_BIN=sphinx-build
SPHINX_AUTOBUILD_BIN=sphinx-autobuild
DOCS_TARGET:=$(SENTINEL_FOLDER)/sphinx.sentinel
$(DOCS_TARGET): $(MXENV_TARGET)
@echo "Install Sphinx"
@$(PYTHON_PACKAGE_COMMAND) install -U sphinx sphinx-autobuild $(DOCS_REQUIREMENTS)
@touch $(DOCS_TARGET)
.PHONY: docs
docs: $(DOCS_TARGET) $(DOCS_TARGETS)
@echo "Build sphinx docs"
@$(SPHINX_BIN) $(DOCS_SOURCE_FOLDER) $(DOCS_TARGET_FOLDER)
.PHONY: docs-live
docs-live: $(DOCS_TARGET) $(DOCS_TARGETS)
@echo "Rebuild Sphinx documentation on changes, with live-reload in the browser"
@$(SPHINX_AUTOBUILD_BIN) $(DOCS_SOURCE_FOLDER) $(DOCS_TARGET_FOLDER)
.PHONY: docs-dirty
docs-dirty:
@rm -f $(DOCS_TARGET)
.PHONY: docs-clean
docs-clean: docs-dirty
@test -e $(MXENV_PYTHON) && $(MXENV_PYTHON) -m pip uninstall -y \
sphinx sphinx-autobuild $(DOCS_REQUIREMENTS) || :
@rm -rf $(DOCS_TARGET_FOLDER)
INSTALL_TARGETS+=$(DOCS_TARGET)
DIRTY_TARGETS+=docs-dirty
CLEAN_TARGETS+=docs-clean
##############################################################################
# mxfiles
##############################################################################
# case `core.sources` domain not included
SOURCES_TARGET?=
# File generation target
MXMAKE_FILES?=$(MXMAKE_FOLDER)/files
# set environment variables for mxmake
define set_mxfiles_env
@export MXMAKE_FILES=$(1)
endef
# unset environment variables for mxmake
define unset_mxfiles_env
@unset MXMAKE_FILES
endef
$(PROJECT_CONFIG):
ifneq ("$(wildcard $(PROJECT_CONFIG))","")
@touch $(PROJECT_CONFIG)
else
@echo "[settings]" > $(PROJECT_CONFIG)
endif
LOCAL_PACKAGE_FILES:=$(wildcard pyproject.toml setup.cfg setup.py requirements.txt constraints.txt)
FILES_TARGET:=requirements-mxdev.txt
$(FILES_TARGET): $(PROJECT_CONFIG) $(MXENV_TARGET) $(SOURCES_TARGET) $(LOCAL_PACKAGE_FILES)
@echo "Create project files"
@mkdir -p $(MXMAKE_FILES)
$(call set_mxfiles_env,$(MXMAKE_FILES))
@mxdev -n -c $(PROJECT_CONFIG)
$(call unset_mxfiles_env)
@test -e $(MXMAKE_FILES)/pip.conf && cp $(MXMAKE_FILES)/pip.conf $(VENV_FOLDER)/pip.conf || :
@touch $(FILES_TARGET)
.PHONY: mxfiles
mxfiles: $(FILES_TARGET)
.PHONY: mxfiles-dirty
mxfiles-dirty:
@touch $(PROJECT_CONFIG)
.PHONY: mxfiles-clean
mxfiles-clean: mxfiles-dirty
@rm -rf constraints-mxdev.txt requirements-mxdev.txt $(MXMAKE_FILES)
INSTALL_TARGETS+=mxfiles
DIRTY_TARGETS+=mxfiles-dirty
CLEAN_TARGETS+=mxfiles-clean
##############################################################################
# packages
##############################################################################
# additional sources targets which requires package re-install on change
-include $(MXMAKE_FILES)/additional_sources_targets.mk
ADDITIONAL_SOURCES_TARGETS?=
INSTALLED_PACKAGES=$(MXMAKE_FILES)/installed.txt
ifeq ("$(PACKAGES_ALLOW_PRERELEASES)","true")
ifeq ("$(PYTHON_PACKAGE_INSTALLER)","uv")
PACKAGES_PRERELEASES=--prerelease=allow
else
PACKAGES_PRERELEASES=--pre
endif
else
PACKAGES_PRERELEASES=
endif
PACKAGES_TARGET:=$(INSTALLED_PACKAGES)
$(PACKAGES_TARGET): $(FILES_TARGET) $(ADDITIONAL_SOURCES_TARGETS)
@echo "Install python packages"
@$(PYTHON_PACKAGE_COMMAND) install $(PACKAGES_PRERELEASES) -r $(FILES_TARGET)
@$(PYTHON_PACKAGE_COMMAND) freeze > $(INSTALLED_PACKAGES)
@touch $(PACKAGES_TARGET)
.PHONY: packages
packages: $(PACKAGES_TARGET)
.PHONY: packages-dirty
packages-dirty:
@rm -f $(PACKAGES_TARGET)
.PHONY: packages-clean
packages-clean:
@test -e $(FILES_TARGET) \
&& test -e $(MXENV_PYTHON) \
&& $(MXENV_PYTHON) -m pip uninstall -y -r $(FILES_TARGET) \
|| :
@rm -f $(PACKAGES_TARGET)
INSTALL_TARGETS+=packages
DIRTY_TARGETS+=packages-dirty
CLEAN_TARGETS+=packages-clean
##############################################################################
# test
##############################################################################
TEST_TARGET:=$(SENTINEL_FOLDER)/test.sentinel
$(TEST_TARGET): $(MXENV_TARGET)
@echo "Install $(TEST_REQUIREMENTS)"
@$(PYTHON_PACKAGE_COMMAND) install $(TEST_REQUIREMENTS)
@touch $(TEST_TARGET)
.PHONY: test
test: $(FILES_TARGET) $(SOURCES_TARGET) $(PACKAGES_TARGET) $(TEST_TARGET) $(TEST_DEPENDENCY_TARGETS)
@test -z "$(TEST_COMMAND)" && echo "No test command defined" && exit 1 || :
@echo "Run tests using $(TEST_COMMAND)"
@/usr/bin/env bash -c "$(TEST_COMMAND)"
.PHONY: test-dirty
test-dirty:
@rm -f $(TEST_TARGET)
.PHONY: test-clean
test-clean: test-dirty
@test -e $(MXENV_PYTHON) && $(MXENV_PYTHON) -m pip uninstall -y $(TEST_REQUIREMENTS) || :
@rm -rf .pytest_cache
INSTALL_TARGETS+=$(TEST_TARGET)
CLEAN_TARGETS+=test-clean
DIRTY_TARGETS+=test-dirty
##############################################################################
# coverage
##############################################################################
COVERAGE_TARGET:=$(SENTINEL_FOLDER)/coverage.sentinel
$(COVERAGE_TARGET): $(TEST_TARGET)
@echo "Install Coverage"
@$(PYTHON_PACKAGE_COMMAND) install -U coverage
@touch $(COVERAGE_TARGET)
.PHONY: coverage
coverage: $(FILES_TARGET) $(SOURCES_TARGET) $(PACKAGES_TARGET) $(COVERAGE_TARGET)
@test -z "$(COVERAGE_COMMAND)" && echo "No coverage command defined" && exit 1 || :
@echo "Run coverage using $(COVERAGE_COMMAND)"
@/usr/bin/env bash -c "$(COVERAGE_COMMAND)"
.PHONY: coverage-dirty
coverage-dirty:
@rm -f $(COVERAGE_TARGET)
.PHONY: coverage-clean
coverage-clean: coverage-dirty
@test -e $(MXENV_PYTHON) && $(MXENV_PYTHON) -m pip uninstall -y coverage || :
@rm -rf .coverage htmlcov
INSTALL_TARGETS+=$(COVERAGE_TARGET)
DIRTY_TARGETS+=coverage-dirty
CLEAN_TARGETS+=coverage-clean
##############################################################################
# mypy
##############################################################################
MYPY_TARGET:=$(SENTINEL_FOLDER)/mypy.sentinel
$(MYPY_TARGET): $(MXENV_TARGET)
@echo "Install mypy"
@$(PYTHON_PACKAGE_COMMAND) install mypy $(MYPY_REQUIREMENTS)
@touch $(MYPY_TARGET)
.PHONY: mypy
mypy: $(PACKAGES_TARGET) $(MYPY_TARGET)
@echo "Run mypy"
@mypy $(MYPY_SRC)
.PHONY: mypy-dirty
mypy-dirty:
@rm -f $(MYPY_TARGET)
.PHONY: mypy-clean
mypy-clean: mypy-dirty
@test -e $(MXENV_PYTHON) && $(MXENV_PYTHON) -m pip uninstall -y mypy || :
@rm -rf .mypy_cache
INSTALL_TARGETS+=$(MYPY_TARGET)
TYPECHECK_TARGETS+=mypy
CLEAN_TARGETS+=mypy-clean
DIRTY_TARGETS+=mypy-dirty
##############################################################################
# zest-releaser
##############################################################################
ZEST_RELEASER_TARGET:=$(SENTINEL_FOLDER)/zest-releaser.sentinel
$(ZEST_RELEASER_TARGET): $(MXENV_TARGET)
@echo "Install zest.releaser"
@$(PYTHON_PACKAGE_COMMAND) install zest.releaser
@touch $(ZEST_RELEASER_TARGET)
.PHONY: zest-releaser-prerelease
zest-releaser-prerelease: $(ZEST_RELEASER_TARGET)
@echo "Run prerelease"
@prerelease $(ZEST_RELEASER_PRERELEASE_OPTIONS)
.PHONY: zest-releaser-release
zest-releaser-release: $(ZEST_RELEASER_TARGET)
@echo "Run release"
@release $(ZEST_RELEASER_RELEASE_OPTIONS)
.PHONY: zest-releaser-postrelease
zest-releaser-postrelease: $(ZEST_RELEASER_TARGET)
@echo "Run postrelease"
@postrelease $(ZEST_RELEASER_POSTRELEASE_OPTIONS)
.PHONY: zest-releaser-fullrelease
zest-releaser-fullrelease: $(ZEST_RELEASER_TARGET)
@echo "Run fullrelease"
@fullrelease $(ZEST_RELEASER_FULLRELEASE_OPTIONS)
.PHONY: zest-releaser-dirty
zest-releaser-dirty:
@rm -f $(ZEST_RELEASER_TARGET)
.PHONY: zest-releaser-clean
zest-releaser-clean: zest-releaser-dirty
@test -e $(MXENV_PYTHON) && $(MXENV_PYTHON) -m pip uninstall -y zest.releaser || :
INSTALL_TARGETS+=$(ZEST_RELEASER_TARGET)
DIRTY_TARGETS+=zest-releaser-dirty
CLEAN_TARGETS+=zest-releaser-clean
-include $(INCLUDE_MAKEFILE)
##############################################################################
# Default targets
##############################################################################
INSTALL_TARGET:=$(SENTINEL_FOLDER)/install.sentinel
$(INSTALL_TARGET): $(INSTALL_TARGETS)
@touch $(INSTALL_TARGET)
.PHONY: install
install: $(INSTALL_TARGET)
@touch $(INSTALL_TARGET)
.PHONY: run
run: $(RUN_TARGET)
.PHONY: deploy
deploy: $(DEPLOY_TARGETS)
.PHONY: dirty
dirty: $(DIRTY_TARGETS)
@rm -f $(INSTALL_TARGET)
.PHONY: clean
clean: dirty $(CLEAN_TARGETS)
@rm -rf $(CLEAN_TARGETS) $(MXMAKE_FOLDER) $(CLEAN_FS)
.PHONY: purge
purge: clean $(PURGE_TARGETS)
.PHONY: runtime-clean
runtime-clean:
@echo "Remove runtime artifacts, like byte-code and caches."
@find . -name '*.py[c|o]' -delete
@find . -name '*~' -exec rm -f {} +
@find . -name '__pycache__' -exec rm -fr {} +
.PHONY: check
check: $(CHECK_TARGETS)
.PHONY: typecheck
typecheck: $(TYPECHECK_TARGETS)
.PHONY: format
format: $(FORMAT_TARGETS)