Skip to content

Commit

Permalink
suggestion change
Browse files Browse the repository at this point in the history
  • Loading branch information
toyobayashi committed Apr 1, 2024
1 parent 4bf22c4 commit 3a962e9
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions pylib/gyp/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,23 +423,17 @@ def EnsureDirExists(path):
pass

def GetCrossCompilerPredefines(): # -> dict
CC = os.environ.get("CC_target") or os.environ.get("CC")
CFLAGS = os.environ.get("CFLAGS")
CXX = os.environ.get("CXX_target") or os.environ.get("CXX")
CXXFLAGS = os.environ.get("CXXFLAGS")
cmd = []
defines = {}

if CC:
if CC := os.environ.get("CC_target") or os.environ.get("CC"):
cmd += CC.split(" ")
if CFLAGS:
if CFLAGS := os.environ.get("CFLAGS"):
cmd += CFLAGS.split(" ")
elif CXX:
elif CXX := os.environ.get("CXX_target") or os.environ.get("CXX"):
cmd += CXX.split(" ")
if CXXFLAGS:
if CXXFLAGS := os.environ.get("CXXFLAGS"):
cmd += CXXFLAGS.split(" ")
else:
return defines
return {}

if sys.platform == "win32":
fd, input = tempfile.mkstemp(suffix=".c")
Expand All @@ -462,6 +456,7 @@ def GetCrossCompilerPredefines(): # -> dict
)
stdout = out.communicate()[0]

defines = {}
lines = stdout.decode("utf-8").replace("\r\n", "\n").split("\n")
for line in lines:
if not line:
Expand Down

0 comments on commit 3a962e9

Please sign in to comment.