Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated build_osd.py for recent versions of Python 3.x #1333

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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