Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT: Remove convert_path from setup script #2027

Merged
merged 1 commit into from
Mar 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 2 additions & 28 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@
sys.exit(error)


import fnmatch
import os
import shutil
import subprocess
import warnings
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
QuLogic marked this conversation as resolved.
Show resolved Hide resolved

"""
Distribution definition for Cartopy.
Expand Down Expand Up @@ -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
# =================

Expand Down Expand Up @@ -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/',
Expand Down