Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions pylib/gyp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ def NameValueListToDict(name_value_list):


def ShlexEnv(env_name):
flags = os.environ.get(env_name, [])
if flags:
if flags := os.environ.get(env_name) or []:
flags = shlex.split(flags)
return flags

Expand Down Expand Up @@ -525,7 +524,7 @@ def gyp_main(args):
# If no format was given on the command line, then check the env variable.
generate_formats = []
if options.use_environment:
generate_formats = os.environ.get("GYP_GENERATORS", [])
generate_formats = os.environ.get("GYP_GENERATORS") or []
if generate_formats:
generate_formats = re.split(r"[\s,]", generate_formats)
if generate_formats:
Expand Down
8 changes: 4 additions & 4 deletions pylib/gyp/generator/ninja.py
Original file line number Diff line number Diff line change
Expand Up @@ -1465,7 +1465,7 @@ def WriteLinkForArch(
# Respect environment variables related to build, but target-specific
# flags can still override them.
ldflags = env_ldflags + config.get("ldflags", [])
if is_executable and len(solibs):
if is_executable and solibs:
rpath = "lib/"
if self.toolset != "target":
rpath += self.toolset
Expand Down Expand Up @@ -1555,7 +1555,7 @@ def WriteLinkForArch(
if pdbname:
output = [output, pdbname]

if len(solibs):
if solibs:
extra_bindings.append(
("solibs", gyp.common.EncodePOSIXShellList(sorted(solibs)))
)
Expand Down Expand Up @@ -2085,7 +2085,7 @@ def CommandWithWrapper(cmd, wrappers, prog):

def GetDefaultConcurrentLinks():
"""Returns a best-guess for a number of concurrent links."""
pool_size = int(os.environ.get("GYP_LINK_CONCURRENCY", 0))
pool_size = int(os.environ.get("GYP_LINK_CONCURRENCY") or 0)
if pool_size:
return pool_size

Expand All @@ -2112,7 +2112,7 @@ class MEMORYSTATUSEX(ctypes.Structure):
# VS 2015 uses 20% more working set than VS 2013 and can consume all RAM
# on a 64 GiB machine.
mem_limit = max(1, stat.ullTotalPhys // (5 * (2 ** 30))) # total / 5GiB
hard_cap = max(1, int(os.environ.get("GYP_LINK_CONCURRENCY_MAX", 2 ** 32)))
hard_cap = max(1, int(os.environ.get("GYP_LINK_CONCURRENCY_MAX") or 2 ** 32))
return min(mem_limit, hard_cap)
elif sys.platform.startswith("linux"):
if os.path.exists("/proc/meminfo"):
Expand Down
Loading