uv2compdb 0.5.0__tar.gz → 0.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {uv2compdb-0.5.0 → uv2compdb-0.5.1}/PKG-INFO +1 -1
- {uv2compdb-0.5.0 → uv2compdb-0.5.1}/pyproject.toml +1 -1
- {uv2compdb-0.5.0 → uv2compdb-0.5.1}/src/uv2compdb/main.py +3 -2
- {uv2compdb-0.5.0 → uv2compdb-0.5.1}/src/uv2compdb/parser.py +16 -9
- {uv2compdb-0.5.0 → uv2compdb-0.5.1}/LICENSE +0 -0
- {uv2compdb-0.5.0 → uv2compdb-0.5.1}/README.md +0 -0
- {uv2compdb-0.5.0 → uv2compdb-0.5.1}/src/uv2compdb/__init__.py +0 -0
- {uv2compdb-0.5.0 → uv2compdb-0.5.1}/src/uv2compdb/__main__.py +0 -0
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
Generate Compilation Database by parse Keil µVision project.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
+
import shlex
|
|
5
6
|
import logging
|
|
6
7
|
import argparse
|
|
7
8
|
from pathlib import Path
|
|
8
9
|
from importlib.metadata import version
|
|
9
10
|
|
|
10
|
-
from uv2compdb.parser import UV2CompDB,
|
|
11
|
+
from uv2compdb.parser import UV2CompDB, generate_compile_commands
|
|
11
12
|
|
|
12
13
|
__version__ = version("uv2compdb")
|
|
13
14
|
logger = logging.getLogger(__name__)
|
|
@@ -80,7 +81,7 @@ def main() -> int:
|
|
|
80
81
|
target_setting = uv2compdb.parse(args.target, args.build)
|
|
81
82
|
command_objects = uv2compdb.generate_command_objects(
|
|
82
83
|
target_setting,
|
|
83
|
-
|
|
84
|
+
shlex.split(args.arguments) if args.arguments else [],
|
|
84
85
|
args.predefined,
|
|
85
86
|
)
|
|
86
87
|
if not generate_compile_commands(command_objects, args.output):
|
|
@@ -234,8 +234,15 @@ class UV2CompDB:
|
|
|
234
234
|
if not (uv4_path := shutil.which("uv4")):
|
|
235
235
|
return False
|
|
236
236
|
|
|
237
|
-
cmd =
|
|
238
|
-
|
|
237
|
+
cmd = [
|
|
238
|
+
uv4_path,
|
|
239
|
+
"-b",
|
|
240
|
+
"-t",
|
|
241
|
+
target_name,
|
|
242
|
+
self.project_path.resolve().as_posix(),
|
|
243
|
+
"-j0",
|
|
244
|
+
]
|
|
245
|
+
logger.info(f"Run: `{subprocess.list2cmdline(cmd)}`")
|
|
239
246
|
try:
|
|
240
247
|
result = subprocess.run(cmd, capture_output=True, text=True)
|
|
241
248
|
logger.info(
|
|
@@ -448,16 +455,18 @@ class UV2CompDB:
|
|
|
448
455
|
|
|
449
456
|
@staticmethod
|
|
450
457
|
@lru_cache(maxsize=32)
|
|
451
|
-
def _get_predefined_macros_cached(
|
|
458
|
+
def _get_predefined_macros_cached(
|
|
459
|
+
compiler: str, args: tuple[str, ...]
|
|
460
|
+
) -> tuple[str, ...]:
|
|
452
461
|
"""Get predefined macros from compiler with caching."""
|
|
453
462
|
if "armcc" in compiler.lower():
|
|
454
|
-
cmd =
|
|
463
|
+
cmd = [compiler, *args, "--list_macros"]
|
|
455
464
|
elif "armclang" in compiler.lower():
|
|
456
|
-
cmd =
|
|
465
|
+
cmd = [compiler, *args, "--target=arm-arm-none-eabi", "-dM", "-E", "-"]
|
|
457
466
|
else:
|
|
458
467
|
return ()
|
|
459
468
|
|
|
460
|
-
logger.info(f"Get predefined macro by: `{cmd}`")
|
|
469
|
+
logger.info(f"Get predefined macro by: `{subprocess.list2cmdline(cmd)}`")
|
|
461
470
|
try:
|
|
462
471
|
result = subprocess.run(cmd, capture_output=True, text=True, input="")
|
|
463
472
|
if result.returncode != 0:
|
|
@@ -509,9 +518,7 @@ class UV2CompDB:
|
|
|
509
518
|
next(args_iter, None)
|
|
510
519
|
|
|
511
520
|
return list(
|
|
512
|
-
self._get_predefined_macros_cached(
|
|
513
|
-
toolchain.compiler, " ".join(filtered_args)
|
|
514
|
-
)
|
|
521
|
+
self._get_predefined_macros_cached(toolchain.compiler, tuple(filtered_args))
|
|
515
522
|
)
|
|
516
523
|
|
|
517
524
|
def filter_unknown_argument(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|