setuptools-zig-build 0.2.2__tar.gz → 0.3.0__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.
- {setuptools_zig_build-0.2.2/setuptools_zig_build.egg-info → setuptools_zig_build-0.3.0}/PKG-INFO +3 -3
- {setuptools_zig_build-0.2.2 → setuptools_zig_build-0.3.0}/README.md +2 -2
- {setuptools_zig_build-0.2.2 → setuptools_zig_build-0.3.0}/setup.py +1 -1
- {setuptools_zig_build-0.2.2 → setuptools_zig_build-0.3.0/setuptools_zig_build.egg-info}/PKG-INFO +3 -3
- {setuptools_zig_build-0.2.2 → setuptools_zig_build-0.3.0}/setuptools_zig_build.py +48 -28
- {setuptools_zig_build-0.2.2 → setuptools_zig_build-0.3.0}/LICENSE +0 -0
- {setuptools_zig_build-0.2.2 → setuptools_zig_build-0.3.0}/setup.cfg +0 -0
- {setuptools_zig_build-0.2.2 → setuptools_zig_build-0.3.0}/setuptools_zig_build.egg-info/SOURCES.txt +0 -0
- {setuptools_zig_build-0.2.2 → setuptools_zig_build-0.3.0}/setuptools_zig_build.egg-info/dependency_links.txt +0 -0
- {setuptools_zig_build-0.2.2 → setuptools_zig_build-0.3.0}/setuptools_zig_build.egg-info/entry_points.txt +0 -0
- {setuptools_zig_build-0.2.2 → setuptools_zig_build-0.3.0}/setuptools_zig_build.egg-info/top_level.txt +0 -0
{setuptools_zig_build-0.2.2/setuptools_zig_build.egg-info → setuptools_zig_build-0.3.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: setuptools_zig_build
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: A setuptools extension, for building cpython extensions with zig build
|
|
5
5
|
Home-page: https://codeberg.org/dasimmet/setuptools-zig-build
|
|
6
6
|
Author-email: dasimmet@gmail.com
|
|
@@ -54,7 +54,7 @@ setup(
|
|
|
54
54
|
# stores zig's depdendency pacakges in python's sdist. This requires a call to
|
|
55
55
|
# CPython.addSdistList(b); in `build.zig`
|
|
56
56
|
# If set to False, potential dependencies will be downloaded by zig instead.
|
|
57
|
-
"
|
|
57
|
+
"sdist_args": ["sdistlist"],
|
|
58
58
|
# tries to import 'ziglang' to get a zig compiler when building wheel
|
|
59
59
|
"use_ziglang_python_package": True,
|
|
60
60
|
# passes -Doptimize= to zig build
|
|
@@ -62,7 +62,7 @@ setup(
|
|
|
62
62
|
# passes -Dversion=<pip package version> to zig build
|
|
63
63
|
"pass_version_option": True,
|
|
64
64
|
# extra arguments to zig build. In this case we pass the `install` and `test` steps
|
|
65
|
-
'
|
|
65
|
+
'build_args': [
|
|
66
66
|
"install", "test",
|
|
67
67
|
],
|
|
68
68
|
},
|
|
@@ -24,7 +24,7 @@ setup(
|
|
|
24
24
|
# stores zig's depdendency pacakges in python's sdist. This requires a call to
|
|
25
25
|
# CPython.addSdistList(b); in `build.zig`
|
|
26
26
|
# If set to False, potential dependencies will be downloaded by zig instead.
|
|
27
|
-
"
|
|
27
|
+
"sdist_args": ["sdistlist"],
|
|
28
28
|
# tries to import 'ziglang' to get a zig compiler when building wheel
|
|
29
29
|
"use_ziglang_python_package": True,
|
|
30
30
|
# passes -Doptimize= to zig build
|
|
@@ -32,7 +32,7 @@ setup(
|
|
|
32
32
|
# passes -Dversion=<pip package version> to zig build
|
|
33
33
|
"pass_version_option": True,
|
|
34
34
|
# extra arguments to zig build. In this case we pass the `install` and `test` steps
|
|
35
|
-
'
|
|
35
|
+
'build_args': [
|
|
36
36
|
"install", "test",
|
|
37
37
|
],
|
|
38
38
|
},
|
|
@@ -2,7 +2,7 @@ from setuptools import setup
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='setuptools_zig_build',
|
|
5
|
-
version="0.
|
|
5
|
+
version="0.3.0",
|
|
6
6
|
author_email='dasimmet@gmail.com',
|
|
7
7
|
description='A setuptools extension, for building cpython extensions with zig build',
|
|
8
8
|
long_description=open("README.md").read(),
|
{setuptools_zig_build-0.2.2 → setuptools_zig_build-0.3.0/setuptools_zig_build.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: setuptools_zig_build
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: A setuptools extension, for building cpython extensions with zig build
|
|
5
5
|
Home-page: https://codeberg.org/dasimmet/setuptools-zig-build
|
|
6
6
|
Author-email: dasimmet@gmail.com
|
|
@@ -54,7 +54,7 @@ setup(
|
|
|
54
54
|
# stores zig's depdendency pacakges in python's sdist. This requires a call to
|
|
55
55
|
# CPython.addSdistList(b); in `build.zig`
|
|
56
56
|
# If set to False, potential dependencies will be downloaded by zig instead.
|
|
57
|
-
"
|
|
57
|
+
"sdist_args": ["sdistlist"],
|
|
58
58
|
# tries to import 'ziglang' to get a zig compiler when building wheel
|
|
59
59
|
"use_ziglang_python_package": True,
|
|
60
60
|
# passes -Doptimize= to zig build
|
|
@@ -62,7 +62,7 @@ setup(
|
|
|
62
62
|
# passes -Dversion=<pip package version> to zig build
|
|
63
63
|
"pass_version_option": True,
|
|
64
64
|
# extra arguments to zig build. In this case we pass the `install` and `test` steps
|
|
65
|
-
'
|
|
65
|
+
'build_args': [
|
|
66
66
|
"install", "test",
|
|
67
67
|
],
|
|
68
68
|
},
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import sys
|
|
4
4
|
import os
|
|
5
|
-
from subprocess import run
|
|
6
5
|
from pathlib import Path
|
|
7
6
|
import shlex
|
|
8
7
|
|
|
@@ -29,22 +28,30 @@ class ZigBuild:
|
|
|
29
28
|
use_ziglang_python_package: bool = False,
|
|
30
29
|
optimize: str = "ReleaseSafe",
|
|
31
30
|
pass_version_option: bool = False,
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
sdist_args: list = None,
|
|
32
|
+
build_args: list = [],
|
|
34
33
|
):
|
|
34
|
+
|
|
35
35
|
assert isinstance(use_ziglang_python_package, bool)
|
|
36
36
|
self.use_ziglang_python_package = use_ziglang_python_package
|
|
37
|
+
|
|
37
38
|
assert optimize == None or (isinstance(
|
|
38
39
|
optimize, str) and optimize in self.OPTIMIZE)
|
|
39
40
|
self.optimize = optimize
|
|
41
|
+
|
|
40
42
|
assert isinstance(pass_version_option, bool)
|
|
41
43
|
self.pass_version_option = pass_version_option
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
|
|
45
|
+
if sdist_args != None:
|
|
46
|
+
assert isinstance(sdist_args, list)
|
|
47
|
+
for arg in sdist_args:
|
|
48
|
+
assert isinstance(arg, str)
|
|
49
|
+
self.sdist_args = sdist_args
|
|
50
|
+
|
|
51
|
+
assert isinstance(build_args, list)
|
|
52
|
+
for arg in build_args:
|
|
44
53
|
assert isinstance(arg, str)
|
|
45
|
-
self.
|
|
46
|
-
assert isinstance(sdist, bool)
|
|
47
|
-
self.sdist = sdist
|
|
54
|
+
self.build_args = build_args
|
|
48
55
|
|
|
49
56
|
|
|
50
57
|
class BuildExt(SetupToolsBuildExt):
|
|
@@ -55,7 +62,6 @@ class BuildExt(SetupToolsBuildExt):
|
|
|
55
62
|
self._zig_value = zig_value
|
|
56
63
|
else:
|
|
57
64
|
raise ZigCompilerError('unknown type:', zig_value)
|
|
58
|
-
|
|
59
65
|
super().__init__(dist)
|
|
60
66
|
|
|
61
67
|
def build_extension(self, ext):
|
|
@@ -93,21 +99,21 @@ class BuildExt(SetupToolsBuildExt):
|
|
|
93
99
|
bld_cmd.append(
|
|
94
100
|
'-Dversion={}'.format(self.distribution.get_version()))
|
|
95
101
|
|
|
96
|
-
bld_cmd.extend(self._zig_value.
|
|
102
|
+
bld_cmd.extend(self._zig_value.build_args)
|
|
97
103
|
|
|
98
|
-
if self._zig_value.
|
|
104
|
+
if self._zig_value.sdist_args != None:
|
|
99
105
|
if os.path.isdir(".zig-dependencies"):
|
|
100
106
|
for it in os.listdir(".zig-dependencies"):
|
|
101
107
|
dep_dir = os.path.join(".zig-dependencies", it)
|
|
102
108
|
if os.path.isdir(".zig-dependencies"):
|
|
103
109
|
fetch_cmd = [zig_exe, "fetch", dep_dir]
|
|
104
110
|
print("cmd: {}".format(shlex.join(fetch_cmd)))
|
|
105
|
-
|
|
111
|
+
self.spawn(fetch_cmd)
|
|
106
112
|
|
|
107
113
|
os.makedirs(self.build_temp, exist_ok=True)
|
|
108
114
|
print('\ncmd', shlex.join(bld_cmd))
|
|
109
115
|
sys.stdout.flush()
|
|
110
|
-
|
|
116
|
+
self.spawn(bld_cmd)
|
|
111
117
|
|
|
112
118
|
output = None
|
|
113
119
|
for subpath in ['', 'lib', 'bin/', 'lib/', 'bin/lib', 'lib/lib']:
|
|
@@ -131,14 +137,29 @@ class BuildExt(SetupToolsBuildExt):
|
|
|
131
137
|
|
|
132
138
|
|
|
133
139
|
class Sdist(SetupToolsSdist):
|
|
140
|
+
def __init__(self, dist, zig_value):
|
|
141
|
+
if isinstance(zig_value, dict):
|
|
142
|
+
self._zig_value = ZigBuild(**zig_value)
|
|
143
|
+
elif isinstance(zig_value, ZigBuild):
|
|
144
|
+
self._zig_value = zig_value
|
|
145
|
+
else:
|
|
146
|
+
raise ZigCompilerError('unknown type:', zig_value)
|
|
147
|
+
super().__init__(dist)
|
|
148
|
+
|
|
134
149
|
def make_release_tree(self, base_dir, files) -> None:
|
|
150
|
+
if self._zig_value.sdist_args != None:
|
|
151
|
+
self.make_zig_sdist(base_dir, files)
|
|
152
|
+
super().make_release_tree(base_dir, files)
|
|
153
|
+
if self._zig_value.sdist_args != None:
|
|
154
|
+
files.extend(self.zig_dep_sources)
|
|
155
|
+
|
|
156
|
+
def make_zig_sdist(self, base_dir, files):
|
|
135
157
|
import os
|
|
136
158
|
import json
|
|
137
159
|
self.zig_dep_sources = []
|
|
138
160
|
|
|
139
161
|
sdistlist_name = os.path.join(base_dir, 'sdistlist.json')
|
|
140
162
|
|
|
141
|
-
from subprocess import run
|
|
142
163
|
zig_exe = "zig"
|
|
143
164
|
try:
|
|
144
165
|
import ziglang
|
|
@@ -147,9 +168,11 @@ class Sdist(SetupToolsSdist):
|
|
|
147
168
|
except:
|
|
148
169
|
pass
|
|
149
170
|
|
|
150
|
-
cmd = [zig_exe, "build",
|
|
151
|
-
|
|
152
|
-
|
|
171
|
+
cmd = [zig_exe, "build", '--prefix', base_dir]
|
|
172
|
+
cmd.extend(self._zig_value.sdist_args)
|
|
173
|
+
|
|
174
|
+
print("cmd:", shlex.join(cmd))
|
|
175
|
+
self.spawn(cmd)
|
|
153
176
|
import shutil
|
|
154
177
|
|
|
155
178
|
with open(sdistlist_name) as fd:
|
|
@@ -176,24 +199,21 @@ class Sdist(SetupToolsSdist):
|
|
|
176
199
|
shutil.copyfile(source_file, dest_file)
|
|
177
200
|
self.zig_dep_sources.append(rel_file)
|
|
178
201
|
|
|
179
|
-
super().make_release_tree(base_dir, files)
|
|
180
|
-
files.extend(self.zig_dep_sources)
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
class ZigBuildExtension:
|
|
184
|
-
def __init__(self, value):
|
|
185
|
-
self._value = value
|
|
186
202
|
|
|
187
|
-
|
|
188
|
-
|
|
203
|
+
def class_wrapper(base_cls, cls, value):
|
|
204
|
+
class ZigBuildClassWrapper(base_cls):
|
|
205
|
+
def __new__(base_cls, dist):
|
|
206
|
+
return cls(dist, zig_value=value)
|
|
207
|
+
return ZigBuildClassWrapper
|
|
189
208
|
|
|
190
209
|
|
|
191
210
|
def setup_zig_build(dist, keyword, value):
|
|
192
211
|
'''our hook into setuptools '''
|
|
193
212
|
assert isinstance(dist, Distribution)
|
|
194
213
|
assert keyword == 'zig_build'
|
|
214
|
+
v = ZigBuild(**value)
|
|
195
215
|
dist.cmdclass.get('build_ext')
|
|
196
|
-
dist.cmdclass['build_ext'] =
|
|
216
|
+
dist.cmdclass['build_ext'] = class_wrapper(SetupToolsBuildExt, BuildExt, v)
|
|
197
217
|
if 'sdist' in value and value['sdist'] == True:
|
|
198
218
|
dist.cmdclass.get('sdist')
|
|
199
|
-
dist.cmdclass['sdist'] = Sdist
|
|
219
|
+
dist.cmdclass['sdist'] = class_wrapper(SetupToolsSdist, Sdist, v)
|
|
File without changes
|
|
File without changes
|
{setuptools_zig_build-0.2.2 → setuptools_zig_build-0.3.0}/setuptools_zig_build.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|