Skip to content

Commit 797e6b7

Browse files
committed
Update the makefile recipe where updates the locks files accordingly
1 parent d44070b commit 797e6b7

File tree

1 file changed

+18
-65
lines changed

1 file changed

+18
-65
lines changed

Makefile

Lines changed: 18 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ 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+
ROOT_DIR := $(shell pwd)
29+
# INDEX_MODES=public-index(default) or aipcc-index this used for the lock
30+
INDEX_MODE ?= public-index
2831

2932
# OS dependant: Generate date, select appropriate cmd to locate container engine
3033
ifdef OS
@@ -113,7 +116,7 @@ endef
113116
####################################### Build helpers #######################################
114117

115118
# 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
119+
skip-init-for := all-images deploy% undeploy% test% validate% refresh-lock-files scan-image-vulnerabilities print-release
117120
ifneq (,$(filter-out $(skip-init-for),$(MAKECMDGOALS) $(.DEFAULT_GOAL)))
118121
$(SELF): bin/buildinputs
119122
endif
@@ -406,70 +409,20 @@ validate-rstudio-image: bin/kubectl
406409
continue
407410
fi
408411

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
412+
# ======================================================================================
413+
# Refresh lock files
414+
# Usage examples:
415+
# gmake refresh-lock-files
416+
# gmake refresh-lock-files INDEX_MODE=aipcc-index
417+
# gmake refresh-lock-files INDEX_MODE=aipcc-index DIR=jupyter/minimal/ubi9-python-3.12
418+
# ======================================================================================
419+
DIR ?=
420+
.PHONY: refresh-lock-files
421+
refresh-lock-files:
422+
@echo "==================================================================="
423+
@echo "🔁 Refreshing pylock.toml files using $(INDEX_MODE)"
424+
@echo "==================================================================="
425+
@cd $(ROOT_DIR) && bash scripts/pylocks_generator.sh $(INDEX_MODE) $(DIR)
473426

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

0 commit comments

Comments
 (0)