Skip to content

Commit caa03c8

Browse files
committed
Removing pathconfig warnings, defaulting the python path to include the local copy of the standard library. This allows for this package to be used in build steps easily. Note that it may be better to point the prefix paths to the standard library as then we don't need to suppress the pathconfig warnings, but that would require copying the directory into the expected python3.11 directory which isn't straight forward to do as part of the build as we can't use lazy paths as flags.
1 parent 3b579ae commit caa03c8

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Modules/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ pymain_init(const _PyArgv *args)
5151

5252
PyConfig config;
5353
PyConfig_InitPythonConfig(&config);
54+
config.pathconfig_warnings = 0;
5455

5556
/* pass NULL as the config: config is read from command line arguments,
5657
environment variables, configuration files */

build.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ pub fn build(b: *std.Build) void {
814814
"-fvisibility=hidden",
815815
"-DPy_BUILD_CORE",
816816

817-
"-DPYTHONPATH=\"\"",
817+
std.fmt.allocPrint(b.allocator, "-DPYTHONPATH=\"{s}\"", .{b.path("Lib").getPath(b)}) catch @panic("OOM"),
818818
"-DPREFIX=\"/usr/local\"",
819819
"-DEXEC_PREFIX=\"/usr/local\"",
820820
"-DVERSION=\"3.11\"",

0 commit comments

Comments
 (0)