From 7a9f7f957625f7fabc15476c50e8978f320af949 Mon Sep 17 00:00:00 2001 From: Greg Lucas Date: Thu, 24 Mar 2022 20:52:47 -0600 Subject: [PATCH] MNT: Remove convert_path from setup script This allows building with newer setuptools (61.0.0+) which have removed convert_path, which we don't actually need. Rely on find_packages instead. --- setup.py | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/setup.py b/setup.py index b12d5f26c..286f596a3 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,6 @@ sys.exit(error) -import fnmatch import os import shutil import subprocess @@ -32,7 +31,7 @@ from collections import defaultdict from sysconfig import get_config_var -from setuptools import Command, Extension, convert_path, setup +from setuptools import Extension, find_packages, setup """ Distribution definition for Cartopy. @@ -78,31 +77,6 @@ def file_walk_relative(top, remove=''): yield os.path.join(root, file).replace(remove, '') -def find_package_tree(root_path, root_package): - """ - Return the package and all its sub-packages. - - Automated package discovery - extracted/modified from Distutils Cookbook: - https://wiki.python.org/moin/Distutils/Cookbook/AutoPackageDiscovery - - """ - packages = [root_package] - # Accept a root_path with Linux path separators. - root_path = root_path.replace('/', os.path.sep) - root_count = len(root_path.split(os.path.sep)) - for (dir_path, dir_names, _) in os.walk(convert_path(root_path)): - # Prune dir_names *in-place* to prevent unwanted directory recursion - for dir_name in list(dir_names): - if not os.path.isfile(os.path.join(dir_path, dir_name, - '__init__.py')): - dir_names.remove(dir_name) - if dir_names: - prefix = dir_path.split(os.path.sep)[root_count:] - packages.extend(['.'.join([root_package] + prefix + [dir_name]) - for dir_name in dir_names]) - return packages - - # Dependency checks # ================= @@ -344,7 +318,7 @@ def decythonize(extensions, **_ignore): 'write_to': 'lib/cartopy/_version.py', }, - packages=find_package_tree('lib/cartopy', 'cartopy'), + packages=find_packages("lib"), package_dir={'': 'lib'}, package_data={'cartopy': list(file_walk_relative('lib/cartopy/tests/' 'mpl/baseline_images/',