Skip to content

Commit

Permalink
Merge pull request #1333 from davidgyu/dev_fix_build_osd_distutils
Browse files Browse the repository at this point in the history
Updated build_osd.py for recent versions of Python 3.x
  • Loading branch information
davidgyu authored May 16, 2024
2 parents 7d0ab55 + 7224279 commit e6112ea
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions build_scripts/build_osd.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@
#
from __future__ import print_function

from distutils.spawn import find_executable

import argparse
import codecs
import contextlib
import datetime
import distutils
import fnmatch
import glob
import locale
Expand All @@ -46,8 +43,10 @@

if sys.version_info.major >= 3:
from urllib.request import urlopen
from shutil import which
else:
from urllib2 import urlopen
from distutils.spawn import find_executable as which

# Helpers for printing output
verbosity = 1
Expand Down Expand Up @@ -114,7 +113,7 @@ def GetVisualStudioCompilerAndVersion():
if not Windows():
return None

msvcCompiler = find_executable('cl')
msvcCompiler = which('cl')
if msvcCompiler:
# VisualStudioVersion environment variable should be set by the
# Visual Studio Command Prompt.
Expand Down Expand Up @@ -838,10 +837,10 @@ def __init__(self, args):
# use urllib2 all the time is that some older versions of Python
# don't support TLS v1.2, which is required for downloading some
# dependencies.
if find_executable("curl"):
if which("curl"):
self.downloader = DownloadFileWithCurl
self.downloaderName = "curl"
elif Windows() and find_executable("powershell"):
elif Windows() and which("powershell"):
self.downloader = DownloadFileWithPowershell
self.downloaderName = "powershell"
else:
Expand Down Expand Up @@ -937,23 +936,23 @@ def ForceBuildDependency(self, dep):
dependenciesToBuild.append(dep)

# Verify toolchain needed to build required dependencies
if (not find_executable("g++") and
not find_executable("clang") and
if (not which("g++") and
not which("clang") and
not GetXcodeDeveloperDirectory() and
not GetVisualStudioCompilerAndVersion()):
PrintError("C++ compiler not found -- please install a compiler")
sys.exit(1)

if not find_executable("cmake"):
if not which("cmake"):
PrintError("CMake not found -- please install it and adjust your PATH")
sys.exit(1)

if context.buildDocs:
if not find_executable("doxygen"):
if not which("doxygen"):
PrintError("doxygen not found -- please install it and adjust your PATH")
sys.exit(1)

if not find_executable("dot"):
if not which("dot"):
PrintError("dot not found -- please install graphviz and adjust your "
"PATH")
sys.exit(1)
Expand Down

0 comments on commit e6112ea

Please sign in to comment.