Skip to content

Commit

Permalink
Make distutils symlink_data command private (#645)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cottsay authored May 31, 2024
1 parent 86eb33b commit 485f500
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions colcon_core/task/python/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Metadata-Version: 2.1
Name: colcon_distutils_commands
Version: 0.0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[distutils.commands]
symlink_data = colcon_core.distutils.commands.symlink_data:symlink_data
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 485f500

Please sign in to comment.