File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed
colcon_python_setup_py/package_identification Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change 22# Licensed under the Apache License, Version 2.0
33
44import ast
5+ from contextlib import suppress
56import distutils .core
67import os
78from pathlib import Path
89import runpy
9- try :
10+ with suppress ( ImportError ) :
1011 import setuptools
11- except ImportError :
12- pass
1312import subprocess
1413import sys
1514from threading import Lock
@@ -121,19 +120,15 @@ def get_setup_arguments(setup_py):
121120 try :
122121 distutils_setup = distutils .core .setup
123122 distutils .core .setup = mock_setup
124- try :
123+ with suppress ( NameError ) :
125124 setuptools_setup = setuptools .setup
126125 setuptools .setup = mock_setup
127- except NameError :
128- pass
129126 # evaluate the setup.py file
130127 runpy .run_path (str (setup_py ))
131128 finally :
132129 distutils .core .setup = distutils_setup
133- try :
130+ with suppress ( NameError ) :
134131 setuptools .setup = setuptools_setup
135- except NameError :
136- pass
137132 # filter out any data which doesn't work with ast.literal_eval
138133 for key , value in list (data .items ()):
139134 try :
Original file line number Diff line number Diff line change 11apache
22chdir
33colcon
4+ contextlib
45distclass
56hashable
67iterdir
You can’t perform that action at this time.
0 commit comments