From 798bba2e729098936bc09dfa00ed0769376d1a77 Mon Sep 17 00:00:00 2001 From: Robert Bartel Date: Thu, 7 Sep 2023 14:08:15 -0400 Subject: [PATCH] Update py-deps for version clause matching. Updating with additional steps to (optionally) ensure that an explicit version clause, if provided on both sides, matches between .env and requirements.txt. --- docker/py-sources/py-deps.Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docker/py-sources/py-deps.Dockerfile b/docker/py-sources/py-deps.Dockerfile index 5382a3b8a..66278a75f 100644 --- a/docker/py-sources/py-deps.Dockerfile +++ b/docker/py-sources/py-deps.Dockerfile @@ -67,6 +67,7 @@ ARG SHAPELY_VERSION_CLAUSE ARG PANDAS_VERSION_CLAUSE ARG SKLEARN_VERSION_CLAUSE ARG OVERRIDE_PROJ_VERSION_CLAUSES +ARG MATCH_EXPLICIT_PROJ_VERSION_CLAUSES # Copy what we built so far in those other (hopefully cached) stages COPY --from=build_pandas_dep /DIST/ /DIST/ @@ -105,6 +106,11 @@ RUN for pair in numpy:${NUMPY_VERSION_CLAUSE} \ if [ -n "${ver:-}" ]; then \ if [ -n "${OVERRIDE_PROJ_VERSION_CLAUSES:-}" ]; then \ cat /dmod/requirements.txt | sed "s/^${pack}.*/${pack}${ver}/" > /dmod/req_up.txt ; \ + elif [ -n "${MATCH_EXPLICIT_PROJ_VERSION_CLAUSES:-}" ]; then \ + proj_ver=$(cat /dmod/requirements.txt | grep -e "^${pack}" | sed "s/${pack}//") ; \ + if [ "${ver}" != "${proj_ver}" ]; then \ + echo "Error: configured version ${ver} of package ${pack} does not match ${proj_ver} from project requirements" 2> ; \ + fi ; \ else \ cat /dmod/requirements.txt | sed "s/^${pack}$/${pack}${ver}/" > /dmod/req_up.txt ; \ fi ; \