Skip to content

Apache DataFusion SQL Query Engine

ARROW-12068: [Python] Stop using distutils

Antoine Pitrouaa9ec21cafd8
diff --git a/LICENSE.txt b/LICENSE.txt
index 1480c1401c..4cec07fd0c 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -2209,3 +2209,12 @@ The files in cpp/src/arrow/vendored/fast_float/ contain code from
https://github.com/lemire/fast_float
which is made available under the Apache License 2.0.
+
+--------------------------------------------------------------------------------
+
+The file python/pyarrow/vendored/version.py contains code from
+
+https://github.com/pypa/packaging/
+
+which is made available under both the Apache license v2.0 and the
+BSD 2-clause license.
diff --git a/dev/release/rat_exclude_files.txt b/dev/release/rat_exclude_files.txt
index 6eb4beedb7..c2e22abd39 100644
--- a/dev/release/rat_exclude_files.txt
+++ b/dev/release/rat_exclude_files.txt
@@ -136,6 +136,7 @@ python/MANIFEST.in
python/manylinux1/.dockerignore
python/pyarrow/includes/__init__.pxd
python/pyarrow/tests/__init__.py
+python/pyarrow/vendored/*
python/requirements*.txt
pax_global_header
MANIFEST.in
diff --git a/dev/tasks/conda-recipes/azure.clean.yml b/dev/tasks/conda-recipes/azure.clean.yml
index 32deccac0b..55ac36528a 100644
--- a/dev/tasks/conda-recipes/azure.clean.yml
+++ b/dev/tasks/conda-recipes/azure.clean.yml
@@ -13,7 +13,7 @@ jobs:
displayName: Clone arrow
- script: |
- conda install -y -c conda-forge pandas anaconda-client
+ conda install -y -c conda-forge pandas anaconda-client packaging
displayName: Install requirements
- script: |
diff --git a/dev/tasks/conda-recipes/clean.py b/dev/tasks/conda-recipes/clean.py
index 3e77f0e7ac..bd31c875dc 100644
--- a/dev/tasks/conda-recipes/clean.py
+++ b/dev/tasks/conda-recipes/clean.py
@@ -1,4 +1,3 @@
-from distutils.version import LooseVersion
from subprocess import check_output, check_call
from typing import List
@@ -7,6 +6,8 @@ import os
import pandas as pd
import sys
+from packaging.version import Version
+
VERSIONS_TO_KEEP = 5
PACKAGES = [
@@ -44,7 +45,7 @@ def packages_to_delete(package_name: str, platform: str) -> List[str]:
env=env,
)
pkgs = pd.DataFrame(json.loads(pkgs_json)[package_name])
- pkgs["version"] = pkgs["version"].map(LooseVersion)
+ pkgs["version"] = pkgs["version"].map(Version)
pkgs["py_version"] = pkgs["build"].str.slice(0, 4)
to_delete = []