Skip to content

Commit 38a7d2d

Browse files
committed
gpMgmt: skip downloading existing Python dependency tarballs
1 parent 65cd966 commit 38a7d2d

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

gpMgmt/bin/Makefile

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,27 @@ PYYAML_VERSION=5.4.1
9090
download-python-deps:
9191
@echo "--- Downloading Python dependencies for gpMgmt modules"
9292
@mkdir -p $(PYLIB_SRC_EXT)
93-
# Download psutil using curl
94-
curl -sSL https://files.pythonhosted.org/packages/source/p/psutil/psutil-$(PSUTIL_VERSION).tar.gz -o $(PYLIB_SRC_EXT)/psutil-$(PSUTIL_VERSION).tar.gz
95-
# Download PyYAML using curl
96-
curl -sSL https://files.pythonhosted.org/packages/source/P/PyYAML/PyYAML-$(PYYAML_VERSION).tar.gz -o $(PYLIB_SRC_EXT)/PyYAML-$(PYYAML_VERSION).tar.gz
97-
# Download PyGreSQL using curl
98-
curl -sSL https://files.pythonhosted.org/packages/source/P/PyGreSQL/PyGreSQL-$(PYGRESQL_VERSION).tar.gz -o $(PYLIB_SRC_EXT)/PyGreSQL-$(PYGRESQL_VERSION).tar.gz
93+
# Download psutil using curl (only if not exists)
94+
@if [ ! -f $(PYLIB_SRC_EXT)/psutil-$(PSUTIL_VERSION).tar.gz ]; then \
95+
echo "Downloading psutil-$(PSUTIL_VERSION).tar.gz..."; \
96+
curl -sSL https://files.pythonhosted.org/packages/source/p/psutil/psutil-$(PSUTIL_VERSION).tar.gz -o $(PYLIB_SRC_EXT)/psutil-$(PSUTIL_VERSION).tar.gz; \
97+
else \
98+
echo "psutil-$(PSUTIL_VERSION).tar.gz already exists, skipping download"; \
99+
fi
100+
# Download PyYAML using curl (only if not exists)
101+
@if [ ! -f $(PYLIB_SRC_EXT)/PyYAML-$(PYYAML_VERSION).tar.gz ]; then \
102+
echo "Downloading PyYAML-$(PYYAML_VERSION).tar.gz..."; \
103+
curl -sSL https://files.pythonhosted.org/packages/source/P/PyYAML/PyYAML-$(PYYAML_VERSION).tar.gz -o $(PYLIB_SRC_EXT)/PyYAML-$(PYYAML_VERSION).tar.gz; \
104+
else \
105+
echo "PyYAML-$(PYYAML_VERSION).tar.gz already exists, skipping download"; \
106+
fi
107+
# Download PyGreSQL using curl (only if not exists)
108+
@if [ ! -f $(PYLIB_SRC_EXT)/PyGreSQL-$(PYGRESQL_VERSION).tar.gz ]; then \
109+
echo "Downloading PyGreSQL-$(PYGRESQL_VERSION).tar.gz..."; \
110+
curl -sSL https://files.pythonhosted.org/packages/source/P/PyGreSQL/PyGreSQL-$(PYGRESQL_VERSION).tar.gz -o $(PYLIB_SRC_EXT)/PyGreSQL-$(PYGRESQL_VERSION).tar.gz; \
111+
else \
112+
echo "PyGreSQL-$(PYGRESQL_VERSION).tar.gz already exists, skipping download"; \
113+
fi
99114
# Install wheel and cython for PyYAML building
100115
pip3 install --user wheel "cython<3.0.0"
101116

@@ -150,7 +165,12 @@ $(MOCK_BIN):
150165
pip3 install mock;\
151166
else\
152167
mkdir -p $(PYLIB_SRC_EXT) && \
153-
curl -sSL https://files.pythonhosted.org/packages/source/m/mock/mock-$(MOCK_VERSION).zip -o $(PYLIB_SRC_EXT)/mock-$(MOCK_VERSION).zip && \
168+
if [ ! -f $(PYLIB_SRC_EXT)/mock-$(MOCK_VERSION).zip ]; then \
169+
echo "Downloading mock-$(MOCK_VERSION).zip..."; \
170+
curl -sSL https://files.pythonhosted.org/packages/source/m/mock/mock-$(MOCK_VERSION).zip -o $(PYLIB_SRC_EXT)/mock-$(MOCK_VERSION).zip; \
171+
else \
172+
echo "mock-$(MOCK_VERSION).zip already exists, skipping download"; \
173+
fi && \
154174
mkdir -p $(PYTHONSRC_INSTALL_SITE) && \
155175
cd $(PYLIB_SRC_EXT)/ && unzip -q $(MOCK_DIR).zip && \
156176
cd $(PYLIB_SRC_EXT)/$(MOCK_DIR)/ && \

0 commit comments

Comments
 (0)