|
5 | 5 | # found in the LICENSE file.
|
6 | 6 |
|
7 | 7 | from __future__ import annotations
|
8 |
| -import copy |
9 |
| -import gyp.input |
| 8 | + |
10 | 9 | import argparse
|
| 10 | +import copy |
11 | 11 | import os.path
|
12 | 12 | import re
|
13 | 13 | import shlex
|
14 | 14 | import sys
|
15 | 15 | import traceback
|
16 |
| -from gyp.common import GypError |
17 | 16 |
|
| 17 | +import gyp.input |
| 18 | +from gyp.common import GypError |
18 | 19 |
|
19 | 20 | # Default debug modes for GYP
|
20 | 21 | debug = {}
|
@@ -205,8 +206,7 @@ def NameValueListToDict(name_value_list):
|
205 | 206 |
|
206 | 207 |
|
207 | 208 | def ShlexEnv(env_name):
|
208 |
| - flags = os.environ.get(env_name, []) |
209 |
| - if flags: |
| 209 | + if flags := os.environ.get(env_name) or []: |
210 | 210 | flags = shlex.split(flags)
|
211 | 211 | return flags
|
212 | 212 |
|
@@ -361,7 +361,7 @@ def gyp_main(args):
|
361 | 361 | action="store",
|
362 | 362 | env_name="GYP_CONFIG_DIR",
|
363 | 363 | default=None,
|
364 |
| - help="The location for configuration files like " "include.gypi.", |
| 364 | + help="The location for configuration files like include.gypi.", |
365 | 365 | )
|
366 | 366 | parser.add_argument(
|
367 | 367 | "-d",
|
@@ -525,19 +525,18 @@ def gyp_main(args):
|
525 | 525 | # If no format was given on the command line, then check the env variable.
|
526 | 526 | generate_formats = []
|
527 | 527 | if options.use_environment:
|
528 |
| - generate_formats = os.environ.get("GYP_GENERATORS", []) |
| 528 | + generate_formats = os.environ.get("GYP_GENERATORS") or [] |
529 | 529 | if generate_formats:
|
530 | 530 | generate_formats = re.split(r"[\s,]", generate_formats)
|
531 | 531 | if generate_formats:
|
532 | 532 | options.formats = generate_formats
|
| 533 | + # Nothing in the variable, default based on platform. |
| 534 | + elif sys.platform == "darwin": |
| 535 | + options.formats = ["xcode"] |
| 536 | + elif sys.platform in ("win32", "cygwin"): |
| 537 | + options.formats = ["msvs"] |
533 | 538 | else:
|
534 |
| - # Nothing in the variable, default based on platform. |
535 |
| - if sys.platform == "darwin": |
536 |
| - options.formats = ["xcode"] |
537 |
| - elif sys.platform in ("win32", "cygwin"): |
538 |
| - options.formats = ["msvs"] |
539 |
| - else: |
540 |
| - options.formats = ["make"] |
| 539 | + options.formats = ["make"] |
541 | 540 |
|
542 | 541 | if not options.generator_output and options.use_environment:
|
543 | 542 | g_o = os.environ.get("GYP_GENERATOR_OUTPUT")
|
@@ -696,7 +695,7 @@ def main(args):
|
696 | 695 | return 1
|
697 | 696 |
|
698 | 697 |
|
699 |
| -# NOTE: setuptools generated console_scripts calls function with no arguments |
| 698 | +# NOTE: console_scripts calls this function with no arguments |
700 | 699 | def script_main():
|
701 | 700 | return main(sys.argv[1:])
|
702 | 701 |
|
|
0 commit comments