From 485f5009205d7b50d3a21bb5e889cd94b42027a1 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Fri, 31 May 2024 16:15:23 -0500 Subject: [PATCH] Make distutils symlink_data command private (#645) We don't want anyone taking a dependency on this functionality, and we don't want to interfere with non-colcon use of setuptools or distutils, so it's best to just hide this entry point and make it available only when we're running our builds. --- colcon_core/task/python/build.py | 3 +++ .../task/python/colcon_distutils_commands/__init__.py | 0 .../colcon_distutils_commands-0.0.0.dist-info/METADATA | 3 +++ .../entry_points.txt | 2 ++ setup.cfg | 5 +++-- 5 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 colcon_core/task/python/colcon_distutils_commands/__init__.py create mode 100644 colcon_core/task/python/colcon_distutils_commands/colcon_distutils_commands-0.0.0.dist-info/METADATA create mode 100644 colcon_core/task/python/colcon_distutils_commands/colcon_distutils_commands-0.0.0.dist-info/entry_points.txt diff --git a/colcon_core/task/python/build.py b/colcon_core/task/python/build.py index 442d5a620..a72c1a54e 100644 --- a/colcon_core/task/python/build.py +++ b/colcon_core/task/python/build.py @@ -77,9 +77,12 @@ async def build(self, *, additional_hooks=None): # noqa: D102 python_lib = os.path.join( args.install_base, self._get_python_lib(args)) os.makedirs(python_lib, exist_ok=True) + distutils_commands = os.path.join( + os.path.dirname(__file__), 'colcon_distutils_commands') # and being in the PYTHONPATH env = dict(env) env['PYTHONPATH'] = str(prefix_override) + os.pathsep + \ + distutils_commands + os.pathsep + \ python_lib + os.pathsep + env.get('PYTHONPATH', '') # coverage capture interferes with sitecustomize # See also: https://docs.python.org/3/library/site.html#module-site diff --git a/colcon_core/task/python/colcon_distutils_commands/__init__.py b/colcon_core/task/python/colcon_distutils_commands/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/colcon_core/task/python/colcon_distutils_commands/colcon_distutils_commands-0.0.0.dist-info/METADATA b/colcon_core/task/python/colcon_distutils_commands/colcon_distutils_commands-0.0.0.dist-info/METADATA new file mode 100644 index 000000000..c97b22f57 --- /dev/null +++ b/colcon_core/task/python/colcon_distutils_commands/colcon_distutils_commands-0.0.0.dist-info/METADATA @@ -0,0 +1,3 @@ +Metadata-Version: 2.1 +Name: colcon_distutils_commands +Version: 0.0.0 diff --git a/colcon_core/task/python/colcon_distutils_commands/colcon_distutils_commands-0.0.0.dist-info/entry_points.txt b/colcon_core/task/python/colcon_distutils_commands/colcon_distutils_commands-0.0.0.dist-info/entry_points.txt new file mode 100644 index 000000000..cade4c272 --- /dev/null +++ b/colcon_core/task/python/colcon_distutils_commands/colcon_distutils_commands-0.0.0.dist-info/entry_points.txt @@ -0,0 +1,2 @@ +[distutils.commands] +symlink_data = colcon_core.distutils.commands.symlink_data:symlink_data diff --git a/setup.cfg b/setup.cfg index 85391702f..3928d02e7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -145,14 +145,15 @@ colcon_core.verb = test = colcon_core.verb.test:TestVerb console_scripts = colcon = colcon_core.command:main -distutils.commands = - symlink_data = colcon_core.distutils.commands.symlink_data:symlink_data pytest11 = colcon_core_warnings_stderr = colcon_core.pytest.hooks [options.package_data] colcon_core.shell.template = *.em colcon_core.task.python.template = *.em +colcon_core.task.python.colcon_distutils_commands = + */METADATA + */entry_points.txt [flake8] import-order-style = google