Skip to content

Commit f1b1105

Browse files
committed
fix: Fix Makefile
1 parent 9de5def commit f1b1105

File tree

1 file changed

+16
-34
lines changed

1 file changed

+16
-34
lines changed

Makefile

Lines changed: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,72 +2,54 @@ PYTHON_VERSIONS = 3.9 3.10 3.11
22
PYTHON_VERSION ?= 3.10
33
IMAGE = testcontainers-python:${PYTHON_VERSION}
44
RUN = docker run --rm -it
5-
# Get all directories that contain a setup.py and get the directory name.
6-
PACKAGES = core $(addprefix modules/,$(notdir $(wildcard modules/*)))
5+
TEST_NAMES := $(notdir $(wildcard tests/*))
76

8-
# All */dist folders for each of the packages.
9-
DISTRIBUTIONS = $(addsuffix /dist,${PACKAGES})
10-
UPLOAD = $(addsuffix /upload,${PACKAGES})
11-
# All */tests folders for each of the test suites.
12-
TESTS = $(addsuffix /tests,$(filter-out meta,${PACKAGES}))
7+
TESTS := $(addprefix tests/,$(TEST_NAMES))
138
TESTS_DIND = $(addsuffix -dind,${TESTS})
14-
DOCTESTS = $(addsuffix /doctest,$(filter-out meta,${PACKAGES}))
15-
# All linting targets.
16-
LINT = $(addsuffix /lint,${PACKAGES})
179

18-
# Targets to build a distribution for each package.
19-
dist: ${DISTRIBUTIONS}
20-
${DISTRIBUTIONS} : %/dist : %/setup.py
21-
cd $* \
22-
&& python setup.py bdist_wheel \
23-
&& twine check dist/*
10+
dist:
11+
poetry build \
12+
&& poetry run twine check dist/*.tar.gz
2413

2514
# Targets to run the test suite for each package.
2615
tests : ${TESTS}
27-
${TESTS} : %/tests :
28-
poetry run pytest -v --cov=testcontainers.$* $*/tests
16+
${TESTS} : tests/% :
17+
poetry run pytest -v --cov=testcontainers.$* tests/$*
2918

3019
# Target to lint the code.
3120
lint:
3221
pre-commit run -a
3322

3423
# Targets to publish packages.
35-
upload : ${UPLOAD}
36-
${UPLOAD} : %/upload :
37-
if [ ${TWINE_REPOSITORY}-$* = testpypi-meta ]; then \
38-
echo "Cannot upload meta package to testpypi because of missing permissions."; \
39-
else \
40-
twine upload --non-interactive --skip-existing $*/dist/*; \
41-
fi
24+
upload :
25+
poetry run twine upload --non-interactive --skip-existing dist/*
4226

4327
# Targets to build docker images
4428
image:
29+
mkdir -p build/
4530
poetry export -f requirements.txt -o build/requirements.txt
4631
docker build --build-arg version=${PYTHON_VERSION} -t ${IMAGE} .
4732

4833
# Targets to run tests in docker containers
4934
tests-dind : ${TESTS_DIND}
5035

51-
${TESTS_DIND} : %/tests-dind : image
36+
${TESTS_DIND} : tests/%-dind : image
5237
${RUN} -v /var/run/docker.sock:/var/run/docker.sock ${IMAGE} \
53-
bash -c "make $*/lint $*/tests"
38+
bash -c "make lint tests/$*"
5439

5540
# Target to build the documentation
5641
docs :
5742
poetry run sphinx-build -nW . docs/_build
5843

59-
doctest : ${DOCTESTS}
44+
doctest :
6045
poetry run sphinx-build -b doctest . docs/_build
6146

62-
${DOCTESTS} : %/doctest :
63-
poetry run sphinx-build -b doctest -c doctests $* docs/_build
64-
6547
# Remove any generated files.
6648
clean :
6749
rm -rf docs/_build
68-
rm -rf */build
69-
rm -rf */dist
50+
rm -rf build
51+
rm -rf dist
7052
rm -rf */*.egg-info
7153

7254
# Targets that do not generate file-level artifacts.
73-
.PHONY : clean dists ${DISTRIBUTIONS} docs doctests image tests ${TESTS}
55+
.PHONY : clean dists docs doctests image tests ${TESTS}

0 commit comments

Comments
 (0)