Skip to content

Commit

Permalink
Remove direct usage of distutils from setup.py (#418)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisvandenbossche committed Jun 10, 2024
1 parent 16bf4c2 commit ef71cee
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 9 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import logging
import os
from pathlib import Path
import platform
import shutil
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
Expand All @@ -18,6 +17,9 @@
cythonize = None


logger = logging.getLogger(__name__)


MIN_PYTHON_VERSION = (3, 8, 0)
MIN_GDAL_VERSION = (2, 4, 0)

Expand Down Expand Up @@ -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."
)
Expand Down Expand Up @@ -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."
)
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand Down

0 comments on commit ef71cee

Please sign in to comment.