pybuildtools 0.7.0__tar.gz → 0.7.2__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.
Files changed (74) hide show
  1. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/PKG-INFO +9 -8
  2. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/maestro/__init__.py +129 -58
  3. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/maestro/base_target.py +2 -2
  4. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/maestro/nuitka.py +12 -15
  5. pybuildtools-0.7.2/buildtools/maestro/web.py +770 -0
  6. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/utils.py +21 -13
  7. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/pyproject.toml +15 -15
  8. pybuildtools-0.7.0/buildtools/maestro/web.py +0 -591
  9. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/LICENSE +0 -0
  10. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/README.md +0 -0
  11. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/__init__.py +0 -0
  12. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/_os_utils_linux.py +0 -0
  13. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/_os_utils_win32.py +0 -0
  14. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/as3.py +0 -0
  15. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/bt_logging.py +0 -0
  16. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/buildsystem/CCompiler.py +0 -0
  17. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/buildsystem/__init__.py +0 -0
  18. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/buildsystem/baseproject.py +0 -0
  19. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/buildsystem/gcc.py +0 -0
  20. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/buildsystem/msbuild.py +0 -0
  21. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/buildsystem/prebuild.py +0 -0
  22. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/buildsystem/visualstudio.py +0 -0
  23. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/cli/__init__.py +0 -0
  24. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/cli/nuitka_plus/README.md +0 -0
  25. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/cli/nuitka_plus/__init__.py +0 -0
  26. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/cli/nuitka_plus/__main__.py +0 -0
  27. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/cli.py +0 -0
  28. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/config.py +0 -0
  29. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/consts.py +0 -0
  30. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/error.py +0 -0
  31. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/ext/__init__.py +0 -0
  32. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/ext/salt/__init__.py +0 -0
  33. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/ext/salt/jinja_ext.py +0 -0
  34. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/http.py +0 -0
  35. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/indentation.py +0 -0
  36. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/lxml_utils.py +0 -0
  37. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/maestro/coffeescript.py +0 -0
  38. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/maestro/convert_data.py +0 -0
  39. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/maestro/docs.py +0 -0
  40. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/maestro/enumwriters/__init__.py +0 -0
  41. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/maestro/enumwriters/coffee.py +0 -0
  42. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/maestro/enumwriters/enumwriter.py +0 -0
  43. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/maestro/enumwriters/php.py +0 -0
  44. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/maestro/enumwriters/python.py +0 -0
  45. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/maestro/enumwriters/types.py +0 -0
  46. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/maestro/fileio.py +0 -0
  47. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/maestro/genenum.py +0 -0
  48. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/maestro/git.py +0 -0
  49. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/maestro/jinja2.py +0 -0
  50. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/maestro/package_managers.py +0 -0
  51. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/maestro/shell.py +0 -0
  52. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/maestro/utils.py +0 -0
  53. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/os_utils.py +0 -0
  54. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/paths.py +0 -0
  55. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/posix/__init__.py +0 -0
  56. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/posix/elf.py +0 -0
  57. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/pygit2_callbacks.py +0 -0
  58. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/qconfig5.py +0 -0
  59. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/repo/__init__.py +0 -0
  60. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/repo/base.py +0 -0
  61. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/repo/git.py +0 -0
  62. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/repo/hg.py +0 -0
  63. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/timing.py +0 -0
  64. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/twisted_utils.py +0 -0
  65. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/types.py +0 -0
  66. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/wrapper/__init__.py +0 -0
  67. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/wrapper/ant.py +0 -0
  68. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/wrapper/ccache.py +0 -0
  69. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/wrapper/cmake.py +0 -0
  70. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/wrapper/cotire.py +0 -0
  71. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/wrapper/distcc.py +0 -0
  72. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/wrapper/fpm.py +0 -0
  73. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/wrapper/git.py +0 -0
  74. {pybuildtools-0.7.0 → pybuildtools-0.7.2}/buildtools/wrapper/repo/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pybuildtools
