Skip to content

Commit 6521033

Browse files
committed
Fix setup.py log messages
self.announce is based on an incomplete logger. use debug_print that turns on when env_var DISTUTILS_DEBUG is present
1 parent ccf96cb commit 6521033

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

setup.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ def build_extension(self, ext):
189189
# check the interop file exists, and create it if it doesn't
190190
interop_file = _get_interop_filename()
191191
if not os.path.exists(interop_file):
192+
self.debug_print("Creating {0}".format(interop_file))
192193
geninterop = os.path.join("tools", "geninterop", "geninterop.py")
193194
subprocess.check_call([sys.executable, geninterop, interop_file])
194195

@@ -218,7 +219,7 @@ def build_extension(self, ext):
218219
if manifest:
219220
cmd.append('/p:PythonManifest="{0}"'.format(manifest))
220221

221-
self.announce("Building: {0}".format(" ".join(cmd)))
222+
self.debug_print("Building: {0}".format(" ".join(cmd)))
222223
use_shell = True if DEVTOOLS == "Mono" else False
223224
subprocess.check_call(" ".join(cmd + ["/t:Clean"]), shell=use_shell)
224225
subprocess.check_call(" ".join(cmd + ["/t:Build"]), shell=use_shell)
@@ -233,7 +234,7 @@ def _get_manifest(self, build_dir):
233234
manifest = os.path.abspath(os.path.join(build_dir, "app.manifest"))
234235
cmd = [mt, '-inputresource:"{0}"'.format(sys.executable),
235236
'-out:"{0}"'.format(manifest)]
236-
self.announce("Extracting manifest from {}".format(sys.executable))
237+
self.debug_print("Extracting manifest from {}".format(sys.executable))
237238
subprocess.check_call(" ".join(cmd), shell=False)
238239
return manifest
239240

@@ -267,11 +268,11 @@ def _install_packages(self):
267268
use_shell = True
268269

269270
cmd = "{0} update -self".format(nuget)
270-
self.announce("Updating NuGet: {0}".format(cmd))
271+
self.debug_print("Updating NuGet: {0}".format(cmd))
271272
subprocess.check_call(cmd, shell=use_shell)
272273

273274
cmd = "{0} restore pythonnet.sln -o packages".format(nuget)
274-
self.announce("Installing packages: {0}".format(cmd))
275+
self.debug_print("Installing packages: {0}".format(cmd))
275276
subprocess.check_call(cmd, shell=use_shell)
276277

277278
def _find_msbuild_tool(self, tool="msbuild.exe", use_windows_sdk=False):
@@ -297,7 +298,7 @@ def _find_msbuild_tool(self, tool="msbuild.exe", use_windows_sdk=False):
297298
continue
298299
path = os.path.join(val, rkey.suffix, tool)
299300
if os.path.exists(path):
300-
self.announce("Using {0} from {1}".format(
301+
self.debug_print("Using {0} from {1}".format(
301302
tool, rkey.sdk_name))
302303
return path
303304
except WindowsError:
@@ -313,7 +314,7 @@ def _find_msbuild_tool(self, tool="msbuild.exe", use_windows_sdk=False):
313314
suffix = "Bin\\x64" if ARCH == "x64" else "Bin"
314315
path = os.path.join(localappdata, vs_python, suffix, tool)
315316
if os.path.exists(path):
316-
self.announce("Using {0} from {1}".format(tool, sdk_name))
317+
self.debug_print("Using {0} from {1}".format(tool, sdk_name))
317318
return path
318319

319320
raise RuntimeError("{0} could not be found".format(tool))

0 commit comments

Comments
 (0)