-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#:[pyupgrade] | ||
#:title = pyupgrade | ||
#:description = Automatically upgrade syntax for newer versions of the language. | ||
#:depends = core.mxenv | ||
#: | ||
#:[target.pyupgrade] | ||
#:description = Run pyupgrade. | ||
#: | ||
#:[setting.PYUPGRADE_SRC] | ||
#:description = Source folder to scan for XML and ZCML files. | ||
#:default = src | ||
#: | ||
#:[setting.PYUPGRADE_PARAMETERS] | ||
#:description = Additional parameters for pyupgrade, see https://github.com/asottile/pyupgrade for details. | ||
#:default = --py38-plus | ||
#: | ||
#:[target.pyupgrade-dirty] | ||
#:description = Marks pyupgrade dirty | ||
#: | ||
#:[target.pyupgrade-clean] | ||
#:description = Uninstall pyupgrade. | ||
|
||
############################################################################## | ||
# pyupgrade | ||
############################################################################## | ||
|
||
PYUPGRADE_PARAMETERS?= | ||
PYUPGRADE_TARGET:=$(SENTINEL_FOLDER)/pyupgrade.sentinel | ||
$(PYUPGRADE_TARGET): $(MXENV_TARGET) | ||
@echo "Install pyupgrade" | ||
@$(MXENV_PYTHON) -m pip install pyupgrade | ||
@touch $(PYUPGRADE_TARGET) | ||
|
||
.PHONY: pyupgrade-format | ||
pyupgrade-format: $(PYUPGRADE_TARGET) | ||
@echo "Run pyupgrade format in: $(PYUPGRADE_SRC)" | ||
@find $(PYUPGRADE_SRC) -name '*.py' -exec $(MXENV_PATH)pyupgrade $(PYUPGRADE_PARAMETERS) {} + | ||
|
||
.PHONY: pyupgrade-dirty | ||
pyupgrade-dirty: | ||
@rm -f $(PYUPGRADE_TARGET) | ||
|
||
.PHONY: pyupgrade-clean | ||
pyupgrade-clean: pyupgrade-dirty | ||
@test -e $(MXENV_PYTHON) && $(MXENV_PYTHON) -m pip uninstall -y pyupgrade || : | ||
|
||
INSTALL_TARGETS+=$(PYUPGRADE_TARGET) | ||
FORMAT_TARGETS+=pyupgrade-format | ||
DIRTY_TARGETS+=pyupgrade-dirty | ||
CLEAN_TARGETS+=pyupgrade-clean |