Skip to content

Commit

Permalink
ARROW-12068: [Python] Stop using distutils
Browse files Browse the repository at this point in the history
According to PEP 632, distutils will be deprecated in Python 3.10 and removed in 3.12.

* switch to `setuptools` for general packaging
* use the `Version` class from the `packaging` project instead of `distutils.LooseVersion`

Closes #9849 from pitrou/ARROW-12068-remove-distutils

Authored-by: Antoine Pitrou <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
  • Loading branch information
pitrou committed Apr 1, 2021
1 parent 59bb69b commit aa9ec21
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
9 changes: 9 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
1 change: 1 addition & 0 deletions dev/release/rat_exclude_files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dev/tasks/conda-recipes/azure.clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
5 changes: 3 additions & 2 deletions dev/tasks/conda-recipes/clean.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from distutils.version import LooseVersion
from subprocess import check_output, check_call
from typing import List

Expand All @@ -7,6 +6,8 @@
import pandas as pd
import sys

from packaging.version import Version


VERSIONS_TO_KEEP = 5
PACKAGES = [
Expand Down Expand Up @@ -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 = []
Expand Down

0 comments on commit aa9ec21

Please sign in to comment.