Skip to content

Commit fd739b4

Browse files
authored
avoid warning introduced in setuptools 49.2.0 (#39)
1 parent c27e57b commit fd739b4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

colcon_python_setup_py/package_identification/python_setup_py.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33

44
import ast
55
from contextlib import suppress
6+
with suppress(ImportError):
7+
# needed before importing distutils
8+
# to avoid warning introduced in setuptools 49.2.0
9+
import setuptools
610
import distutils.core
711
import os
812
from pathlib import Path
913
import runpy
10-
with suppress(ImportError):
11-
import setuptools
1214
import subprocess
1315
import sys
1416
from threading import Lock
@@ -264,6 +266,9 @@ def get_setup_information(setup_py, *, env=None):
264266
def _get_setup_information(setup_py, *, env=None):
265267
code_lines = [
266268
'import sys',
269+
# setuptools needs to be imported before distutils
270+
# to avoid warning introduced in setuptools 49.2.0
271+
'from setuptools.extern.packaging.specifiers import SpecifierSet',
267272
'from distutils.core import run_setup',
268273

269274
'dist = run_setup('

0 commit comments

Comments
 (0)