PyProd 0.8.0__py3-none-any.whl → 0.10.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 +1 -1
- pyprod/main.py +51 -5
- pyprod/prod.py +10 -8
- {pyprod-0.8.0.dist-info → pyprod-0.10.0.dist-info}/METADATA +2 -1
- pyprod-0.10.0.dist-info/RECORD +11 -0
- pyprod-0.8.0.dist-info/RECORD +0 -11
- {pyprod-0.8.0.dist-info → pyprod-0.10.0.dist-info}/WHEEL +0 -0
- {pyprod-0.8.0.dist-info → pyprod-0.10.0.dist-info}/entry_points.txt +0 -0
- {pyprod-0.8.0.dist-info → pyprod-0.10.0.dist-info}/licenses/LICENSE +0 -0
pyprod/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.
|
1
|
+
__version__ = "0.10.0"
|
pyprod/main.py
CHANGED
@@ -3,8 +3,13 @@ import asyncio
|
|
3
3
|
import logging
|
4
4
|
import os
|
5
5
|
import sys
|
6
|
+
import threading
|
7
|
+
import time
|
6
8
|
from pathlib import Path
|
7
9
|
|
10
|
+
from watchdog.events import FileSystemEventHandler
|
11
|
+
from watchdog.observers import Observer
|
12
|
+
|
8
13
|
import pyprod
|
9
14
|
import pyprod.prod
|
10
15
|
|
@@ -45,6 +50,13 @@ parser.add_argument(
|
|
45
50
|
help="Get file timestamps from Git",
|
46
51
|
)
|
47
52
|
|
53
|
+
parser.add_argument(
|
54
|
+
"-w",
|
55
|
+
"--watch",
|
56
|
+
nargs="*",
|
57
|
+
help="directories to watch",
|
58
|
+
)
|
59
|
+
|
48
60
|
parser.add_argument(
|
49
61
|
"-v",
|
50
62
|
dest="verbose",
|
@@ -81,6 +93,23 @@ def init_args(args=None):
|
|
81
93
|
return args
|
82
94
|
|
83
95
|
|
96
|
+
class Handler(FileSystemEventHandler):
|
97
|
+
def __init__(self, ev):
|
98
|
+
self._ev = ev
|
99
|
+
|
100
|
+
def on_created(self, event):
|
101
|
+
print(event)
|
102
|
+
self._ev.set()
|
103
|
+
|
104
|
+
def on_modified(self, event):
|
105
|
+
print(event)
|
106
|
+
self._ev.set()
|
107
|
+
|
108
|
+
def on_deleted(self, event):
|
109
|
+
print(event)
|
110
|
+
self._ev.set()
|
111
|
+
|
112
|
+
|
84
113
|
def main():
|
85
114
|
args = init_args()
|
86
115
|
if args.version:
|
@@ -127,9 +156,29 @@ def main():
|
|
127
156
|
else:
|
128
157
|
targets.append(target)
|
129
158
|
|
159
|
+
run(mod, args.job, params, targets)
|
160
|
+
|
161
|
+
if args.watch:
|
162
|
+
ev = threading.Event()
|
163
|
+
observer = Observer()
|
164
|
+
|
165
|
+
for watch in args.watch:
|
166
|
+
d = Path(watch).absolute()
|
167
|
+
print(d)
|
168
|
+
observer.schedule(Handler(ev), str(d), recursive=True)
|
169
|
+
|
170
|
+
observer.start()
|
171
|
+
while True:
|
172
|
+
ev.wait()
|
173
|
+
time.sleep(0.1)
|
174
|
+
ev.clear()
|
175
|
+
run(mod, args.job, params, targets)
|
176
|
+
|
177
|
+
|
178
|
+
def run(mod, job, params, targets):
|
130
179
|
try:
|
131
180
|
# load module
|
132
|
-
prod = pyprod.prod.Prod(mod,
|
181
|
+
prod = pyprod.prod.Prod(mod, job, params)
|
133
182
|
# select targets
|
134
183
|
if not targets:
|
135
184
|
target = prod.get_default_target()
|
@@ -137,10 +186,7 @@ def main():
|
|
137
186
|
sys.exit("No default target")
|
138
187
|
targets = [target]
|
139
188
|
|
140
|
-
ret =
|
141
|
-
for target in targets:
|
142
|
-
ret += asyncio.run(prod.start([target]))
|
143
|
-
|
189
|
+
ret = asyncio.run(prod.start(targets))
|
144
190
|
if not ret:
|
145
191
|
print(f"Nothing to be done for {targets}")
|
146
192
|
|
pyprod/prod.py
CHANGED
@@ -575,6 +575,8 @@ class Prod:
|
|
575
575
|
self.module = self.load_pyprodfile(self.modulefile)
|
576
576
|
self.built = 0 # number of build execused
|
577
577
|
|
578
|
+
self.deps = []
|
579
|
+
|
578
580
|
def get_module_globals(self):
|
579
581
|
globals = {
|
580
582
|
"build": self.build,
|
@@ -635,7 +637,8 @@ class Prod:
|
|
635
637
|
["git", "log", "-1", "--format=%ai", "--", name], text=True
|
636
638
|
).strip()
|
637
639
|
if not ret:
|
638
|
-
|
640
|
+
logger.warning("%s did not match any file in git", name)
|
641
|
+
return self.get_file_mtime(name)
|
639
642
|
|
640
643
|
# 2025-01-17 00:05:48 +0900
|
641
644
|
return dateutil.parser.parse(ret)
|
@@ -664,11 +667,8 @@ class Prod:
|
|
664
667
|
return Exists(name, True, ret)
|
665
668
|
|
666
669
|
def build(self, *deps):
|
667
|
-
|
668
|
-
|
669
|
-
child = [_name_to_str(name) for name in flatten(elem)]
|
670
|
-
children.append(child)
|
671
|
-
self.deps[0:0] = children
|
670
|
+
if deps:
|
671
|
+
self.deps[0:0] = deps
|
672
672
|
|
673
673
|
def use_git(self, use):
|
674
674
|
self.use_git_timestamp = use
|
@@ -679,10 +679,12 @@ class Prod:
|
|
679
679
|
async def start(self, deps):
|
680
680
|
self.loop = asyncio.get_running_loop()
|
681
681
|
self.built = 0
|
682
|
-
self.deps
|
682
|
+
self.deps.append(deps)
|
683
683
|
while self.deps:
|
684
|
+
tasks = []
|
684
685
|
dep = self.deps.pop(0)
|
685
|
-
|
686
|
+
tasks.append(self.schedule([dep]))
|
687
|
+
await asyncio.gather(*tasks)
|
686
688
|
|
687
689
|
return self.built
|
688
690
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: PyProd
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.10.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/
|
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3
|
|
13
13
|
Classifier: Topic :: Software Development :: Build Tools
|
14
14
|
Requires-Python: >=3.10
|
15
15
|
Requires-Dist: python-dateutil
|
16
|
+
Requires-Dist: watchdog>=6.0.0
|
16
17
|
Description-Content-Type: text/x-rst
|
17
18
|
|
18
19
|
PyProd - More Makeable than Make
|
@@ -0,0 +1,11 @@
|
|
1
|
+
pyprod/__init__.py,sha256=v4zmKjsKOPZbp6BrWoz7iK4ST0sdZdUh9bQSJmluZ5o,23
|
2
|
+
pyprod/__main__.py,sha256=Vdhw8YA1K3wPMlbJQYL5WqvRzAKVeZ16mZQFO9VRmCo,62
|
3
|
+
pyprod/main.py,sha256=jykm2yxqem9RV-eTdWrk03cXLGaS1OTFaeyw_DmTbZk,4141
|
4
|
+
pyprod/prod.py,sha256=_FGLJlDB2zVgsGgJ13VdXvoK0bpdkfdHwfvePf0Db9Q,21263
|
5
|
+
pyprod/utils.py,sha256=6bA06MtxvzcEArAozeJVMgCvoTT185OPEGypM1jjoG0,481
|
6
|
+
pyprod/venv.py,sha256=ZNMtHDBdC-eNFJE0-GxDlh6tlGy5Y-2m1r86SqxJJR0,1229
|
7
|
+
pyprod-0.10.0.dist-info/METADATA,sha256=SlnUNgvOd2Iw75g5ilKj-8Y-An2V9EoffOqcae6ZdBA,2715
|
8
|
+
pyprod-0.10.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
9
|
+
pyprod-0.10.0.dist-info/entry_points.txt,sha256=zFycf8BYSMRDTiI0jftmcvtkf9XM4MZ4BL3JaIer_ZM,44
|
10
|
+
pyprod-0.10.0.dist-info/licenses/LICENSE,sha256=OtPgwnlLrsVEYPnTraun5AqftAT5vUv4rIan-qYj7nE,1071
|
11
|
+
pyprod-0.10.0.dist-info/RECORD,,
|
pyprod-0.8.0.dist-info/RECORD
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
pyprod/__init__.py,sha256=iPlYCcIzuzW7T2HKDkmYlMkRI51dBLfNRxPPiWrfw9U,22
|
2
|
-
pyprod/__main__.py,sha256=Vdhw8YA1K3wPMlbJQYL5WqvRzAKVeZ16mZQFO9VRmCo,62
|
3
|
-
pyprod/main.py,sha256=SWMmGVnVALwgENHmFfrTnYJcNyjWjw_qSO3o4aGre4E,3169
|
4
|
-
pyprod/prod.py,sha256=L6_mI2E09i7JVoeSsT-uDi9IijcADxsA_Ui064WqHB4,21260
|
5
|
-
pyprod/utils.py,sha256=6bA06MtxvzcEArAozeJVMgCvoTT185OPEGypM1jjoG0,481
|
6
|
-
pyprod/venv.py,sha256=ZNMtHDBdC-eNFJE0-GxDlh6tlGy5Y-2m1r86SqxJJR0,1229
|
7
|
-
pyprod-0.8.0.dist-info/METADATA,sha256=9kzbZ6ZuRrCZwBJW91_D2YXwwg5nOR6tDTdrvUMgGpw,2683
|
8
|
-
pyprod-0.8.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
9
|
-
pyprod-0.8.0.dist-info/entry_points.txt,sha256=zFycf8BYSMRDTiI0jftmcvtkf9XM4MZ4BL3JaIer_ZM,44
|
10
|
-
pyprod-0.8.0.dist-info/licenses/LICENSE,sha256=OtPgwnlLrsVEYPnTraun5AqftAT5vUv4rIan-qYj7nE,1071
|
11
|
-
pyprod-0.8.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|