10
10
// See the License for the specific language governing permissions and
11
11
// limitations under the License.
12
12
13
+ const builtin = @import ("builtin" );
13
14
const std = @import ("std" );
14
15
15
16
pub fn build (b : * std.Build ) void {
@@ -91,7 +92,7 @@ fn getPythonIncludePath(
91
92
python_exe : []const u8 ,
92
93
allocator : std.mem.Allocator ,
93
94
) ! []const u8 {
94
- const includeResult = try std . process . Child . exec (.{
95
+ const includeResult = try runProcess (.{
95
96
.allocator = allocator ,
96
97
.argv = &.{ python_exe , "-c" , "import sysconfig; print(sysconfig.get_path('include'), end='')" },
97
98
});
@@ -100,7 +101,7 @@ fn getPythonIncludePath(
100
101
}
101
102
102
103
fn getPythonLibraryPath (python_exe : []const u8 , allocator : std.mem.Allocator ) ! []const u8 {
103
- const includeResult = try std . process . Child . exec (.{
104
+ const includeResult = try runProcess (.{
104
105
.allocator = allocator ,
105
106
.argv = &.{ python_exe , "-c" , "import sysconfig; print(sysconfig.get_config_var('LIBDIR'), end='')" },
106
107
});
@@ -109,10 +110,12 @@ fn getPythonLibraryPath(python_exe: []const u8, allocator: std.mem.Allocator) ![
109
110
}
110
111
111
112
fn getPythonLDVersion (python_exe : []const u8 , allocator : std.mem.Allocator ) ! []const u8 {
112
- const includeResult = try std . process . Child . exec (.{
113
+ const includeResult = try runProcess (.{
113
114
.allocator = allocator ,
114
115
.argv = &.{ python_exe , "-c" , "import sysconfig; print(sysconfig.get_config_var('LDVERSION'), end='')" },
115
116
});
116
117
defer allocator .free (includeResult .stderr );
117
118
return includeResult .stdout ;
118
119
}
120
+
121
+ const runProcess = if (builtin .zig_version .minor >= 12 ) std .process .Child .run else std .process .Child .exec ;
0 commit comments