Skip to content

Commit 7d3732a

Browse files
committed
Update the makefile recipe where updates the locks files accordingly
1 parent d44070b commit 7d3732a

File tree

2 files changed

+25
-68
lines changed

2 files changed

+25
-68
lines changed

Makefile

Lines changed: 17 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ RELEASE_PYTHON_VERSION ?= 3.12
2525
CONTAINER_BUILD_CACHE_ARGS ?= --no-cache
2626
# whether to push the images to a registry as they are built
2727
PUSH_IMAGES ?= yes
28+
# INDEX_MODES=public-index(default) or aipcc-index this used for the lock
29+
INDEX_MODE ?= public-index
2830

2931
# OS dependant: Generate date, select appropriate cmd to locate container engine
3032
ifdef OS
@@ -113,7 +115,7 @@ endef
113115
####################################### Build helpers #######################################
114116

115117
# https://stackoverflow.com/questions/78899903/how-to-create-a-make-target-which-is-an-implicit-dependency-for-all-other-target
116-
skip-init-for := all-images deploy% undeploy% test% validate% refresh-pipfilelock-files scan-image-vulnerabilities print-release
118+
skip-init-for := all-images deploy% undeploy% test% validate% refresh-lock-files scan-image-vulnerabilities print-release
117119
ifneq (,$(filter-out $(skip-init-for),$(MAKECMDGOALS) $(.DEFAULT_GOAL)))
118120
$(SELF): bin/buildinputs
119121
endif
@@ -406,70 +408,20 @@ validate-rstudio-image: bin/kubectl
406408
continue
407409
fi
408410

409-
# This recipe used mainly from the Pipfile.locks Renewal Action
410-
# Default Python version
411-
PYTHON_VERSION ?= 3.12
412-
ROOT_DIR := $(shell pwd)
413-
ifeq ($(PYTHON_VERSION), 3.12)
414-
BASE_DIRS := \
415-
jupyter/minimal/ubi9-python-$(PYTHON_VERSION) \
416-
jupyter/datascience/ubi9-python-$(PYTHON_VERSION) \
417-
jupyter/pytorch/ubi9-python-$(PYTHON_VERSION) \
418-
jupyter/tensorflow/ubi9-python-$(PYTHON_VERSION) \
419-
jupyter/trustyai/ubi9-python-$(PYTHON_VERSION) \
420-
jupyter/rocm/pytorch/ubi9-python-$(PYTHON_VERSION) \
421-
jupyter/pytorch+llmcompressor/ubi9-python-$(PYTHON_VERSION) \
422-
codeserver/ubi9-python-$(PYTHON_VERSION) \
423-
runtimes/minimal/ubi9-python-$(PYTHON_VERSION) \
424-
runtimes/datascience/ubi9-python-$(PYTHON_VERSION) \
425-
runtimes/pytorch/ubi9-python-$(PYTHON_VERSION) \
426-
runtimes/tensorflow/ubi9-python-$(PYTHON_VERSION) \
427-
runtimes/rocm-pytorch/ubi9-python-$(PYTHON_VERSION) \
428-
runtimes/pytorch+llmcompressor/ubi9-python-$(PYTHON_VERSION) \
429-
runtimes/rocm-tensorflow/ubi9-python-$(PYTHON_VERSION) \
430-
jupyter/rocm/tensorflow/ubi9-python-$(PYTHON_VERSION) \
431-
rstudio/rhel9-python-$(PYTHON_VERSION) \
432-
rstudio/c9s-python-$(PYTHON_VERSION)
433-
else
434-
$(error Invalid Python version $(PYTHON_VERSION))
435-
endif
436-
437-
# Default value is false, can be overridden
438-
# The below directories are not supported on tier-1
439-
INCLUDE_OPT_DIRS ?= false
440-
OPT_DIRS :=
441-
442-
# This recipe gets args, can be used like
443-
# make refresh-pipfilelock-files PYTHON_VERSION=3.11 INCLUDE_OPT_DIRS=false
444-
.PHONY: refresh-pipfilelock-files
445-
refresh-pipfilelock-files:
446-
@echo "Updating Pipfile.lock files for Python $(PYTHON_VERSION)"
447-
@if [ "$(INCLUDE_OPT_DIRS)" = "true" ]; then
448-
echo "Including optional directories"
449-
DIRS="$(BASE_DIRS) $(OPT_DIRS)"
450-
else
451-
DIRS="$(BASE_DIRS)"
452-
fi
453-
for dir in $$DIRS; do
454-
echo "Processing directory: $$dir"
455-
cd $(ROOT_DIR)
456-
if [ -d "$$dir" ]; then
457-
echo "Updating $(PYTHON_VERSION) uv.lock in $$dir"
458-
cd $$dir
459-
if [ -f "pyproject.toml" ]; then
460-
uv lock && rm uv.lock
461-
else
462-
echo "No pyproject.toml found in $$dir, skipping."
463-
fi
464-
else
465-
echo "Skipping $$dir as it does not exist"
466-
fi
467-
done
468-
469-
echo "Regenerating requirements.txt files"
470-
pushd $(ROOT_DIR)
471-
bash $(ROOT_DIR)/scripts/sync-python-lockfiles.sh
472-
popd
411+
# ======================================================================================
412+
# Refresh lock files
413+
# Usage examples:
414+
# gmake refresh-lock-files
415+
# gmake refresh-lock-files INDEX_MODE=aipcc-index
416+
# gmake refresh-lock-files INDEX_MODE=aipcc-index DIR=jupyter/minimal/ubi9-python-3.12
417+
# ======================================================================================
418+
DIR ?=
419+
.PHONY: refresh-lock-files
420+
refresh-lock-files:
421+
@echo "==================================================================="
422+
@echo "🔁 Refreshing pylock.toml files using $(INDEX_MODE)"
423+
@echo "==================================================================="
424+
@cd $(ROOT_DIR) && bash scripts/pylocks_generator.sh $(INDEX_MODE) $(DIR)
473425

