zig-zon 0.2.0__tar.gz → 0.2.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.
@@ -1,7 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zig-zon
3
- Version: 0.2.0
4
- Summary:
3
+ Version: 0.2.1
4
+ Summary: a native cpython extension to parse zig object notation strings
5
+ Author-email: Tobias Simetsreiter <dasimmet@gmail.com>
6
+ Maintainer-email: Tobias Simetsreiter <dasimmet@gmail.com>
7
+ License-Expression: MIT
8
+ Keywords: zig,ziglang,cpython,native,sdist,zon
9
+ Requires-Python: >=3.8
10
+ Project-URL: Homepage, https://codeberg.org/dasimmet/python-zig-zon
11
+ Project-URL: Issues, https://codeberg.org/dasimmet/python-zig-zon/issues
12
+ Classifier: Development Status :: 4 - Beta
5
13
  Description-Content-Type: text/markdown
6
14
 
7
15
  # Python Zig Zon Parser
@@ -37,7 +37,21 @@ pub fn build(b: *Build) void {
37
37
  .name = "zig-zon",
38
38
  .version = zon.version,
39
39
  .description = b.path("README.md"),
40
- .build_args = &.{ ext_install_step.name, b.fmt("-Doptimize={s}", .{@tagName(optimize)}) },
40
+ .build = .{
41
+ .args = &.{ ext_install_step.name, b.fmt("-Doptimize={s}", .{@tagName(optimize)}) },
42
+ },
43
+ .extra_pkg_info = &.{
44
+ .{ .key = "Summary", .value = "a native cpython extension to parse zig object notation strings" },
45
+ .{ .key = "Author-email", .value = "Tobias Simetsreiter <dasimmet@gmail.com>" },
46
+ .{ .key = "Maintainer-email", .value = "Tobias Simetsreiter <dasimmet@gmail.com>" },
47
+ .{ .key = "License-Expression", .value = "MIT" },
48
+ .{ .key = "Keywords", .value = "zig,ziglang,cpython,native,sdist,zon" },
49
+ .{ .key = "Requires-Python", .value = ">=3.8" },
50
+ .{ .key = "Project-URL", .value = "Homepage, https://codeberg.org/dasimmet/python-zig-zon" },
51
+ .{ .key = "Project-URL", .value = "Issues, https://codeberg.org/dasimmet/python-zig-zon/issues" },
52
+ // .{ .key = "Requires-Python", .value = ">=3.8" },
53
+ .{ .key = "Classifier", .value = "Development Status :: 4 - Beta" },
54
+ },
41
55
  .files = &.{
42
56
  .{ .src = b.path("build.zig.zon"), .dest = "build.zig.zon" },
43
57
  .{ .src = b.path("build.zig"), .dest = "build.zig" },
@@ -1,12 +1,12 @@
1
1
  .{
2
2
  .name = .python_zig_zon,
3
3
  .fingerprint = 0x3d332656a3644fc9,
4
- .version = "0.2.0",
4
+ .version = "0.2.1",
5
5
  .minimum_zig_version = "0.16.0",
6
6
  .dependencies = .{
7
7
  .zig_python_sdist = .{
8
- .url = "git+https://codeberg.org/dasimmet/zig-python-sdist.git#509be1fcce025754c7bc6f0647802e79e195778b",
9
- .hash = "zig_python_sdist-0.0.1-wjgdOo-NAAAH7qc0ulwksgbdgfrZ8bP4EhMw_ZRN1UtS",
8
+ .url = "git+https://codeberg.org/dasimmet/zig-python-sdist.git#d3b3de8f114f891e0d62c923441bb925eb8014ae",
9
+ .hash = "zig_python_sdist-0.0.1-wjgdOg-SAACQzg1tSdozTV7Tg11rIzVRDlx-8XIzOFee",
10
10
  },
11
11
  },
12
12
  .paths = .{
@@ -59,5 +59,5 @@ setup(
59
59
  "setuptools",
60
60
  "wheel",
61
61
  "ziglang==" + mkversion(setup_json['zig_version'], need_release=True),
62
- ],
62
+ ] + setup_json['build']['requires'],
63
63
  )
@@ -1 +1 @@
1
- {"name":"zig_zon","version":{"major":0,"minor":2,"patch":0,"pre":null,"build":null},"zig_version":{"major":0,"minor":16,"patch":0,"pre":null,"build":null},"build":{"args":["pyext","-Doptimize=Debug","--fork=zig-pkg/zig_python_sdist"]}}
1
+ {"name":"zig_zon","version":{"major":0,"minor":2,"patch":1,"pre":null,"build":null},"zig_version":{"major":0,"minor":16,"patch":0,"pre":null,"build":null},"build":{"args":["pyext","-Doptimize=Debug","--fork=zig-pkg/zig_python_sdist"],"requires":[]}}
@@ -49,7 +49,20 @@ pub fn build(b: *Build) void {
49
49
  .name = "zig-python-sdist-dummy",
50
50
  .version = zon.version,
51
51
  .description = b.path("README.md"),
52
- .build_args = &.{build_ext_step.name}, // target name for pip zig build command
52
+ .build = .{
53
+ .args = &.{build_ext_step.name},
54
+ },
55
+ .extra_pkg_info = &.{
56
+ .{ .key = "Summary", .value = "Just a Test" },
57
+ .{ .key = "Author-email", .value = "Tobias Simetsreiter <dasimmet@gmail.com>" },
58
+ .{ .key = "Maintainer-email", .value = "Tobias Simetsreiter <dasimmet@gmail.com>" },
59
+ .{ .key = "License-Expression", .value = "MIT" },
60
+ .{ .key = "Keywords", .value = "zig,ziglang,cpython,native,sdist" },
61
+ .{ .key = "Requires-Python", .value = ">=3.8" },
62
+ .{ .key = "Project-URL", .value = "Homepage, https://codeberg.org/dasimmet/zig-python-sdist" },
63
+ .{ .key = "Project-URL", .value = "Issues, https://codeberg.org/dasimmet/zig-python-sdist/issues" },
64
+ .{ .key = "Classifier", .value = "Development Status :: 4 - Beta" },
65
+ },
53
66
  .files = &.{
54
67
  .{ .src = b.path("build.zig.zon"), .dest = "build.zig.zon" },
55
68
  .{ .src = b.path("build.zig"), .dest = "build.zig" },
@@ -124,11 +137,11 @@ pub fn create(b: *Build, options: SDistStep.Options) *SDistStep {
124
137
  var args: std.ArrayList([]const u8) = .empty;
125
138
  args.ensureTotalCapacity(
126
139
  b.allocator,
127
- opt.build_args.len + 1,
140
+ opt.build.args.len + 1,
128
141
  ) catch @panic("OOM");
129
- args.appendSliceAssumeCapacity(opt.build_args);
142
+ args.appendSliceAssumeCapacity(opt.build.args);
130
143
  args.appendAssumeCapacity("--fork=zig-pkg/zig_python_sdist");
131
- opt.build_args = args.toOwnedSlice(b.allocator) catch @panic("OOM");
144
+ opt.build.args = args.toOwnedSlice(b.allocator) catch @panic("OOM");
132
145
  }
133
146
 
134
147
  return SDistStep.createInternal(b, opt);
@@ -2,6 +2,7 @@ const std = @import("std");
2
2
  const Build = std.Build;
3
3
  const LazyPath = Build.LazyPath;
4
4
  const LowerDashStringFormatter = @import("LowerDashStringFormatter.zig");
5
+ const PkgInfo = @import("pkg_info.zig");
5
6
 
6
7
  const SDistStep = @This();
7
8
 
@@ -17,7 +18,11 @@ pub const Options = struct {
17
18
  version: []const u8,
18
19
  description: ?LazyPath = null,
19
20
  files: []const Content = &.{},
20
- build_args: []const []const u8 = &.{},
21
+ build: struct {
22
+ args: []const []const u8 = &.{},
23
+ requires: []const []const u8 = &.{},
24
+ } = .{},
25
+ extra_pkg_info: []const PkgInfo.Header = &.{},
21
26
  directories: []const Content = &.{},
22
27
  sdist_builder: ?*Build.Step.Compile = null,
23
28
  // the version of the ziglang python package to depend on.
@@ -60,9 +65,18 @@ pub fn createInternal(b: *Build, options: Options) *SDistStep {
60
65
  run.addPrefixedDirectoryArg("--dir=", content.src);
61
66
  run.addArg(content.dest);
62
67
  }
63
- for (options.build_args) |ba| {
68
+ for (options.build.args) |ba| {
64
69
  run.addArg(b.fmt("--build={s}", .{ba}));
65
70
  }
71
+ for (options.build.requires) |br| {
72
+ run.addArg(b.fmt("--build-requires={s}", .{br}));
73
+ }
74
+ if (options.extra_pkg_info.len > 0) {
75
+ const extra_info = std.fmt.allocPrint(b.allocator, "--extra-pkg-info={f}", .{
76
+ std.json.fmt(options.extra_pkg_info, .{ .whitespace = .minified }),
77
+ }) catch @panic("OOM");
78
+ run.addArg(extra_info);
79
+ }
66
80
 
67
81
  self.* = .{
68
82
  .basename = basename,
@@ -0,0 +1,51 @@
1
+ /// Representation of pythons sdist's PKG_INFO file
2
+ ///
3
+ const std = @import("std");
4
+ const PkgInfo = @This();
5
+ pub const empty: PkgInfo = .{
6
+ .headers = .empty,
7
+ .description = .empty,
8
+ };
9
+
10
+ headers: std.ArrayList(Header),
11
+ description: std.ArrayList(u8),
12
+
13
+ pub const Header = struct {
14
+ key: []const u8,
15
+ value: []const u8,
16
+ };
17
+
18
+ pub fn format(self: @This(), w: *std.Io.Writer) !void {
19
+ for (self.headers.items) |h| {
20
+ if (std.mem.containsAtLeast(u8, h.key, 1, "\n")) {
21
+ std.log.err("newlines are not allowed in pkg-info header keys: {s}", .{h.key});
22
+ return error.WriteFailed;
23
+ }
24
+ if (std.mem.containsAtLeast(u8, h.value, 1, "\n")) {
25
+ std.log.err("newlines are not allowed in pkg-info headers values: {s}", .{h.value});
26
+ return error.WriteFailed;
27
+ }
28
+ try w.print("{s}: {s}\n", .{ h.key, h.value });
29
+ }
30
+ try w.writeAll("\n");
31
+ try w.writeAll(self.description.items);
32
+ }
33
+
34
+ // Metadata-Version: 2.4
35
+ // Name: zig-zon
36
+ // Version: 0.1.3
37
+ // Summary: a native cpython extension to parse zig object notation strings
38
+ // Author-email: Tobias Simetsreiter <dasimmet@gmail.com>
39
+ // Maintainer-email: Tobias Simetsreiter <dasimmet@gmail.com>
40
+ // License-Expression: MIT
41
+ // Project-URL: Homepage, https://codeberg.org/dasimmet/python-zig-zon
42
+ // Project-URL: Issues, https://codeberg.org/dasimmet/python-zig-zon/issues
43
+ // Keywords: zig,ziglang,zon,cpython
44
+ // Classifier: Development Status :: 4 - Beta
45
+ // Classifier: Intended Audience :: Developers
46
+ // Classifier: Programming Language :: Python :: 3
47
+ // Classifier: Programming Language :: Python :: 3.9
48
+ // Requires-Python: >=3.9
49
+ // Description-Content-Type: text/markdown
50
+ // License-File: LICENSE
51
+ // Dynamic: license-file
File without changes