forked from cloudtools/troposphere
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
87 lines (71 loc) · 2.63 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
.PHONY: spec test
PYDIRS=setup.py examples scripts tests troposphere
help: ## show this message
@IFS=$$'\n' ; \
help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/:/'`); \
printf "%-30s %s\n" "target" "help" ; \
printf "%-30s %s\n" "------" "----" ; \
for help_line in $${help_lines[@]}; do \
IFS=$$':' ; \
help_split=($$help_line) ; \
help_command=`echo $${help_split[0]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
help_info=`echo $${help_split[2]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
printf '\033[36m'; \
printf "%-30s %s" $$help_command ; \
printf '\033[0m'; \
printf "%s\n" $$help_info; \
done
regen: CloudFormationResourceSpecification.json ## regenerates troposphere code
./scripts/regen
fix: fix-black fix-isort ## run both fix-black and fix-isort
fix-black: ## automatically fix all black errors
@black ${PYDIRS}
fix-isort: ## automatically fix all isort errors
@isort ${PYDIRS}
clean:
rm -rf ${p39dir} troposphere.egg-info
lint: lint-flake8 lint-pyright ## run all linters
lint-black: ## run black
@echo "Running black... If this fails, run 'make fix-black' to resolve."
@black ${PYDIRS} --check --color --diff
@echo ""
lint-flake8: ## run flake8
@echo "Running flake8..."
@flake8 --version
@flake8 --config=setup.cfg --show-source ${PYDIRS}
@echo ""
lint-isort: ## run isort
@echo "Running isort... If this fails, run 'make fix-isort' to resolve."
@isort ${PYDIRS} --check-only
@echo ""
lint-pyright: ## run pyright
@echo "Running pyright..."
@npx pyright
@echo ""
release-test:
python -m build --sdist --wheel .
make release-test-39
p39dir=p39
release-test-39:
@echo "Python 3.9 test"
ver=`python -c 'import troposphere; print(troposphere.__version__)'` && \
rm -rf ${p39dir} && \
python3.9 -m venv ${p39dir} && \
. ${p39dir}/bin/activate && \
pip3.9 install dist/troposphere-$${ver}-py3-none-any.whl && \
python -c 'import troposphere; print(troposphere.__version__)' && \
deactivate && \
rm -rf ${p39dir}
spec:
curl -O https://d1uauaxba7bl26.cloudfront.net/latest/CloudFormationResourceSpecification.zip
rm -rf spec
mkdir spec
unzip -d spec CloudFormationResourceSpecification.zip
rm CloudFormationResourceSpecification.zip
curl -O --compressed https://d1uauaxba7bl26.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json
SPECVERSION=$$(jq -r .ResourceSpecificationVersion CloudFormationResourceSpecification.json) && \
/bin/echo "Downloaded version:" $${SPECVERSION} && \
mkdir -p .backup && \
ln -f CloudFormationResourceSpecification.json .backup/CloudFormationResourceSpecification_$${SPECVERSION}.json
test: ## run tests
@python setup.py test