3
- Version: 0.7.0
3
+ Version: 0.7.2
4
4
  Summary: A set of tools for putting together buildscripts and other CLI applications
5
5
  Home-page: https://gitlab.com/N3X15/python-build-tools
6
6
  License: MIT
@@ -12,23 +12,24 @@ Classifier: Programming Language :: Python :: 3
12
12
  Classifier: Programming Language :: Python :: 3.9
13
13
  Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
15
16
  Provides-Extra: all
16
17
  Provides-Extra: pyqt5
17
18
  Provides-Extra: twisted
18
19
  Requires-Dist: Jinja2 (==3.1.2)
19
20
  Requires-Dist: MarkupSafe (>=2.1.5,<3.0.0)
20
- Requires-Dist: PyQt5 (>=5.15.10,<6.0.0) ; extra == "pyqt5" or extra == "all"
21
- Requires-Dist: Twisted (>=23.10.0,<24.0.0) ; extra == "twisted" or extra == "all"
21
+ Requires-Dist: PyQt5 (>=5.15.11,<6.0.0) ; extra == "pyqt5" or extra == "all"
22
+ Requires-Dist: Twisted (>=24.3.0,<25.0.0) ; extra == "twisted" or extra == "all"
22
23
  Requires-Dist: colorama (>=0.4.6,<0.5.0)
23
- Requires-Dist: lxml (>=5.1.0,<6.0.0)
24
- Requires-Dist: psutil (>=5.9.8,<6.0.0)
25
- Requires-Dist: pygit2 (>=1.14.1,<2.0.0)
26
- Requires-Dist: requests (>=2.31.0,<3.0.0)
24
+ Requires-Dist: lxml (>=5.2.2,<6.0.0)
25
+ Requires-Dist: psutil (>=6.0.0,<7.0.0)
26
+ Requires-Dist: pygit2 (>=1.15.1,<2.0.0)
27
+ Requires-Dist: requests (>=2.32.3,<3.0.0)
27
28
  Requires-Dist: ruamel.yaml (>=0.18.6,<0.19.0)
28
29
  Requires-Dist: six (>=1.16.0,<2.0.0)
29
30
  Requires-Dist: subprocess-tee (>=0.4.1,<0.5.0)
30
31
  Requires-Dist: toml (>=0.10.2,<0.11.0)
31
- Requires-Dist: tqdm (>=4.66.2,<5.0.0)
32
+ Requires-Dist: tqdm (>=4.66.5,<5.0.0)
32
33
  Project-URL: Repository, https://gitlab.com/N3X15/python-build-tools.git
33
34
  Description-Content-Type: text/markdown
34
35
 
