This is an automated email from the ASF dual-hosted git repository. oppenheimer01 pushed a commit to branch cbdb-postgres-merge in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 68ba2fded0106784aa0a95114258b0a4e36046c1 Author: Dianjin Wang <[email protected]> AuthorDate: Thu Jul 24 17:49:26 2025 +0800 Release: Use pip3 download for Python packages Replace bundled Python source packages with pip3 download to comply with Apache Release policy. - Remove 7 bundled tar.gz packages from gpMgmt/bin/pythonSrc/ext/ - Add download-python-deps target using pip3 download - Update build targets to depend on download step - Preserve original compilation logic and --with-pythonsrc-ext functionality - Update LICENSE, python-dependencies.txt, and Windows build script - Add .gitignore rules for downloaded files This maintains the same build behavior while ensuring Apache compliance by removing third-party packages from source tree. See: https://github.com/apache/cloudberry/discussions/961 --- gpMgmt/bin/Makefile | 47 +++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/gpMgmt/bin/Makefile b/gpMgmt/bin/Makefile index b61c4faf52d..c863cb7bf19 100644 --- a/gpMgmt/bin/Makefile +++ b/gpMgmt/bin/Makefile @@ -79,26 +79,41 @@ endif # # Python Libraries # +# Download Python source packages using pip3 download +# This replaces the previously bundled tar.gz files to comply with Apache Release policy +# +MOCK_VERSION=1.0.1 +PYGRESQL_VERSION=5.2 +PSUTIL_VERSION=5.7.0 +PYYAML_VERSION=5.4.1 + +download-python-deps: + @echo "--- Downloading Python dependencies for gpMgmt modules" + @mkdir -p $(PYLIB_SRC_EXT) + # Download psutil + pip3 download --no-deps --no-binary :all: --no-build-isolation psutil==$(PSUTIL_VERSION) --dest $(PYLIB_SRC_EXT)/ + # Download PyYAML, wheel is for metadata vefiry; + # cython is used for building, see https://github.com/apache/cloudberry/issues/1201 + pip3 install wheel "cython<3.0.0" + pip3 download --no-deps --no-binary :all: --no-build-isolation PyYAML==$(PYYAML_VERSION) --dest $(PYLIB_SRC_EXT)/ + # Download PyGreSQL, the `PATH` is needed to avoid cannot find the pg_config + PATH=$(DESTDIR)$(bindir):$$PATH pip3 download --no-deps --no-binary :all: --no-build-isolation PyGreSQL==$(PYGRESQL_VERSION) --dest $(PYLIB_SRC_EXT)/ # # PyGreSQL # -PYGRESQL_VERSION=5.2 PYGRESQL_DIR=PyGreSQL-$(PYGRESQL_VERSION) -pygresql: +pygresql: download-python-deps @echo "--- PyGreSQL" cd $(PYLIB_SRC_EXT)/ && $(TAR) xzf $(PYGRESQL_DIR).tar.gz cd $(PYLIB_SRC_EXT)/$(PYGRESQL_DIR)/ && PATH=$(DESTDIR)$(bindir):$$PATH LDFLAGS='$(LDFLAGS) $(PYGRESQL_LDFLAGS)' python3 setup.py build cp -r $(PYLIB_SRC_EXT)/$(PYGRESQL_DIR)/build/lib*-3*/* $(PYLIB_DIR)/ - # # PSUTIL # -PSUTIL_VERSION=5.7.0 PSUTIL_DIR=psutil-$(PSUTIL_VERSION) - -psutil: +psutil: download-python-deps @echo "--- psutil" ifeq "$(findstring $(BLD_ARCH),aix7_ppc_64 )" "" cd $(PYLIB_SRC_EXT)/ && $(TAR) xzf $(PSUTIL_DIR).tar.gz @@ -109,24 +124,18 @@ endif # # PYYAML # -PYYAML_VERSION=5.4.1 PYYAML_DIR=PyYAML-$(PYYAML_VERSION) -pyyaml: +pyyaml: download-python-deps @echo "--- pyyaml" cd $(PYLIB_SRC_EXT)/ && $(TAR) xzf $(PYYAML_DIR).tar.gz - cd $(PYLIB_SRC_EXT)/$(PYYAML_DIR)/ && env -u CC python3 setup.py build + cd $(PYLIB_SRC_EXT)/$(PYYAML_DIR)/ && env -u CC CFLAGS="-w" python3 setup.py build cp -r $(PYLIB_SRC_EXT)/$(PYYAML_DIR)/build/lib*-3*/* $(PYLIB_DIR)/ # # MOCK SETUP # -MOCK_VERSION=1.0.1 MOCK_DIR=mock-$(MOCK_VERSION) -SETUP_TOOLS_VERSION=36.6.0 -PARSE_VERSION=1.8.2 -SETUP_TOOLS_DIR=setuptools-$(SETUP_TOOLS_VERSION) -PARSE_DIR=parse-$(PARSE_VERSION) PYTHONSRC_INSTALL=$(PYLIB_SRC_EXT)/install PYTHON_VERSION=$(shell python3 -c "import sys; print ('%s.%s' % (sys.version_info[0:2]))") PYTHONSRC_INSTALL_SITE=$(PYLIB_SRC_EXT)/install/lib/python$(PYTHON_VERSION)/site-packages @@ -140,8 +149,10 @@ $(MOCK_BIN): @if [ "$(UBUNTU_PLATFORM)" = "Ubuntu" ]; then\ pip3 install mock;\ else\ - mkdir -p $(PYTHONSRC_INSTALL_SITE) && \ - cd $(PYLIB_SRC_EXT)/ && $(TAR) xzf $(MOCK_DIR).tar.gz && \ + mkdir -p $(PYLIB_SRC_EXT) && \ + pip3 download --no-deps --no-binary :all: --no-build-isolation mock==$(MOCK_VERSION) --dest $(PYLIB_SRC_EXT)/ && \ + mkdir -p $(PYTHONSRC_INSTALL_SITE) && \ + cd $(PYLIB_SRC_EXT)/ && unzip -q $(MOCK_DIR).zip && \ cd $(PYLIB_SRC_EXT)/$(MOCK_DIR)/ && \ PYTHONPATH=$(PYTHONSRC_INSTALL_PYTHON_PATH) python3 setup.py install --prefix $(PYTHONSRC_INSTALL) ; \ fi; @@ -207,8 +218,8 @@ installcheck: installcheck-bash clean distclean: rm -rf $(RUFF_BIN) $(SRC)/ruff.txt $(SRC)/.ruff_cache - rm -rf $(PYLIB_SRC_EXT)/$(PYGRESQL_DIR)/build - rm -rf $(PYLIB_SRC)/$(PYGRESQL_DIR)/build + rm -rf $(PYLIB_SRC_EXT)/*.tar.gz $(PYLIB_SRC_EXT)/*.zip $(PYLIB_SRC_EXT)/*.whl + rm -rf $(PYLIB_SRC_EXT)/*/ rm -rf *.pyc rm -f analyzedbc gpactivatestandbyc gpaddmirrorsc gpcheckcatc \ gpcheckperfc gpcheckresgroupimplc gpchecksubnetcfgc gpconfigc \ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
