PyProd 0.7.0__tar.gz → 0.8.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.
- {pyprod-0.7.0 → pyprod-0.8.0}/PKG-INFO +1 -1
- {pyprod-0.7.0 → pyprod-0.8.0}/docs/releasenotes.rst +6 -0
- pyprod-0.8.0/src/pyprod/__init__.py +1 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/src/pyprod/prod.py +25 -7
- {pyprod-0.7.0 → pyprod-0.8.0}/tests/test_prod.py +49 -0
- pyprod-0.7.0/src/pyprod/__init__.py +0 -1
- {pyprod-0.7.0 → pyprod-0.8.0}/.github/workflows/publish.yml +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/.github/workflows/test.yml +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/.gitignore +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/LICENSE +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/README.rst +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/docs/Makefile +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/docs/commandline.rst +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/docs/conf.py +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/docs/index.rst +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/docs/make.bat +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/docs/prodfile.rst +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/docs/pyprod2.png +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/docs/quickstart.rst +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/docs/requirements.txt +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/pyprod.webp +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/pyprod2.png +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/pyproject.toml +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/samples/build-c/Makefile +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/samples/build-c/Prodfile.py +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/samples/build-c/hello.c +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/samples/build-c/hello.h +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/samples/build-c/main.c +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/samples/generate-doc/Prodfile.py +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/samples/generate-doc/a.txt +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/samples/generate-doc/b.txt +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/samples/generate-doc/c.txt +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/samples/generate-doc/inc1.txt +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/samples/generate-doc/inc2.txt +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/samples/md-to-pdf/Prodfile.py +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/samples/md-to-pdf/doc.md +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/samples/md-to-pdf/md_to_html.py +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/samples/md-to-pdf/template.html +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/samples/s3files/Prodfile.py +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/samples/s3files/S3TEST.txt +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/samples/tutorial-1/Prodfile.py +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/samples/tutorial-2/Prodfile.py +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/src/pyprod/__main__.py +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/src/pyprod/main.py +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/src/pyprod/utils.py +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/src/pyprod/venv.py +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/tests/__init__.py +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/tests/conftest.py +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/tests/test_prodfuncs.py +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/tests/test_rule.py +0 -0
- {pyprod-0.7.0 → pyprod-0.8.0}/tests/utils.py +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "0.8.0"
|
@@ -240,8 +240,9 @@ class Rule:
|
|
240
240
|
if not depend:
|
241
241
|
continue
|
242
242
|
|
243
|
-
|
244
|
-
|
243
|
+
if not callable(depend):
|
244
|
+
depend = _name_to_str(depend)
|
245
|
+
_check_pattern_count(depend)
|
245
246
|
self.depends.append(depend)
|
246
247
|
|
247
248
|
self.uses = []
|
@@ -249,9 +250,10 @@ class Rule:
|
|
249
250
|
if not use:
|
250
251
|
continue
|
251
252
|
|
252
|
-
|
253
|
-
|
254
|
-
|
253
|
+
if not callable(use):
|
254
|
+
use = _name_to_str(use)
|
255
|
+
_check_pattern_count(use)
|
256
|
+
_check_wildcard(use)
|
255
257
|
self.uses.append(use)
|
256
258
|
|
257
259
|
self.builder = builder
|
@@ -365,9 +367,25 @@ class Rules:
|
|
365
367
|
if m:
|
366
368
|
stem = m.groupdict().get("stem", None)
|
367
369
|
|
370
|
+
depends = []
|
371
|
+
for d in dep.depends:
|
372
|
+
if callable(d):
|
373
|
+
ret = flatten([d(name, stem)], ignore_none=True)
|
374
|
+
depends.extend(ret)
|
375
|
+
else:
|
376
|
+
depends.append(d)
|
377
|
+
|
378
|
+
uses = []
|
379
|
+
for u in dep.uses:
|
380
|
+
if callable(u):
|
381
|
+
ret = flatten([u(name, stem)], ignore_none=True)
|
382
|
+
uses.extend(ret)
|
383
|
+
else:
|
384
|
+
uses.append(u)
|
385
|
+
|
368
386
|
if stem is not None:
|
369
|
-
depends = [replace_pattern(r, stem) for r in
|
370
|
-
uses = [replace_pattern(r, stem) for r in
|
387
|
+
depends = [replace_pattern(r, stem) for r in depends]
|
388
|
+
uses = [replace_pattern(r, stem) for r in uses]
|
371
389
|
else:
|
372
390
|
depends = dep.depends[:]
|
373
391
|
uses = dep.uses[:]
|
@@ -153,6 +153,55 @@ def build(target, *deps):
|
|
153
153
|
assert (tmp_path / "aaa.o").read_text() == "aaa.o-()"
|
154
154
|
|
155
155
|
|
156
|
+
@pytest.mark.asyncio
|
157
|
+
async def test_dep_callable(tmp_path):
|
158
|
+
src = """
|
159
|
+
def dep1(target, stem):
|
160
|
+
return target+".dep", stem
|
161
|
+
|
162
|
+
@rule(targets=("%.o"), depends=dep1)
|
163
|
+
def build(target, *deps):
|
164
|
+
print(">>>>>>>>>>>>>>>>>", target, deps)
|
165
|
+
assert deps == ("aaa.o.dep", "aaa")
|
166
|
+
"""
|
167
|
+
|
168
|
+
(tmp_path / "Prodfile.py").write_text(src)
|
169
|
+
(tmp_path / "aaa.o.dep").write_text("1")
|
170
|
+
(tmp_path / "aaa").write_text("2")
|
171
|
+
|
172
|
+
with chdir(tmp_path):
|
173
|
+
p = prod.Prod("Prodfile.py")
|
174
|
+
await p.start(["aaa.o"])
|
175
|
+
|
176
|
+
|
177
|
+
@pytest.mark.asyncio
|
178
|
+
async def test_uses_callable(tmp_path):
|
179
|
+
src = """
|
180
|
+
def call1(target, stem):
|
181
|
+
return "call1-name"
|
182
|
+
|
183
|
+
def call2(target, stem):
|
184
|
+
return "call2-name"
|
185
|
+
|
186
|
+
@rule(targets=("%.o"), uses=(call1, call2))
|
187
|
+
def build(target, *deps):
|
188
|
+
print(">>>>>>>>>>>>>>>>>", target, deps)
|
189
|
+
"""
|
190
|
+
|
191
|
+
(tmp_path / "Prodfile.py").write_text(src)
|
192
|
+
(tmp_path / "call1-name").write_text("1")
|
193
|
+
|
194
|
+
with chdir(tmp_path):
|
195
|
+
p = prod.Prod("Prodfile.py")
|
196
|
+
with pytest.raises(prod.NoRuleToMakeTargetError):
|
197
|
+
await p.start(["aaa.o"])
|
198
|
+
|
199
|
+
(tmp_path / "call2-name").write_text("2")
|
200
|
+
with chdir(tmp_path):
|
201
|
+
p = prod.Prod("Prodfile.py")
|
202
|
+
await p.start(["aaa.o"])
|
203
|
+
|
204
|
+
|
156
205
|
@pytest.mark.asyncio
|
157
206
|
async def test_preserve_pathobj(tmp_path):
|
158
207
|
src = """
|
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = "0.7.0"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|