@@ -1,4 +1,4 @@
1
- '''
1
+ """
2
2
  Maestro is my crappy, synchronous, yet extensible build system
3
3
 
4
4
  Copyright (c) 2015 - 2024 Rob "N3X15" Nelson <nexisentertainment@gmail.com>
@@ -20,16 +20,17 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
20
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
21
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  SOFTWARE.
23
- '''
23
+ """
24
24
 
25
25
  import argparse
26
26
  import codecs
27
27
  import logging
28
28
  import os
29
+ from pathlib import Path
29
30
  import shutil
30
31
  import sys
31
32
  import traceback
32
- from typing import Dict, List, Optional
33
+ from typing import Dict, List, Optional, Union
33
34
 
34
35
  from ruamel.yaml import YAML
35
36
 
@@ -38,7 +39,7 @@ from buildtools.bt_logging import log
38
39
  from buildtools.maestro.base_target import BuildTarget
39
40
  from buildtools.maestro.utils import SerializableFileLambda, SerializableLambda
40
41
 
41
- yaml = YAML(typ='safe', pure=True)
42
+ yaml = YAML(typ="safe", pure=True)
42
43
 
43
44
  yaml.register_class(SerializableLambda)
44
45
  yaml.register_class(SerializableFileLambda)
@@ -96,7 +97,7 @@ class TarjanGraph:
96
97
  class BuildMaestro:
97
98
  # ALL_TYPES = {}
98
99
 
99
- def __init__(self, hidden_build_dir='.build'):
100
+ def __init__(self, hidden_build_dir: Union[str, Path] = ".build"):
100
101
  self.alltargets: List[BuildTarget] = []
101
102
  self.targets: List[str] = []
102
103
  self.targetsCompleted: List[str] = []
@@ -106,8 +107,9 @@ class BuildMaestro:
106
107
  self.colors: bool = False
107
108
  self.show_commands: bool = False
108
109
 
109
- self.builddir: str = hidden_build_dir
110
- self.all_targets_file: str = os.path.join(self.builddir, 'all_targets.yml')
110
+ self.builddir: Path = Path(hidden_build_dir)
111
+ self.cache_dir:Path = self.builddir / "cache"
112
+ self.all_targets_file: Path = self.builddir / "all_targets.yml"
111
113
 
112
114
  # This will get Maestro to delete the listed directories, if they are present during --clean.
113
115
  self.other_dirs_to_clean: List[str] = []
@@ -120,31 +122,50 @@ class BuildMaestro:
120
122
  self.alltargets.append(bt)
121
123
  for t in bt.provides():
122
124
  if t in self.targets:
123
- log.warn(f'Target {t} already exists.')
125
+ log.warn(f"Target {t} already exists.")
124
126
  old = self.targetsProvidedBy[t]
125
- with log.warn('Old:'):
127
+ with log.warn("Old:"):
126
128
  old._dumpStacks()
127
- with log.warn('New:'):
129
+ with log.warn("New:"):
128
130
  bt._dumpStacks()
129
131
  self.targetsProvidedBy[t] = bt
130
132
  self.targets.append(t)
131
133
  return bt
132
134
 
133
135
  def generateVirtualTarget(self, id: str) -> str:
134
- '''
136
+ """
135
137
  Usage:
136
138
 
137
139
  bm.add(CopyFilesTarget(target=bm.generateVirtualTarget('a'),...))
