Skip to content

Commit 4ba7647

Browse files
committed
add 3.6
1 parent c60a40e commit 4ba7647

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

build.zig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
pub const Version = enum {
2+
@"3.6",
23
@"3.11.13",
34
@"3.12.11",
45
pub fn libName(self: Version) []const u8 {
56
return switch (self) {
7+
.@"3.6" => "3.6",
68
.@"3.11.13" => "3.11",
79
.@"3.12.11" => "3.12",
810
};
@@ -59,6 +61,7 @@ pub fn build(b: *std.Build) !void {
5961
});
6062

6163
const upstream: *std.Build.Dependency = switch (version) {
64+
.@"3.6" => if (b.lazyDependency("upstream_3.6", .{})) |d| d else noUpstream(b),
6265
.@"3.11.13" => if (b.lazyDependency("upstream_3.11.13", .{})) |d| d else noUpstream(b),
6366
.@"3.12.11" => if (b.lazyDependency("upstream_3.12.11", .{})) |d| d else noUpstream(b),
6467
};
@@ -366,6 +369,7 @@ fn addMakesetup(
366369
replace.addArg("MODULE_BUILDTYPE=static");
367370
addReplaceModuleArgs(b, replace, @TypeOf(stdlib_modules_common), stdlib_modules_common);
368371
switch (version) {
372+
.@"3.6" => {},
369373
.@"3.11.13" => addReplaceModuleArgs(b, replace, @TypeOf(@"stdlib_modules_3.11.13"), @"stdlib_modules_3.11.13"),
370374
.@"3.12.11" => {
371375
replace.addArg("MODULE__CTYPES_MALLOC_CLOSURE=");
@@ -436,6 +440,7 @@ fn addPythonExe(
436440
});
437441

438442
switch (args.pyconfig.version) {
443+
.@"3.6" => {},
439444
.@"3.11.13" => {
440445
// workaround dictobject.c memcpy alignment issue
441446
exe.root_module.sanitize_c = false;
@@ -449,6 +454,7 @@ fn addPythonExe(
449454
.Debug => {},
450455
.ReleaseSafe, .ReleaseSmall, .ReleaseFast => {
451456
const release_date = switch (args.pyconfig.version) {
457+
.@"3.6" => "December 28, 2021",
452458
.@"3.11.13" => "June 3, 2025",
453459
.@"3.12.11" => "June 3, 2025",
454460
};
@@ -566,6 +572,7 @@ fn addPythonExe(
566572
"Modules/getpath_noop.c",
567573
},
568574
switch (args.pyconfig.version) {
575+
.@"3.6" => &library_src_omit_frozen.@"3.6",
569576
.@"3.11.13" => &library_src_omit_frozen.@"3.11.13",
570577
.@"3.12.11" => &library_src_omit_frozen.@"3.12.11",
571578
},
@@ -576,6 +583,7 @@ fn addPythonExe(
576583
"Modules/getbuildinfo.c",
577584
},
578585
switch (args.pyconfig.version) {
586+
.@"3.6" => &library_src_omit_frozen.@"3.6",
579587
.@"3.11.13" => &library_src_omit_frozen.@"3.11.13",
580588
.@"3.12.11" => &library_src_omit_frozen.@"3.12.11",
581589
},
@@ -587,6 +595,7 @@ fn addPythonExe(
587595
"Python/frozen.c",
588596
},
589597
switch (args.pyconfig.version) {
598+
.@"3.6" => &library_src_omit_frozen.@"3.6",
590599
.@"3.11.13" => &library_src_omit_frozen.@"3.11.13",
591600
.@"3.12.11" => &library_src_omit_frozen.@"3.12.11",
592601
},
@@ -768,6 +777,7 @@ const header_config_set = struct {
768777
.{ .HAVE_UUID_UUID_H, "uuid/uuid.h" },
769778
.{ .HAVE_ZLIB_H, "zlib.h" },
770779
};
780+
pub const @"3.6" = concatConfigs(common, .{});
771781
pub const @"3.11.13" = concatConfigs(common, .{
772782
.{ .HAVE_MEMORY_H, "memory.h" },
773783
});
@@ -1202,6 +1212,7 @@ const exe_config_set = struct {
12021212
.{ .HAVE_WORKING_TZSET, "#include <time.h>\nint main(){tzset(); return 0;}" },
12031213
.{ .HAVE_ZLIB_COPY, "#include <zlib.h>\nint main(){z_stream strm; inflateCopy(&strm, &strm); return 0;}" },
12041214
};
1215+
pub const @"3.6" = concatConfigs(common, .{});
12051216
pub const @"3.11.13" = concatConfigs(common, .{
12061217
.{ .HAVE_TTYNAME, "#include <unistd.h>\nint main(){ttyname(0);}" },
12071218
.{ .HAVE_LIBGDBM_COMPAT, "#include <gdbm.h>\nint main(){GDBM_FILE gf; return 0;}" },
@@ -1369,6 +1380,7 @@ fn addPyconfig(
13691380
.HAVE_RL_COMPDISP_FUNC_T = null,
13701381
});
13711382
switch (version) {
1383+
.@"3.6" => {},
13721384
.@"3.11.13" => config_header.addValues(.{
13731385
.PY_FORMAT_SIZE_T = "z",
13741386
.TIME_WITH_SYS_TIME = 1,
@@ -1402,10 +1414,12 @@ fn addPyconfig(
14021414
}
14031415

14041416
const header_configs: []const Config = switch (version) {
1417+
.@"3.6" => &header_config_set.@"3.6",
14051418
.@"3.11.13" => &header_config_set.@"3.11.13",
14061419
.@"3.12.11" => &header_config_set.@"3.12.11",
14071420
};
14081421
const exe_configs: []const Config = switch (version) {
1422+
.@"3.6" => &exe_config_set.@"3.6",
14091423
.@"3.11.13" => &exe_config_set.@"3.11.13",
14101424
.@"3.12.11" => &exe_config_set.@"3.12.11",
14111425
};
@@ -1546,6 +1560,7 @@ const python_src = struct {
15461560
"Python/fileutils.c",
15471561
"Python/suggestions.c",
15481562
};
1563+
pub const @"3.6" = common;
15491564
pub const @"3.11.13" = common;
15501565
pub const @"3.12.11" = common ++ .{
15511566
"Python/assemble.c",
@@ -1605,6 +1620,7 @@ const object_src = struct {
16051620
"Objects/unionobject.c",
16061621
"Objects/weakrefobject.c",
16071622
};
1623+
pub const @"3.6" = common ++ .{};
16081624
pub const @"3.11.13" = common ++ .{
16091625
"Objects/accu.c",
16101626
};
@@ -1636,6 +1652,7 @@ const module_src = [_][]const u8{
16361652
};
16371653

16381654
const library_src_omit_frozen = struct {
1655+
pub const @"3.6" = parser_src ++ object_src.@"3.6" ++ python_src.@"3.6" ++ module_src;
16391656
pub const @"3.11.13" = parser_src ++ object_src.@"3.11.13" ++ python_src.@"3.11.13" ++ module_src;
16401657
pub const @"3.12.11" = parser_src ++ object_src.@"3.12.11" ++ python_src.@"3.12.11" ++ module_src;
16411658
};

build.zig.zon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
.version = "0.0.0",
55
.minimum_zig_version = "0.14.1",
66
.dependencies = .{
7+
.@"upstream_3.6" = .{
8+
.url = "git+https://github.com/python/cpython#8d999cbf4adea053be6dbb612b9844635c4dfb8e",
9+
.hash = "N-V-__8AAMED3ARJaCyFG2S5U8Dz84IoEKHP_ZLjRG-3Qe3O",
10+
.lazy = true,
11+
},
712
.@"upstream_3.11.13" = .{
813
.url = "git+https://github.com/python/cpython#498b971ea3673012a1d4b21860b229d55fc6e575",
914
.hash = "N-V-__8AACr32QWySXRzLeDQuZNoyM6FlWz3U4smc4qJ0EXe",

0 commit comments

Comments
 (0)