Henry Schreiner
ea9e6e6a23
feat: small command line helpers for quick tests ( #4272 )
...
* feat: small command line helpers for quick tests
Add --cflags, --ldflags, --embed, and --file to the pybind11 command
line tool, based on python-config. This makes quick one-off compiles
easy:
c++ $(python3 -m pybind11 --file=example.cpp)
Assisted-by: ClaudeCode:claude-fable-5
* refactor: quote paths, clarify CLI output logic, strengthen tests
- Quote include and library dirs in get_cflags/get_ldflags so paths with
spaces work, sharing one quote helper in commands.py
- Restructure the --file/--cflags/--ldflags printing into a single print
- Note the Unix-compiler orientation in help text and docs
- Test -L presence for --embed and quoting of paths with spaces
Assisted-by: ClaudeCode:claude-fable-5
* refactor: simplify flag helpers and keep import pybind11 light
- Replace _get_config_var(name, fmt, quote) with a plain _config(name)
string helper; formatting and quoting happen at the call sites
- Defer sysconfig/shlex imports so import pybind11 does not pay for the
CLI (~1ms -> ~0.08ms for pybind11.commands)
- Fetch EXT_SUFFIX once in main()
- Import commands normally in the quoting test instead of importlib
file loading
Assisted-by: ClaudeCode:claude-fable-5
* fix: shared-library flags on all Unix platforms
The --file/--ldflags output only added -shared and -fPIC on Linux, so
other Unix platforms (FreeBSD, Solaris, AIX) linked an executable and
failed on the missing main. Gate on os.name instead.
Assisted-by: ClaudeCode:claude-opus-5
2026-07-31 14:17:21 -04:00
..
2026-07-31 14:17:21 -04:00
2026-07-29 14:53:47 -04:00
2025-12-21 21:25:06 -08:00
2026-07-29 14:53:47 -04:00
2026-07-29 14:53:47 -04:00
2026-07-29 14:53:47 -04:00
2026-07-29 14:53:47 -04:00
2025-12-13 02:17:08 -08:00
2024-11-18 14:39:59 -08:00
2024-06-18 13:54:38 -07:00
2024-06-18 13:54:38 -07:00
2024-09-17 09:47:20 -07:00
2024-06-18 13:54:38 -07:00
2026-06-10 16:03:38 -04:00
2024-11-10 12:17:35 -08:00
2026-07-29 14:53:47 -04:00
2026-07-29 14:53:47 -04:00
2025-10-13 18:00:28 -06:00
2025-12-26 13:59:11 -05:00
2025-06-02 16:08:40 -04:00
2025-06-02 16:08:40 -04:00
2022-02-10 12:17:07 -08:00
2025-10-14 16:52:03 -06:00
2026-03-26 16:21:32 -07:00
2024-11-07 09:32:09 -08:00
2025-12-30 04:54:44 -08:00
2025-11-10 20:28:09 -08:00
2026-07-24 20:32:52 -04:00
2026-07-29 14:53:47 -04:00
2022-02-10 12:17:07 -08:00
2024-09-03 10:51:21 -04:00
2026-03-26 16:21:32 -07:00
2026-03-26 16:21:32 -07:00
2026-02-16 23:00:01 -08:00
2026-07-26 21:25:24 -07:00
2024-10-07 14:12:04 -07:00
2024-10-25 08:28:15 -07:00
2025-08-04 05:00:33 -07:00
2026-05-16 11:28:05 -07:00
2022-02-10 12:17:07 -08:00
2024-06-22 00:55:00 -04:00
2025-10-14 16:52:03 -06:00
2025-10-18 11:07:00 -06:00
2025-09-08 15:47:24 -07:00
2025-02-16 11:01:41 -08:00
2025-05-25 10:54:05 -04:00
2025-12-08 09:25:25 -08:00
2025-03-05 12:40:53 -08:00
2026-05-27 08:07:53 -07:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-06-17 12:16:56 -07:00
2025-06-17 12:16:56 -07:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-10-01 11:21:47 -07:00
2025-10-01 11:21:47 -07:00
2025-09-08 15:47:24 -07:00
2025-03-05 12:40:53 -08:00
2026-03-24 07:58:42 -07:00
2026-04-06 08:50:55 -07:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-04-30 22:12:13 -07:00
2025-04-30 22:12:13 -07:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2026-07-26 19:08:59 -07:00
2026-07-29 14:53:47 -04:00
2025-03-05 12:40:53 -08:00
2026-07-29 14:53:47 -04:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2026-07-29 14:53:47 -04:00
2025-03-05 12:40:53 -08:00
2026-04-11 20:02:27 -07:00
2026-04-11 20:02:27 -07:00
2022-02-14 11:36:22 -08:00
2024-06-22 00:55:00 -04:00
2024-03-26 13:57:05 -04:00
2024-06-22 00:55:00 -04:00
2025-08-11 19:34:37 -07:00
2026-02-16 23:00:21 -08:00
2024-09-13 00:18:29 -04:00
2024-09-13 00:18:29 -04:00
2024-09-13 00:18:29 -04:00
2025-09-03 09:06:41 -07:00
2024-04-02 11:14:08 -04:00
2026-02-16 23:00:01 -08:00
2026-02-01 21:54:05 -08:00
2026-03-02 15:03:46 -05:00
2025-05-19 11:54:31 -04:00
2025-05-19 11:54:31 -04:00
2024-04-02 11:14:08 -04:00
2025-12-13 02:17:08 -08:00
2025-09-08 15:47:24 -07:00
2025-02-17 23:13:05 -08:00
2022-12-20 05:34:00 -08:00
2024-07-29 11:10:03 -07:00
2025-02-17 23:13:05 -08:00
2026-05-24 21:04:39 -07:00
2026-06-10 16:03:38 -04:00
2024-06-22 00:55:00 -04:00
2022-02-10 12:17:07 -08:00
2024-10-07 14:12:04 -07:00
2024-09-17 09:47:20 -07:00
2023-08-07 20:48:20 -07:00
2026-07-24 20:32:52 -04:00
2026-02-16 23:00:01 -08:00
2026-02-16 23:00:01 -08:00
2022-10-30 08:57:23 -07:00
2026-03-02 15:03:46 -05:00
2026-04-15 21:08:06 -07:00
2026-04-15 21:08:06 -07:00
2024-11-11 14:51:01 -08:00
2026-01-06 16:32:57 -05:00
2025-10-13 18:00:28 -06:00
2025-10-13 18:00:28 -06:00
2026-03-26 16:21:32 -07:00
2026-03-26 16:21:32 -07:00
2025-05-25 18:56:26 -04:00
2025-08-02 19:48:38 -07:00
2022-02-10 12:17:07 -08:00
2026-05-27 08:07:53 -07:00
2026-02-09 21:14:07 -08:00
2025-10-18 11:07:00 -06:00
2025-10-18 11:07:00 -06:00
2026-02-08 15:04:46 -08:00
2026-07-08 23:31:36 -04:00
2025-05-25 10:54:05 -04:00
2025-11-10 20:26:50 -08:00
2025-06-18 19:40:31 -04:00
2025-06-18 19:40:31 -04:00
2026-03-26 16:21:32 -07:00
2026-03-26 16:21:32 -07:00
2025-04-10 18:31:28 -04:00
2025-05-31 23:47:20 -04:00
2022-11-28 07:39:38 -08:00
2026-06-10 16:03:38 -04:00
2025-05-13 14:09:05 -04:00
2025-06-06 03:54:02 -04:00
2026-07-29 14:53:47 -04:00
2025-05-13 10:07:33 -04:00
2023-11-08 12:44:04 -08:00
2024-06-22 00:55:00 -04:00
2026-04-06 08:50:55 -07:00
2026-04-06 08:50:55 -07:00
2026-03-22 14:23:00 -07:00
2026-05-16 11:28:05 -07:00
2025-11-13 16:29:02 -08:00
2025-06-04 11:45:26 -04:00
2025-12-08 09:36:51 -08:00
2025-05-19 11:54:31 -04:00
2026-07-29 14:53:47 -04:00
2026-05-18 21:36:16 -07:00
2026-03-29 20:17:22 -07:00
2025-12-08 09:36:51 -08:00
2026-07-26 03:14:56 -07:00
2026-07-28 18:53:36 -07:00
2026-07-28 18:53:36 -07:00
2025-09-08 15:47:24 -07:00
2024-06-22 00:55:00 -04:00
2025-11-13 16:29:02 -08:00
2025-11-13 16:29:02 -08:00
2024-10-07 14:12:04 -07:00
2025-11-10 20:26:50 -08:00
2024-08-09 13:28:12 -07:00
2024-08-09 13:28:12 -07:00
2019-06-11 23:28:58 +02:00
2024-06-22 00:55:00 -04:00
2025-02-19 09:24:02 -08:00
2025-12-12 23:57:05 -08:00
2023-04-25 14:03:24 -07:00
2024-06-22 00:55:00 -04:00
2023-04-27 07:24:48 -07:00
2024-06-22 00:55:00 -04:00
2026-07-29 14:53:47 -04:00
2024-10-07 14:12:04 -07:00
2024-08-28 20:55:50 -07:00
2025-07-11 15:36:38 -07:00
2021-07-04 19:58:35 -04:00
2021-01-31 17:29:09 -05:00