From 4e8d236653a84d124fd9e673aa24554a908f9aec Mon Sep 17 00:00:00 2001 From: Danil Ovchinnikov Date: Mon, 20 Oct 2025 17:10:56 +0300 Subject: [PATCH 1/4] removed use of `six` package for `unicode.py` --- .github/workflows/macos.yml | 2 +- .../compiling-kphp-from-sources.md | 6 +++--- tests/python/requirements.txt | 1 - .../kphp-remove-six-package.patch.template | 19 +++++++++++++++++++ third-party/re2-cmake/patches/series | 1 + third-party/re2-cmake/re2.cmake | 1 - 6 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 third-party/re2-cmake/patches/kphp-remove-six-package.patch.template diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index e3840f802e..0cd21424ac 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -41,7 +41,7 @@ jobs: brew install python@3.13 re2c coreutils libiconv googletest shivammathur/php/php@7.4 brew link --overwrite --force shivammathur/php/php@7.4 brew link --overwrite --force python@3.13 - /opt/homebrew/opt/python@3.13/libexec/bin/python -m pip install --upgrade pip --user --break-system-packages && /opt/homebrew/opt/python@3.13/libexec/bin/pip install --break-system-packages jsonschema six cmake==3.31.6 + /opt/homebrew/opt/python@3.13/libexec/bin/python -m pip install --upgrade pip --user --break-system-packages && /opt/homebrew/opt/python@3.13/libexec/bin/pip install --break-system-packages jsonschema cmake==3.31.6 - name: Run cmake run: | diff --git a/docs/kphp-internals/developing-and-extending-kphp/compiling-kphp-from-sources.md b/docs/kphp-internals/developing-and-extending-kphp/compiling-kphp-from-sources.md index 7820455862..1fd927b57a 100644 --- a/docs/kphp-internals/developing-and-extending-kphp/compiling-kphp-from-sources.md +++ b/docs/kphp-internals/developing-and-extending-kphp/compiling-kphp-from-sources.md @@ -47,7 +47,7 @@ wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - Install packages ```bash apt-get update -apt install git cmake-data=3.18* cmake=3.18* make patch re2c g++ gperf python3-minimal python3-jsonschema python3-six \ +apt install git cmake-data=3.18* cmake=3.18* make patch re2c g++ gperf python3-minimal python3-jsonschema \ libfmt-dev libgtest-dev libgmock-dev \ zlib1g-dev php7.4-dev libldap-dev libkrb5-dev \ libpq5=14.* postgresql-14 postgresql-server-dev-14 libpq-dev=14.* composer @@ -71,7 +71,7 @@ Install packages ```bash apt-get update apt install git cmake make g++ gperf netcat patch re2c \ - python3.7 python3-pip python3.7-distutils python3.7-dev libpython3.7-dev python3-jsonschema python3-setuptools python3-six \ + python3.7 python3-pip python3.7-distutils python3.7-dev libpython3.7-dev python3-jsonschema python3-setuptools \ libfmt-dev libgtest-dev libgmock-dev \ zlib1g-dev php7.4-dev libldap-dev libkrb5-dev mysql-server libmysqlclient-dev \ libpq5=14.* postgresql-14 postgresql-server-dev-14 libpq-dev=14.* composer @@ -86,7 +86,7 @@ brew tap shivammathur/php brew update brew install python@3.13 re2c cmake coreutils libiconv googletest shivammathur/php/php@7.4 brew link --overwrite shivammathur/php/php@7.4 -python3.13 -m pip install jsonschema six +python3.13 -m pip install jsonschema # Build kphp git clone https://github.com/VKCOM/kphp.git && cd kphp diff --git a/tests/python/requirements.txt b/tests/python/requirements.txt index 78fcf4b961..c9b35840c8 100644 --- a/tests/python/requirements.txt +++ b/tests/python/requirements.txt @@ -11,4 +11,3 @@ pytest-postgresql==4.1.1 psycopg==3.1.9 pytest-xdist==3.3.1 zstandard==0.21.0 -six==1.17.0 diff --git a/third-party/re2-cmake/patches/kphp-remove-six-package.patch.template b/third-party/re2-cmake/patches/kphp-remove-six-package.patch.template new file mode 100644 index 0000000000..8f8319cdea --- /dev/null +++ b/third-party/re2-cmake/patches/kphp-remove-six-package.patch.template @@ -0,0 +1,19 @@ +Should use Python's native function instead of the six package for unicode.py + +--- + re2/unicode.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/re2/unicode.py b/re2/unicode.py +index 727bea5f..e3293839 100644 +--- a/re2/unicode.py ++++ b/re2/unicode.py +@@ -10,7 +10,7 @@ + + import os + import re +-from six.moves import urllib ++import urllib.request + + # Directory or URL where Unicode tables reside. + _UNICODE_DIR = "${UNICODE_AUTO_RAW_DATA_DIR}" \ No newline at end of file diff --git a/third-party/re2-cmake/patches/series b/third-party/re2-cmake/patches/series index 5559b33018..0929a1ed68 100644 --- a/third-party/re2-cmake/patches/series +++ b/third-party/re2-cmake/patches/series @@ -1 +1,2 @@ kphp-unicode-data.patch +kphp-remove-six-package.patch \ No newline at end of file diff --git a/third-party/re2-cmake/re2.cmake b/third-party/re2-cmake/re2.cmake index 446c77fe25..b5eb3ffdc7 100644 --- a/third-party/re2-cmake/re2.cmake +++ b/third-party/re2-cmake/re2.cmake @@ -1,4 +1,3 @@ -check_python_package(six) update_git_submodule(${THIRD_PARTY_DIR}/re2 "--recursive") get_submodule_version(${THIRD_PARTY_DIR}/re2 RE2_VERSION) get_submodule_remote_url(third-party/re2 RE2_SOURCE_URL) From 0ee4012311a7ef99e6abc1d4320e53798fdcd6f0 Mon Sep 17 00:00:00 2001 From: Danil Ovchinnikov Date: Mon, 20 Oct 2025 22:00:48 +0300 Subject: [PATCH 2/4] temporarily returned the package --- tests/python/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/python/requirements.txt b/tests/python/requirements.txt index c9b35840c8..78fcf4b961 100644 --- a/tests/python/requirements.txt +++ b/tests/python/requirements.txt @@ -11,3 +11,4 @@ pytest-postgresql==4.1.1 psycopg==3.1.9 pytest-xdist==3.3.1 zstandard==0.21.0 +six==1.17.0 From 35cf3799bac7f746c51e2b12ca74fb580cbe5b0a Mon Sep 17 00:00:00 2001 From: Danil Ovchinnikov Date: Mon, 20 Oct 2025 22:09:15 +0300 Subject: [PATCH 3/4] update patch --- .../kphp-remove-six-package.patch.template | 25 ++++++++++++------- third-party/re2-cmake/patches/series | 2 +- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/third-party/re2-cmake/patches/kphp-remove-six-package.patch.template b/third-party/re2-cmake/patches/kphp-remove-six-package.patch.template index 8f8319cdea..4a99cdb12f 100644 --- a/third-party/re2-cmake/patches/kphp-remove-six-package.patch.template +++ b/third-party/re2-cmake/patches/kphp-remove-six-package.patch.template @@ -1,19 +1,26 @@ Should use Python's native function instead of the six package for unicode.py --- - re2/unicode.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - diff --git a/re2/unicode.py b/re2/unicode.py -index 727bea5f..e3293839 100644 +index e0f33ef..651b7cc 100644 --- a/re2/unicode.py +++ b/re2/unicode.py -@@ -10,7 +10,7 @@ - +@@ -10,7 +10,6 @@ + import os import re -from six.moves import urllib -+import urllib.request - + # Directory or URL where Unicode tables reside. - _UNICODE_DIR = "${UNICODE_AUTO_RAW_DATA_DIR}" \ No newline at end of file + _UNICODE_DIR = "${UNICODE_AUTO_RAW_DATA_DIR}" +@@ -152,10 +151,7 @@ + raise InputError("invalid number of fields %d" % (nfields,)) + + if type(filename) == str: +- if filename.startswith("https://"): +- fil = urllib.request.urlopen(filename) +- else: +- fil = open(filename, "rb") ++ fil = open(filename, "rb") + else: + fil = filename diff --git a/third-party/re2-cmake/patches/series b/third-party/re2-cmake/patches/series index 0929a1ed68..5657a861ba 100644 --- a/third-party/re2-cmake/patches/series +++ b/third-party/re2-cmake/patches/series @@ -1,2 +1,2 @@ kphp-unicode-data.patch -kphp-remove-six-package.patch \ No newline at end of file +kphp-remove-six-package.patch From ecefb17b945ac50690c7209db8f15e41774f15cc Mon Sep 17 00:00:00 2001 From: Danil Ovchinnikov Date: Tue, 21 Oct 2025 15:50:04 +0300 Subject: [PATCH 4/4] remove `six` --- .github/workflows/debian.yml | 1 + .github/workflows/ubuntu.yml | 1 + tests/python/requirements.txt | 1 - 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/debian.yml b/.github/workflows/debian.yml index a3f06736b8..da3bf667ac 100644 --- a/.github/workflows/debian.yml +++ b/.github/workflows/debian.yml @@ -15,6 +15,7 @@ jobs: build-linux: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: include: - os: buster diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index cb05278a43..0c0776dd77 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -15,6 +15,7 @@ jobs: build-linux: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: include: - os: focal diff --git a/tests/python/requirements.txt b/tests/python/requirements.txt index 78fcf4b961..c9b35840c8 100644 --- a/tests/python/requirements.txt +++ b/tests/python/requirements.txt @@ -11,4 +11,3 @@ pytest-postgresql==4.1.1 psycopg==3.1.9 pytest-xdist==3.3.1 zstandard==0.21.0 -six==1.17.0