PyProd 0.5.0__py3-none-any.whl → 0.7.0__py3-none-any.whl

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/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.5.0"
1
+ __version__ = "0.7.0"
pyprod/main.py CHANGED
@@ -53,6 +53,15 @@ parser.add_argument(
53
53
  help="Increase verbosity level (default: 0)",
54
54
  )
55
55
 
56
+ parser.add_argument(
57
+ "-V",
58
+ "--version",
59
+ dest="version",
60
+ action="store_true",
61
+ default=0,
62
+ help="Show version",
63
+ )
64
+
56
65
 
57
66
  parser.add_argument("targets", nargs="*", help="Build targets")
58
67
 
@@ -74,6 +83,10 @@ def init_args(args=None):
74
83
 
75
84
  def main():
76
85
  args = init_args()
86
+ if args.version:
87
+ print(f"PyProd {pyprod.__version__}")
88
+ sys.exit(0)
89
+
77
90
  pyprod.verbose = args.verbose
78
91
  chdir = args.directory
79
92
  if chdir:
pyprod/prod.py CHANGED
@@ -17,7 +17,9 @@ from dataclasses import dataclass, field
17
17
  from fnmatch import fnmatch, translate
18
18
  from functools import wraps
19
19
  from pathlib import Path
20
+
20
21
  import dateutil.parser
22
+
21
23
  import pyprod
22
24
 
23
25
  from .utils import flatten, unique_list
@@ -164,7 +166,7 @@ def _check_pattern(pattern):
164
166
 
165
167
  def _check_wildcard(path):
166
168
  if "*" in path:
167
- raise RuleError(f"{path}: '*' directory is not allowed")
169
+ raise RuleError(f"{path}: '*' is not allowed")
168
170
 
169
171
 
170
172
  def _name_to_str(name):
@@ -183,6 +185,25 @@ def _name_to_str(name):
183
185
  return name
184
186
 
185
187
 
188
+ def _expand_glob(name):
189
+ if not isinstance(name, (str, Path)):
190
+ return name
191
+
192
+ if "*" not in str(name):
193
+ return name
194
+
195
+ # split path to support absolute path
196
+ p = Path(name)
197
+ parts = p.parts
198
+ for i, part in enumerate(parts):
199
+ if "*" in part:
200
+ root = Path(*parts[:i])
201
+ rest = "/".join(parts[i:])
202
+ break
203
+
204
+ return list(root.glob(rest))
205
+
206
+
186
207
  class Rule:
187
208
  def __init__(self, targets, pattern=None, depends=(), uses=(), builder=None):
188
209
  self.targets = []
@@ -216,13 +237,18 @@ class Rule:
216
237
 
217
238
  self.depends = []
218
239
  for depend in flatten(depends or ()):
240
+ if not depend:
241
+ continue
242
+
219
243
  depend = _name_to_str(depend)
220
244
  _check_pattern_count(depend)
221
- _check_wildcard(depend)
222
245
  self.depends.append(depend)
223
246
 
224
247
  self.uses = []
225
248
  for use in flatten(uses or ()):
249
+ if not use:
250
+ continue
251
+
226
252
  use = _name_to_str(use)
227
253
  _check_pattern_count(use)
228
254
  _check_wildcard(use)
@@ -346,6 +372,7 @@ class Rules:
346
372
  depends = dep.depends[:]
347
373
  uses = dep.uses[:]
348
374
 
375
+ depends = list(flatten(_expand_glob(depend) for depend in depends))
349
376
  yield depends, uses, dep
350
377
  break
351
378
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyProd
3
- Version: 0.5.0
3
+ Version: 0.7.0
4
4
  Summary: PyProd: More Makeable than Make
5
5
  Project-URL: Homepage, https://github.com/atsuoishimoto/pyprod
6
6
  Project-URL: Documentation, https://pyprod.readthedocs.io/en/latest/
@@ -0,0 +1,11 @@
1
+ pyprod/__init__.py,sha256=RaANGbRu5e-vehwXI1-Qe2ggPPfs1TQaZj072JdbLk4,22
2
+ pyprod/__main__.py,sha256=Vdhw8YA1K3wPMlbJQYL5WqvRzAKVeZ16mZQFO9VRmCo,62
3
+ pyprod/main.py,sha256=SWMmGVnVALwgENHmFfrTnYJcNyjWjw_qSO3o4aGre4E,3169
4
+ pyprod/prod.py,sha256=RY1-DPE_W5BhAXDURDeJViddCDxyZ0JVSFd40vSJOFI,20555
5
+ pyprod/utils.py,sha256=6bA06MtxvzcEArAozeJVMgCvoTT185OPEGypM1jjoG0,481
6
+ pyprod/venv.py,sha256=ZNMtHDBdC-eNFJE0-GxDlh6tlGy5Y-2m1r86SqxJJR0,1229
7
+ pyprod-0.7.0.dist-info/METADATA,sha256=mOcpnvRLrSdqN-p6U0U3EgXjX6L4dNg-w5H1XNAlPPg,2683
8
+ pyprod-0.7.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ pyprod-0.7.0.dist-info/entry_points.txt,sha256=zFycf8BYSMRDTiI0jftmcvtkf9XM4MZ4BL3JaIer_ZM,44
10
+ pyprod-0.7.0.dist-info/licenses/LICENSE,sha256=OtPgwnlLrsVEYPnTraun5AqftAT5vUv4rIan-qYj7nE,1071
11
+ pyprod-0.7.0.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- pyprod/__init__.py,sha256=LBK46heutvn3KmsCrKIYu8RQikbfnjZaj2xFrXaeCzQ,22
2
- pyprod/__main__.py,sha256=Vdhw8YA1K3wPMlbJQYL5WqvRzAKVeZ16mZQFO9VRmCo,62
3
- pyprod/main.py,sha256=O1tkuZzZ7nuoI2DjFyJlKn-2YYn-UL-jsgrxb5EvmVQ,2945
4
- pyprod/prod.py,sha256=Tdhr3cTnJv3m61157H48WNuFhvQGJ8lZuaSD6R9XspM,20000
5
- pyprod/utils.py,sha256=6bA06MtxvzcEArAozeJVMgCvoTT185OPEGypM1jjoG0,481
6
- pyprod/venv.py,sha256=ZNMtHDBdC-eNFJE0-GxDlh6tlGy5Y-2m1r86SqxJJR0,1229
7
- pyprod-0.5.0.dist-info/METADATA,sha256=q28RfZ10Oodv3EHGo9Fa1x5U42cihFb9XTV-J9uaNFc,2683
8
- pyprod-0.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
- pyprod-0.5.0.dist-info/entry_points.txt,sha256=zFycf8BYSMRDTiI0jftmcvtkf9XM4MZ4BL3JaIer_ZM,44
10
- pyprod-0.5.0.dist-info/licenses/LICENSE,sha256=OtPgwnlLrsVEYPnTraun5AqftAT5vUv4rIan-qYj7nE,1071
11
- pyprod-0.5.0.dist-info/RECORD,,
File without changes