Skip to content

Commit 485f500

Browse files
authored
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.
1 parent 86eb33b commit 485f500

File tree

5 files changed

+11
-2
lines changed

5 files changed

+11
-2
lines changed

colcon_core/task/python/build.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,12 @@ async def build(self, *, additional_hooks=None): # noqa: D102
7777
python_lib = os.path.join(
7878
args.install_base, self._get_python_lib(args))
7979
os.makedirs(python_lib, exist_ok=True)
80+
distutils_commands = os.path.join(
81+
os.path.dirname(__file__), 'colcon_distutils_commands')
8082
# and being in the PYTHONPATH
8183
env = dict(env)
8284
env['PYTHONPATH'] = str(prefix_override) + os.pathsep + \
85+
distutils_commands + os.pathsep + \
8386
python_lib + os.pathsep + env.get('PYTHONPATH', '')
8487
# coverage capture interferes with sitecustomize
8588
# See also: https://docs.python.org/3/library/site.html#module-site

colcon_core/task/python/colcon_distutils_commands/__init__.py

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Metadata-Version: 2.1
2+
Name: colcon_distutils_commands
3+
Version: 0.0.0
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[distutils.commands]
2+
symlink_data = colcon_core.distutils.commands.symlink_data:symlink_data

setup.cfg

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,15 @@ colcon_core.verb =
145145
test = colcon_core.verb.test:TestVerb
146146
console_scripts =
147147
colcon = colcon_core.command:main
148-
distutils.commands =
149-
symlink_data = colcon_core.distutils.commands.symlink_data:symlink_data
150148
pytest11 =
151149
colcon_core_warnings_stderr = colcon_core.pytest.hooks
152150

153151
[options.package_data]
154152
colcon_core.shell.template = *.em
155153
colcon_core.task.python.template = *.em
154+
colcon_core.task.python.colcon_distutils_commands =
155+
*/METADATA
156+
*/entry_points.txt
156157

157158
[flake8]
158159
import-order-style = google

0 commit comments

Comments
 (0)