474426
# This is only for the workflow action
475427
# For running manually, set the required environment variables

scripts/pylocks_generator.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ warn() { echo -e "⚠️ \033[1;33m$1\033[0m"; }
5353
error() { echo -e "❌ \033[1;31m$1\033[0m"; }
5454
ok() { echo -e "✅ \033[1;32m$1\033[0m"; }
5555

56+
uppercase() {
57+
echo "$1" | tr '[:lower:]' '[:upper:]'
58+
}
59+
5660
# ----------------------------
5761
# PRE-FLIGHT CHECK
5862
# ----------------------------
@@ -169,8 +173,8 @@ for TARGET_DIR in "${TARGET_DIRS[@]}"; do
169173
else
170174
mkdir -p uv.lock
171175
output="uv.lock/pylock.${flavor}.toml"
172-
desc="${flavor^^} lock file"
173-
echo "➡️ Generating ${flavor^^} lock file..."
176+
desc="$(uppercase "$flavor") lock file"
177+
echo "➡️ Generating $(uppercase "$flavor") lock file..."
174178
fi
175179

176180
set +e
@@ -194,7 +198,7 @@ for TARGET_DIR in "${TARGET_DIRS[@]}"; do
194198
if [[ "$INDEX_MODE" == "public-index" ]]; then
195199
ok "pylock.toml generated successfully."
196200
else
197-
ok "${flavor^^} lock generated successfully."
201+
ok "$(uppercase "$flavor") lock generated successfully."
198202
fi
199203
fi
200204
}
@@ -240,4 +244,5 @@ if [ ${#FAILED_DIRS[@]} -gt 0 ]; then
240244
echo "$d"
241245
echo "Please comment out the missing package to continue and report the missing package to aipcc"
242246
done
247+
exit 1
243248
fi

0 commit comments

Comments
 (0)