138
- '''
139
- return os.path.join(self.builddir, '.targets', id)
140
+ """
141
+ return str(self.builddir / ".targets" / id)
140
142
 
141
143
  def build_argparser(self):
142
144
  argp = argparse.ArgumentParser()
143
- argp.add_argument('--clean', action='store_true', default=False, help='Cleans everything.')
144
- argp.add_argument('--no-colors', action='store_true', default=False, help='Disables colors.')
145
- argp.add_argument('--rebuild', action='store_true', default=False, help='Clean rebuild of project.')
146
- argp.add_argument('--show-commands', action='store_true', default=False, help='Echoes the line used to execute commands. (echo=True in os_utils.cmd())')
147
- argp.add_argument('--verbose', action='store_true', default=False, help='Show hidden buildsteps.')
145
+ argp.add_argument(
146
+ "--clean", action="store_true", default=False, help="Cleans everything."
147
+ )
148
+ argp.add_argument(
149
+ "--no-colors", action="store_true", default=False, help="Disables colors."
150
+ )
151
+ argp.add_argument(
152
+ "--rebuild",
153
+ action="store_true",
154
+ default=False,
155
+ help="Clean rebuild of project.",
156
+ )
157
+ argp.add_argument(
158
+ "--show-commands",
159
+ action="store_true",
160
+ default=False,
161
+ help="Echoes the line used to execute commands. (echo=True in os_utils.cmd())",
162
+ )
163
+ argp.add_argument(
164
+ "--verbose",
165
+ action="store_true",
166
+ default=False,
167
+ help="Show hidden buildsteps.",
168
+ )
148
169
  return argp
149
170
 
150
171
  def parse_args(self, argp=None, args=None):
@@ -172,12 +193,12 @@ class BuildMaestro:
172
193
 
173
194
  def clean(self):
174
195
  older_files = set()
175
- if os.path.isfile(self.all_targets_file):
176
- with open(self.all_targets_file, 'r', encoding='utf-8') as f:
196
+ if self.all_targets_file.is_file():
197
+ with open(self.all_targets_file, "r", encoding="utf-8") as f:
177
198
  try:
178
199
  d = yaml.load(f)
179
- if hasattr(d, 'get'):
180
- d = d.get('targets')
200
+ if hasattr(d, "get"):
201
+ d = d.get("targets")
181
202
  older_files = set(sorted(d))
182
203
  except BaseException:
183
204
  older_files = []
@@ -187,29 +208,36 @@ class BuildMaestro:
187
208
  for xtradir in self.other_dirs_to_clean:
188
209
  if os.path.isdir(xtradir):
189
210
  if self.colors:
190
- log.info('<red>RMTREE</red> %s <red>(other_dirs_to_clean)</red>', xtradir)
211
+ log.info(
212
+ "<red>RMTREE</red> %s <red>(other_dirs_to_clean)</red>", xtradir
213
+ )
191
214
  else:
192
- log.info('RMTREE %s (other_dirs_to_clean)', xtradir)
215
+ log.info("RMTREE %s (other_dirs_to_clean)", xtradir)
193
216
  shutil.rmtree(xtradir, ignore_errors=True)
194
- if os.path.isdir(self.builddir):
217
+
218
+ if self.builddir.is_file():
195
219
  if self.colors:
196
- log.info('<red>RMTREE</red> %s <red>(build system stuff)</red>', self.builddir)
220
+ log.info(
221
+ "<red>RMTREE</red> %s <red>(build system stuff)</red>",
222
+ self.builddir,
223
+ )
197
224
  else:
198
- log.info('RMTREE %s (build system stuff)', self.builddir)
225
+ log.info("RMTREE %s (build system stuff)", self.builddir)
199
226
  shutil.rmtree(self.builddir, ignore_errors=True)
200
- with log.info('Cleaning up old unclaimed files...'):
227
+
228
+ with log.info("Cleaning up old unclaimed files..."):
201
229
  for targetfile in older_files:
202
230
  targetfile = os.path.normpath(targetfile)
203
231
  if os.path.isfile(targetfile):
204
232
  if self.colors:
205
- log.info('<red>RM</red> %s', targetfile)
233
+ log.info("<red>RM</red> %s", targetfile)
206
234
  else:
207
- log.info('RM %s', targetfile)
235
+ log.info("RM %s", targetfile)
208
236
  os.remove(targetfile)
209
237
 
210
238
  @staticmethod
211
239
  def RecognizeType(cls):
212
- #BuildMaestro.ALL_TYPES[cls.BT_TYPE] = cls
240
+ # BuildMaestro.ALL_TYPES[cls.BT_TYPE] = cls
213
241
  pass
214
242
 
215
243
  # def saveRules(self, filename):
@@ -291,7 +319,7 @@ class BuildMaestro:
291
319
  return 0
292
320
 
293
321
  def checkForCycles(self):
294
- with log.info('Checking for dependency cycles...'):
322
+ with log.info("Checking for dependency cycles..."):
295
323
  # Using Tarjan's Strongly Connected Cycles algorithm
296
324
  tg = TarjanGraph()
297
325
 
@@ -300,21 +328,41 @@ class BuildMaestro:
300
328
  refs = []
301
329
  for depend in bt.dependencies:
302
330
  if not isinstance(depend, str):
303
- log.critical('Build target %s has invalid dependency %s.', bt.name, depend)
331
+ log.critical(
332
+ "Build target %s has invalid dependency %s.",
333
+ bt.name,
334
+ depend,
335
+ )
304
336
  sys.exit(1)
305
337
  providers = []
306
338
  for obt in self.alltargets:
307
339
  if depend in obt.provides():
308
- #log.info('%s provides %s, which %s needs', obt.name, depend, bt.name)
340
+ # log.info('%s provides %s, which %s needs', obt.name, depend, bt.name)
309
341
  providers += [obt]
310
342
  if len(providers) > 1:
311
- log.warning('Build target %s has %d providers for dependency %s: %r', bt.name, len(providers), depend, [x.name for x in providers])
343
+ log.warning(
344
+ "Build target %s has %d providers for dependency %s: %r",
345
+ bt.name,
346
+ len(providers),
347
+ depend,
348
+ [x.name for x in providers],
349
+ )
312
350
  elif len(providers) == 0:
313
- log.critical('Build target %s has no providers for dependency %s: %r', bt.name, depend, [x.name for x in providers])
351
+ log.critical(
352
+ "Build target %s has no providers for dependency %s: %r",
353
+ bt.name,
354
+ depend,
355
+ [x.name for x in providers],
356
+ )
314
357
  sys.exit(1)
315
358
  refs.append(providers[-1].id)
316
- with log.debug('Dependency tree:'):
317
- with log.debug('[%s] (%d,[%s])', bt.name, bt.id, ', '.join([str(x) for x in refs])):
359
+ with log.debug("Dependency tree:"):
360
+ with log.debug(
361
+ "[%s] (%d,[%s])",
362
+ bt.name,
363
+ bt.id,
364
+ ", ".join([str(x) for x in refs]),
365
+ ):
318
366
  for refID in refs:
319
367
  log.debug(self.alltargets[refID].name)
320
368
  tg.add_edge(bt.id, refs)
@@ -326,7 +374,15 @@ class BuildMaestro:
326
374
  foundCycles = False
327
375
  for cycle in tg.cycles:
328
376
  if len(cycle) > 1:
329
- log.critical('CYCLE FOUND: %r', ['#{} ({})'.format(self.alltargets[btid].id, self.alltargets[btid].name) for btid in cycle])
377
+ log.critical(
378
+ "CYCLE FOUND: %r",
379
+ [
380
+ "#{} ({})".format(
381
+ self.alltargets[btid].id, self.alltargets[btid].name
382
+ )
383
+ for btid in cycle
384
+ ],
385
+ )
330
386
  foundCycles = True
331
387
  return foundCycles
332
388
 
@@ -336,9 +392,9 @@ class BuildMaestro:
336
392
  if bt.built:
337
393
  for targetfile in bt.provides():
338
394
  alltargets.add(targetfile)
339
- os_utils.ensureDirExists(os.path.dirname(self.all_targets_file))
340
- with open(self.all_targets_file, 'w', encoding='utf-8') as f:
341
- yaml.dump({'targets':list(alltargets)}, f)
395
+ self.all_targets_file.parent.mkdir(parents=True, exist_ok=True)
396
+ with open(self.all_targets_file, "w", encoding="utf-8") as f:
397
+ yaml.dump({"targets": list(alltargets)}, f)
342
398
 
343
399
  def run(self, verbose: Optional[bool] = None):
344
400
  if verbose is not None:
@@ -347,7 +403,7 @@ class BuildMaestro:
347
403
  new_targets = []
348
404
  for t in self.targets:
349
405
  if t in new_targets:
350
- log.warn('Target %s added more than once.', t)
406
+ log.warn("Target %s added more than once.", t)
351
407
  else:
352
408
  new_targets.append(t)
353
409
 
@@ -366,14 +422,16 @@ class BuildMaestro:
366
422
  # if reqfile in keys and reqfile not in target.dependencies:
367
423
  # target.dependencies.append(reqfile)
368
424
  loop = 0
369
- #progress = tqdm(total=len(self.targets), unit='target', desc='Building', leave=False)
425
+ # progress = tqdm(total=len(self.targets), unit='target', desc='Building', leave=False)
370
426
  self.targetsCompleted = []
371
427
  self.targetsDirty = []
372
428
  while len(self.targets) > len(self.targetsCompleted) and loop < 100:
373
429
  loop += 1
374
430
  for bt in self.alltargets:
375
431
  bt.maestro = self
376
- if bt.canBuild(self, keys) and any([target not in self.targetsCompleted for target in bt.provides()]):
432
+ if bt.canBuild(self, keys) and any(
433
+ [target not in self.targetsCompleted for target in bt.provides()]
434
+ ):
377
435
  try:
378
436
  bt.try_build()
379
437
  # progress.update(1)
@@ -383,37 +441,50 @@ class BuildMaestro:
383
441
  except Exception as e:
384
442
  bt._set_failed()
385
443
  self._write_targets()
386
- log.critical('An exception occurred, build halted.')
444
+ log.critical("An exception occurred, build halted.")
387
445
  log.exception(e)
388
446
  return
389
447
  except KeyboardInterrupt:
390
448
  bt._set_failed()
391
449
  self._write_targets()
392
- log.critical('Cancelled via KeyboardInterrupt.')
450
+ log.critical("Cancelled via KeyboardInterrupt.")
393
451
  return
394
452
  bt.built = True
395
- log.debug('%d > %d, loop = %d', len(self.targets), len(self.targetsCompleted), loop)
396
- log.debug('%d > %d, loop = %d', len(self.targets), len(self.targetsCompleted), loop)
453
+ log.debug(
454
+ "%d > %d, loop = %d",
455
+ len(self.targets),
456
+ len(self.targetsCompleted),
457
+ loop,
458
+ )
459
+ log.debug(
460
+ "%d > %d, loop = %d", len(self.targets), len(self.targetsCompleted), loop
461
+ )
397
462
  # progress.close()
398
463
  self._write_targets()
399
464
  if loop >= 100:
400
- incompleteTargets = [t for t in self.targets if t not in self.targetsCompleted]
465
+ incompleteTargets = [
466
+ t for t in self.targets if t not in self.targetsCompleted
467
+ ]
401
468
  if len(incompleteTargets) > 0:
402
- with log.critical("Failed to resolve dependencies. The following targets are left unresolved. Exiting."):
469
+ with log.critical(
470
+ "Failed to resolve dependencies. The following targets are left unresolved. Exiting."
471
+ ):
403
472
  for t in incompleteTargets:
404
473
  log.critical(t)
405
474
  orphanDeps = [t for t in alldeps if t not in self.targets]
406
475
  if len(orphanDeps) > 0:
407
- with log.critical("Failed to resolve dependencies. The following dependencies are orphaned. Exiting."):
476
+ with log.critical(
477
+ "Failed to resolve dependencies. The following dependencies are orphaned. Exiting."
478
+ ):
408
479
  for t in orphanDeps:
409
480
  log.critical(t)
410
481
  # sys.exit(1)
411
- with log.info('Cleaning up...'):
482
+ with log.info("Cleaning up..."):
412
483
  cachefiles = []
413
484
  for bt in self.alltargets:
414
485
  cachefiles.append(os.path.basename(bt.getCacheFile()))
415
- for filename in os.listdir(os.path.join(self.builddir, 'cache')):
416
- if filename not in cachefiles:
417
- filename = os.path.join(self.builddir, 'cache', filename)
418
- log.debug('<red>RM</red> %s', filename)
419
- os.remove(filename)
486
+ if self.cache_dir.is_dir():
487
+ for filename in self.cache_dir.iterdir():
488
+ if filename not in cachefiles:
489
+ log.debug("<red>RM</red> %s", filename)
490
+ os.remove(filename)
@@ -226,7 +226,7 @@ class BuildTarget(object):
226
226
  def getCacheFile(self) -> str:
227
227
  assert self.maestro is not None
228
228
  filename = hashlib.md5(self.name.encode('utf-8')).hexdigest() + '.yml'
229
- return os.path.join(self.maestro.builddir, 'cache', filename)
229
+ return os.path.join(self.maestro.cache_dir, filename)
230
230
 
231
231
  def getConfigHash(self) -> str:
232
232
  s = StringIO()
@@ -390,7 +390,7 @@ class BuildTarget(object):
390
390
  return False
391
391
 
392
392
  def canBuild(self, maestro: 'BuildMaestro', keys: List[str]) -> bool:
393
- #self.files = list(callLambda(self.files))
393
+ # self.files = list(callLambda(self.files))
394
394
  # for dep in list(set(self.dependencies + self.files)):
395
395
  if not self._lambdas_called:
396
396
  for reqfile in callLambda(self.files):
@@ -22,24 +22,24 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  SOFTWARE.
23
23
  """
24
24
 
25
- import subprocess_tee
26
25
  import datetime
27
26
  import importlib.abc
27
+ import importlib.util
28
28
  import json
29
29
  import logging
30
30
  import os
31
- import pkgutil
32
31
  import subprocess
33
32
  import sys
34
33
  from pathlib import Path
35
34
  from tempfile import NamedTemporaryFile
36
35
  from typing import List, Optional, Set, Tuple, Union
37
36
 
37
+ # import subprocess_tee
38
38
  from nuitka.plugins import Plugins as NuitkaPlugins
39
39
  from nuitka.plugins.PluginBase import NuitkaPluginBase
40
40
 
41
- from .. import os_utils
42
- from .base_target import SingleBuildTarget
41
+ from buildtools import os_utils
42
+ from buildtools.maestro.base_target import SingleBuildTarget
43
43
 
44
44
  from buildtools.bt_logging import IndentLogger # isort: skip
45
45
 
@@ -154,11 +154,11 @@ class NuitkaTarget(SingleBuildTarget):
154
154
  return self._CACHED_ALWAYS_ENABLED_PLUGINS
155
155
 
156
156
  def getPathOfModuleOrDie(self, module_name: str) -> Path:
157
- ldr: importlib.abc.Loader
158
- if (ldr := pkgutil.get_loader(module_name)) is None:
157
+ if (modspec := importlib.util.find_spec(module_name)) is None:
159
158
  raise Exception(
160
- f"{module_name} could not be imported by pkgutil. Check that you imported all dependencies."
159
+ f"{module_name} could not be imported by importlib.util.find_spec. Check that you imported all dependencies."
161
160
  )
161
+ ldr: importlib.abc.Loader = modspec.loader
162
162
  if not hasattr(ldr, "get_filename"):
163
163
  raise Exception(
164
164
  f"{module_name} is frozen or built-in and has no location on disk."
@@ -172,8 +172,8 @@ class NuitkaTarget(SingleBuildTarget):
172
172
  ) -> subprocess.CompletedProcess:
173
173
  cmd: List[str] = [str(sys.executable), "-m", "nuitka"] + opts
174
174
  # os_utils.cmd(cmd, echo=self.should_echo_commands(), show_output=True, critical=True, globbify=False)
175
- return subprocess_tee.run(
176
- cmd, stderr=subprocess.STDOUT, check=True, tee=show_output
175
+ return subprocess.run(
176
+ cmd, stderr=subprocess.STDOUT, check=True # , tee=show_output
177
177
  )
178
178
 
179
179
  def launchNuitkaWithNuitkaPlus(
@@ -225,10 +225,7 @@ class NuitkaTarget(SingleBuildTarget):
225
225
  # args += sys.argv[1:]
226
226
  args += opts
227
227
 
228
- from nuitka.importing.PreloadedPackages import (
229
- detectPreLoadedPackagePaths,
230
- detectPthImportedPackages,
231
- )
228
+ from nuitka.importing.PreloadedPackages import detectPreLoadedPackagePaths, detectPthImportedPackages
232
229
 
233
230
  os.environ["NUITKA_NAMESPACES"] = repr(detectPreLoadedPackagePaths())
234
231
 
@@ -277,8 +274,8 @@ class NuitkaTarget(SingleBuildTarget):
277
274
  tfn,
278
275
  ]
279
276
  # os_utils.cmd(nuitka_cmd, echo=True, show_output=True, critical=True, globbify=False)
280
- return subprocess_tee.run(
281
- nuitka_cmd, stderr=subprocess.STDOUT, check=True, tee=show_output
277
+ return subprocess.run(
278
+ nuitka_cmd, stderr=subprocess.STDOUT, check=True # , tee=show_output
282
279
  )
283
280
  finally:
284
281
  if tfn and os.path.isfile(tfn):