From ef71ceeea7d637848ce6e22e74b4fd17faffe238 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Mon, 10 Jun 2024 19:11:07 +0200 Subject: [PATCH] Remove direct usage of distutils from setup.py (#418) --- CHANGES.md | 4 ++++ setup.py | 16 +++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f006797e..d0967fdd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,10 @@ - MacOS wheels are now only available for macOS 12+. For older unsupported macOS versions, pyogrio can still be built from source (requires GDAL to be installed) (#417). +### Packaging + +- Remove usage of deprecated `distutils` in `setup.py` (#416). + ## 0.8.0 (2024-05-06) ### Improvements diff --git a/setup.py b/setup.py index 12b7de7a..2e2c6a17 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +import logging import os from pathlib import Path import platform @@ -5,9 +6,7 @@ import subprocess import sys -from distutils import log -from setuptools import setup, find_packages -from setuptools.extension import Extension +from setuptools import Extension, setup, find_packages import versioneer # import Cython if available @@ -18,6 +17,9 @@ cythonize = None +logger = logging.getLogger(__name__) + + MIN_PYTHON_VERSION = (3, 8, 0) MIN_GDAL_VERSION = (2, 4, 0) @@ -71,7 +73,7 @@ def get_gdal_config(): }, gdal_version_str if include_dir or library_dir or gdal_version_str: - log.warn( + logger.warning( "If specifying the GDAL_INCLUDE_PATH, GDAL_LIBRARY_PATH, or GDAL_VERSION " "environment variables, you need to specify all of them." ) @@ -117,7 +119,7 @@ def get_gdal_config(): ) sys.exit(1) - log.info( + logger.info( "Building on Windows requires extra options to setup.py to locate " "GDAL files. See the installation documentation." ) @@ -174,7 +176,7 @@ def get_gdal_config(): if os.environ.get("PYOGRIO_PACKAGE_DATA"): gdal_data = os.environ.get("GDAL_DATA") if gdal_data and os.path.exists(gdal_data): - log.info(f"Copying gdal data from {gdal_data}") + logger.info(f"Copying gdal data from {gdal_data}") copy_data_tree(gdal_data, "pyogrio/gdal_data") else: raise Exception( @@ -184,7 +186,7 @@ def get_gdal_config(): proj_data = os.environ.get("PROJ_LIB") if proj_data and os.path.exists(proj_data): - log.info(f"Copying proj data from {proj_data}") + logger.info(f"Copying proj data from {proj_data}") copy_data_tree(proj_data, "pyogrio/proj_data") else: raise Exception(