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

remove deprecated distutil functionality #1165

Open
wants to merge 1 commit into
base: noetic-devel
Choose a base branch
from
Open
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
16 changes: 5 additions & 11 deletions cmake/interrogate_setup_dot_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,13 @@

setup_modules = []

try:
import distutils.core
setup_modules.append(distutils.core)
except ImportError:
pass

try:
import setuptools
setup_modules.append(setuptools)
except ImportError:
pass

assert setup_modules, 'Must have distutils or setuptools installed'
assert setup_modules, 'Must have setuptools installed'


def _get_locations(pkgs, package_dir):
Expand Down Expand Up @@ -101,7 +95,7 @@ def generate_cmake_file(package_name, version, scripts, package_dir, pkgs, modul
:param package_dir: {modulename: path}
:param pkgs: [list of str] python_packages declared in catkin package
:param modules: [list of str] python modules
:param setup_module: str, setuptools or distutils
:param setup_module: str, setuptools
"""
prefix = '%s_SETUP_PY' % package_name
result = []
Expand Down Expand Up @@ -165,13 +159,13 @@ def generate_cmake_file(package_name, version, scripts, package_dir, pkgs, modul

def _create_mock_setup_function(setup_module, package_name, outfile):
"""
Create a function to call instead of distutils.core.setup or setuptools.setup.
Create a function to call instead of setuptools.setup.

It just captures some args and writes them into a file that can be used from cmake.

:param package_name: name of the package
:param outfile: filename that cmake will use afterwards
:returns: a function to replace disutils.core.setup and setuptools.setup
:returns: a function to replace setuptools.setup
"""

def setup(*args, **kwargs):
Expand Down Expand Up @@ -235,7 +229,7 @@ def main():
# so the import of __version__ works
os.chdir(os.path.dirname(os.path.abspath(args.setupfile_path)))

# patch setup() function of distutils and setuptools for the
# patch setup() function of setuptools for the
# context of evaluating setup.py
backup_modules = {}
try:
Expand Down