pybuildtools 0.7.3__tar.gz → 0.7.5__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 (75) hide show
  1. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/LICENSE +1 -1
  2. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/PKG-INFO +20 -21
  3. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/nuitka.py +31 -35
  4. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/os_utils.py +41 -61
  5. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/repo/base.py +4 -4
  6. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/repo/git.py +9 -4
  7. pybuildtools-0.7.5/buildtools/wrapper/cmake.py +122 -0
  8. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/wrapper/git.py +64 -18
  9. pybuildtools-0.7.5/pyproject.toml +54 -0
  10. pybuildtools-0.7.3/buildtools/wrapper/cmake.py +0 -78
  11. pybuildtools-0.7.3/pyproject.toml +0 -57
  12. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/README.md +0 -0
  13. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/__init__.py +0 -0
  14. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/_os_utils_linux.py +0 -0
  15. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/_os_utils_win32.py +0 -0
  16. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/as3.py +0 -0
  17. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/bt_logging.py +0 -0
  18. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/buildsystem/CCompiler.py +0 -0
  19. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/buildsystem/__init__.py +0 -0
  20. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/buildsystem/baseproject.py +0 -0
  21. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/buildsystem/gcc.py +0 -0
  22. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/buildsystem/msbuild.py +0 -0
  23. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/buildsystem/prebuild.py +0 -0
  24. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/buildsystem/visualstudio.py +0 -0
  25. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/cli/__init__.py +0 -0
  26. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/cli/nuitka_plus/README.md +0 -0
  27. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/cli/nuitka_plus/__init__.py +0 -0
  28. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/cli/nuitka_plus/__main__.py +0 -0
  29. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/cli.py +0 -0
  30. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/config.py +0 -0
  31. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/consts.py +0 -0
  32. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/error.py +0 -0
  33. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/ext/__init__.py +0 -0
  34. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/ext/salt/__init__.py +0 -0
  35. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/ext/salt/jinja_ext.py +0 -0
  36. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/http.py +0 -0
  37. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/indentation.py +0 -0
  38. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/lxml_utils.py +0 -0
  39. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/__init__.py +0 -0
  40. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/base_target.py +0 -0
  41. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/coffeescript.py +0 -0
  42. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/convert_data.py +0 -0
  43. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/docs.py +0 -0
  44. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/enumwriters/__init__.py +0 -0
  45. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/enumwriters/coffee.py +0 -0
  46. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/enumwriters/enumwriter.py +0 -0
  47. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/enumwriters/php.py +0 -0
  48. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/enumwriters/python.py +0 -0
  49. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/enumwriters/types.py +0 -0
  50. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/fileio.py +0 -0
  51. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/genenum.py +0 -0
  52. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/git.py +0 -0
  53. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/jinja2.py +0 -0
  54. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/package_managers.py +0 -0
  55. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/shell.py +0 -0
  56. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/utils.py +0 -0
  57. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/maestro/web.py +0 -0
  58. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/paths.py +0 -0
  59. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/posix/__init__.py +0 -0
  60. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/posix/elf.py +0 -0
  61. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/pygit2_callbacks.py +0 -0
  62. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/qconfig5.py +0 -0
  63. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/repo/__init__.py +0 -0
  64. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/repo/hg.py +0 -0
  65. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/timing.py +0 -0
  66. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/twisted_utils.py +0 -0
  67. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/types.py +0 -0
  68. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/utils.py +0 -0
  69. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/wrapper/__init__.py +0 -0
  70. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/wrapper/ant.py +0 -0
  71. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/wrapper/ccache.py +0 -0
  72. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/wrapper/cotire.py +0 -0
  73. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/wrapper/distcc.py +0 -0
  74. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/wrapper/fpm.py +0 -0
  75. {pybuildtools-0.7.3 → pybuildtools-0.7.5}/buildtools/wrapper/repo/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014 - 2024 Rob Nelson
3
+ Copyright (c) 2014 - 2025 Rob Nelson
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,37 +1,36 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: pybuildtools
3
- Version: 0.7.3
3
+ Version: 0.7.5
4
4
  Summary: A set of tools for putting together buildscripts and other CLI applications
5
- Home-page: https://gitlab.com/N3X15/python-build-tools
6
5
  License: MIT
7
6
  Author: Rob Nelson
8
7
  Author-email: nexisentertainment@gmail.com
9
- Requires-Python: >=3.9,<4.0
8
+ Requires-Python: >=3.13,<4.0
10
9
  Classifier: License :: OSI Approved :: MIT License
11
10
  Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.9
13
- Classifier: Programming Language :: Python :: 3.10
14
- Classifier: Programming Language :: Python :: 3.11
15
- Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
16
12
  Provides-Extra: all
17
13
  Provides-Extra: nuitka
18
- Provides-Extra: pyqt5
14
+ Provides-Extra: pygit2
19
15
  Provides-Extra: twisted
20
16
  Requires-Dist: Jinja2 (==3.1.2)
21
- Requires-Dist: MarkupSafe (>=2.1.5,<3.0.0)
22
- Requires-Dist: PyQt5 (>=5.15.11,<6.0.0) ; extra == "pyqt5" or extra == "all"
23
- Requires-Dist: Twisted (>=24.7.0,<25.0.0) ; extra == "twisted" or extra == "all"
17
+ Requires-Dist: MarkupSafe (>=3.0.2,<4.0.0)
18
+ Requires-Dist: Twisted (>=25.5.0,<26.0.0) ; extra == "twisted"
19
+ Requires-Dist: Twisted ; extra == "all"
24
20
  Requires-Dist: colorama (>=0.4.6,<0.5.0)
25
- Requires-Dist: lxml (>=5.3.0,<6.0.0)
26
- Requires-Dist: nuitka (>=2.4.8,<3.0.0) ; extra == "nuitka" or extra == "all"
27
- Requires-Dist: psutil (>=6.0.0,<7.0.0)
28
- Requires-Dist: pygit2 (>=1.15.1,<2.0.0)
29
- Requires-Dist: requests (>=2.32.3,<3.0.0)
30
- Requires-Dist: ruamel.yaml (>=0.18.6,<0.19.0)
31
- Requires-Dist: six (>=1.16.0,<2.0.0)
32
- Requires-Dist: subprocess-tee (>=0.4.1,<0.5.0)
21
+ Requires-Dist: lxml (>=6.0.0,<7.0.0)
22
+ Requires-Dist: nuitka (>=2.7.12,<3.0.0) ; extra == "nuitka"
23
+ Requires-Dist: nuitka ; extra == "all"
24
+ Requires-Dist: psutil (>=7.0.0,<8.0.0)
25
+ Requires-Dist: pygit2 (>=1.18.0,<2.0.0) ; extra == "pygit2"
26
+ Requires-Dist: pygit2 ; extra == "all"
27
+ Requires-Dist: requests (>=2.32.4,<3.0.0)
28
+ Requires-Dist: ruamel.yaml (>=0.18.14,<0.19.0)
29
+ Requires-Dist: six (>=1.17.0,<2.0.0)
30
+ Requires-Dist: subprocess-tee (>=0.4.2,<0.5.0)
33
31
  Requires-Dist: toml (>=0.10.2,<0.11.0)
34
- Requires-Dist: tqdm (>=4.66.5,<5.0.0)
32
+ Requires-Dist: tqdm (>=4.67.1,<5.0.0)
33
+ Project-URL: Homepage, https://gitlab.com/N3X15/python-build-tools
35
34
  Project-URL: Repository, https://gitlab.com/N3X15/python-build-tools.git
36
35
  Description-Content-Type: text/markdown
37
36
 
@@ -75,11 +75,7 @@ class NuitkaTarget(SingleBuildTarget):
75
75
  self.out_dir = self.out_dir / nuitka_subdir
76
76
  self.dist_dir: Path = self.out_dir / f"{self.package_name}.dist"
77
77
  self.singlefile: bool = single_file
78
- self.executable_mangled: Path = (
79
- self.dist_dir / self.package_name
80
- if not single_file
81
- else (self.out_dir / self.package_name).with_suffix(".bin")
82
- )
78
+ self.executable_mangled: Path = self.dist_dir / self.package_name if not single_file else (self.out_dir / self.package_name).with_suffix(".bin")
83
79
 
84
80
  if os.name == "nt":
85
81
  self.executable_mangled = self.executable_mangled.with_suffix(".exe")
@@ -96,15 +92,9 @@ class NuitkaTarget(SingleBuildTarget):
96
92
  self.company_name: str = "FIXME: Nuitka Executable Contributors"
97
93
  self.file_version: Tuple[int, int, int, int] = (0, 0, 0, 0)
98
94
  self.product_version: Tuple[int, int, int, int] = (0, 0, 0, 0)
99
- self.file_description: str = (
100
- "FIXME: Review target.product_name, target.company_name, target.file_version, target.trademarks, and target.file_description."
101
- )
102
- self.trademarks: str = (
103
- f"FIXME: Trademarks are the property of their respective owners. Set --trademarks."
104
- )
105
- self.copyright: str = (
106
- f"FIXME: Copyright ©{datetime.datetime.now().year} Company Name Here. All Rights Reserved. Set --copyright"
107
- )
95
+ self.file_description: str = "FIXME: Review target.product_name, target.company_name, target.file_version, target.trademarks, and target.file_description."
96
+ self.trademarks: str = f"FIXME: Trademarks are the property of their respective owners. Set --trademarks."
97
+ self.copyright: str = f"FIXME: Copyright ©{datetime.datetime.now().year} Company Name Here. All Rights Reserved. Set --copyright"
108
98
 
109
99
  self.linux_onefile_icon: Optional[Union[str, Path]] = None
110
100
 
@@ -140,52 +130,51 @@ class NuitkaTarget(SingleBuildTarget):
140
130
  NuitkaPlugins.loadPlugins()
141
131
  # print(repr(NuitkaPlugins.getActivePlugins()))
142
132
  for plugin_name in sorted(NuitkaPlugins.plugin_name2plugin_classes):
143
- plugin: NuitkaPluginBase = NuitkaPlugins.plugin_name2plugin_classes[
144
- plugin_name
145
- ][0]
133
+ plugin: NuitkaPluginBase = NuitkaPlugins.plugin_name2plugin_classes[plugin_name][0]
146
134
  if plugin.isAlwaysEnabled():
147
135
  self._CACHED_ALWAYS_ENABLED_PLUGINS.add(plugin.plugin_name)
148
136
  except Exception as e:
149
137
  log.critical("Error interfacing with Nuitka:")
150
138
  log.critical(e)
151
- log.debug(
152
- f"_CACHED_ALWAYS_ENABLED_PLUGINS = {self._CACHED_ALWAYS_ENABLED_PLUGINS!r}"
153
- )
139
+ log.debug(f"_CACHED_ALWAYS_ENABLED_PLUGINS = {self._CACHED_ALWAYS_ENABLED_PLUGINS!r}")
154
140
  return self._CACHED_ALWAYS_ENABLED_PLUGINS
155
141
 
156
142
  def getPathOfModuleOrDie(self, module_name: str) -> Path:
157
143
  if (modspec := importlib.util.find_spec(module_name)) is None:
158
- raise Exception(
159
- f"{module_name} could not be imported by importlib.util.find_spec. Check that you imported all dependencies."
160
- )
144
+ raise Exception(f"{module_name} could not be imported by importlib.util.find_spec. Check that you imported all dependencies.")
161
145
  ldr: importlib.abc.Loader = modspec.loader
162
146
  if not hasattr(ldr, "get_filename"):
163
- raise Exception(
164
- f"{module_name} is frozen or built-in and has no location on disk."
165
- )
147
+ raise Exception(f"{module_name} is frozen or built-in and has no location on disk.")
166
148
  return Path(ldr.get_filename())
167
149
 
168
150
  def launchNuitkaFromCLI(
169
151
  self,
170
152
  opts: List[str],
171
153
  show_output: bool = True,
154
+ user: Optional[str | int] = None,
155
+ group: Optional[str | int] = None,
172
156
  ) -> subprocess.CompletedProcess:
173
157
  cmd: List[str] = [str(sys.executable), "-m", "nuitka"] + opts
174
158
  # os_utils.cmd(cmd, echo=self.should_echo_commands(), show_output=True, critical=True, globbify=False)
175
159
  return subprocess.run(
176
- cmd, stderr=subprocess.STDOUT, check=True # , tee=show_output
160
+ cmd,
161
+ stderr=subprocess.STDOUT,
162
+ check=True,
163
+ # tee=show_output,
164
+ user=user,
165
+ group=group,
177
166
  )
178
167
 
179
168
  def launchNuitkaWithNuitkaPlus(
180
169
  self,
181
170
  opts: List[str],
182
171
  show_output: bool = True,
172
+ user: Optional[str | int] = None,
173
+ group: Optional[str | int] = None,
183
174
  ) -> subprocess.CompletedProcess:
184
175
  # PATH_NUITKA_MAIN = self.getPathOfModuleOrDie('nuitka.__main__')
185
176
  PATH_NUITKA = self.getPathOfModuleOrDie("nuitka").parent.absolute()
186
- PATH_NUITKA_PLUS = self.getPathOfModuleOrDie(
187
- "buildtools.cli.nuitka_plus"
188
- ).absolute()
177
+ PATH_NUITKA_PLUS = self.getPathOfModuleOrDie("buildtools.cli.nuitka_plus").absolute()
189
178
 
190
179
  # See nuitka.utils.ReExecute.reExecuteNuitka.
191
180
  # This is pretty much verbatim, with a few tweaks for compatibility and standards.
@@ -275,7 +264,12 @@ class NuitkaTarget(SingleBuildTarget):
275
264
  ]
276
265
  # os_utils.cmd(nuitka_cmd, echo=True, show_output=True, critical=True, globbify=False)
277
266
  return subprocess.run(
278
- nuitka_cmd, stderr=subprocess.STDOUT, check=True # , tee=show_output
267
+ nuitka_cmd,
268
+ stderr=subprocess.STDOUT,
269
+ check=True,
270
+ # tee=show_output,
271
+ user=user,
272
+ group=group,
279
273
  )
280
274
  finally:
281
275
  if tfn and os.path.isfile(tfn):
@@ -328,9 +322,7 @@ class NuitkaTarget(SingleBuildTarget):
328
322
  opts.append(f"--linux-onefile-icon={self.linux_onefile_icon}")
329
323
  if os_utils.is_windows():
330
324
  if self.windows_onefile_splash_image is not None:
331
- opts.append(
332
- f"--onefile-windows-splash-screen-image={self.windows_onefile_splash_image}"
333
- )
325
+ opts.append(f"--onefile-windows-splash-screen-image={self.windows_onefile_splash_image}")
334
326
 
335
327
  if os_utils.is_windows():
336
328
  if self.windows_disable_console:
@@ -357,14 +349,18 @@ class NuitkaTarget(SingleBuildTarget):
357
349
  opts.append(str(self.entry_point))
358
350
  return opts
359
351
 
360
- def build(self, show_output: bool = True) -> None:
352
+ def build(self, show_output: bool = True, user: Optional[str | int] = None, group: Optional[str | int] = None) -> None:
361
353
  if self.legacy_launch:
362
354
  self.launchNuitkaFromCLI(
363
355
  opts=self.getCommandLine(),
364
356
  show_output=show_output,
357
+ user=user,
358
+ group=group,
365
359
  )
366
360
  else:
367
361
  self.launchNuitkaWithNuitkaPlus(
368
362
  opts=self.getCommandLine(),
369
363
  show_output=show_output,
364
+ user=user,
365
+ group=group,
370
366
  )
@@ -22,6 +22,7 @@ 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
26
  import codecs
26
27
  import filecmp
27
28
  import glob
@@ -71,15 +72,11 @@ def secondsToStr(t: int) -> str:
71
72
  """
72
73
  Take integer seconds, return formatted string.
73
74
  """
74
- return "%d:%02d:%02d.%03d" % reduce(
75
- lambda ll, b: divmod(ll[0], b) + ll[1:], [(t * 1000,), 1000, 60, 60]
76
- )
75
+ return "%d:%02d:%02d.%03d" % reduce(lambda ll, b: divmod(ll[0], b) + ll[1:], [(t * 1000,), 1000, 60, 60])
77
76
 
78
77
 
79
78
  class BuildEnv:
80
- def __init__(
81
- self, initial: Optional[Dict[str, str]] = None, noisy: bool = False
82
- ) -> None:
79
+ def __init__(self, initial: Optional[Dict[str, str]] = None, noisy: bool = False) -> None:
83
80
  self._env: Dict[str, str]
84
81
  self.keymap: Dict[str, str]
85
82
  if initial is not None:
@@ -159,9 +156,7 @@ class BuildEnv:
159
156
  keys = self._env.keys()
160
157
  self.dump(self._env, map(lambda k: k.casefold(), keys))
161
158
 
162
- def which(
163
- self, command: str, skip_paths: Optional[Iterable[StrOrPath]] = None
164
- ) -> Optional[Path]:
159
+ def which(self, command: str, skip_paths: Optional[Iterable[StrOrPath]] = None) -> Optional[Path]:
165
160
  if skip_paths is None:
166
161
  skip_paths = []
167
162
  fpath, _ = os.path.split(command)
@@ -172,9 +167,7 @@ class BuildEnv:
172
167
  for pathstr in self.get("PATH", "").split(os.pathsep):
173
168
  pathstr = pathstr.strip('"')
174
169
  path = Path(pathstr)
175
- if Path(pathstr.casefold()) in set(
176
- map(lambda x: Path(str(x).casefold()), skip_paths)
177
- ):
170
+ if Path(pathstr.casefold()) in set(map(lambda x: Path(str(x).casefold()), skip_paths)):
178
171
  continue
179
172
  exe_file = path / command
180
173
  if sys.platform == "win32":
@@ -190,9 +183,7 @@ class BuildEnv:
190
183
  return exe_file
191
184
  return None
192
185
 
193
- def assertWhich(
194
- self, command: str, skip_paths: Optional[Iterable[StrOrPath]] = None
195
- ) -> Optional[Path]:
186
+ def assertWhich(self, command: str, skip_paths: Optional[Iterable[StrOrPath]] = None) -> Optional[Path]:
196
187
  if skip_paths is None:
197
188
  skip_paths = []
198
189
  fullpath = self.which(command, skip_paths)
@@ -203,9 +194,7 @@ class BuildEnv:
203
194
  log.info("Found: %s", fullpath)
204
195
  return fullpath
205
196
 
206
- def removeDuplicatedEntries(
207
- self, key: str, noisy: Optional[str] = None, delim: Optional[str] = None
208
- ) -> None:
197
+ def removeDuplicatedEntries(self, key: str, noisy: Optional[str] = None, delim: Optional[str] = None) -> None:
209
198
  if delim is None:
210
199
  delim = os.pathsep
211
200
  if noisy is None:
@@ -217,9 +206,7 @@ class BuildEnv:
217
206
  entry = entry.strip('"')
218
207
  if entry in newlist:
219
208
  if noisy:
220
- log.info(
221
- "Build env: Removing %r from %s: duplicated entry.", entry, okey
222
- )
209
+ log.info("Build env: Removing %r from %s: duplicated entry.", entry, okey)
223
210
  continue
224
211
  newlist += [entry]
225
212
  self._env[key] = delim.join(newlist)
@@ -227,9 +214,7 @@ class BuildEnv:
227
214
  @classmethod
228
215
  def dump(cls, env: Dict[str, str], keys: Optional[Iterable[str]] = None) -> None:
229
216
  for key, value in sorted(env.items()):
230
- if keys is not None and key.casefold() not in map(
231
- lambda x: x.casefold(), keys
232
- ):
217
+ if keys is not None and key.casefold() not in map(lambda x: x.casefold(), keys):
233
218
  continue
234
219
  log.info('+{0}="{1}"'.format(key, value))
235
220
 
@@ -310,18 +295,14 @@ def is_executable(fpath: StrOrPath) -> bool:
310
295
  return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
311
296
 
312
297
 
313
- def which(
314
- command: str, skip_paths: Optional[Iterable[StrOrPath]] = None
315
- ) -> Optional[Path]:
298
+ def which(command: str, skip_paths: Optional[Iterable[StrOrPath]] = None) -> Optional[Path]:
316
299
  """
317
300
  Returns path of the given command, if it exists in PATH. Otherwise, return value is None.
318
301
  """
319
302
  return ENV.which(command, skip_paths=skip_paths)
320
303
 
321
304
 
322
- def assertWhich(
323
- program: str, skip_paths: Optional[Iterable[StrOrPath]] = None
324
- ) -> Optional[Path]:
305
+ def assertWhich(program: str, skip_paths: Optional[Iterable[StrOrPath]] = None) -> Optional[Path]:
325
306
  """
326
307
  Raises an exception if program isn't found in PATH.
327
308
  """
@@ -369,9 +350,7 @@ def find_process(pid: int) -> Optional[psutil.Process]:
369
350
  return None
370
351
 
371
352
 
372
- def check_output(
373
- *popenargs, timeout=None, acceptable_exit_codes: SupportsIn[int] = [0], **kwargs
374
- ):
353
+ def check_output(*popenargs, timeout=None, acceptable_exit_codes: SupportsIn[int] = [0], **kwargs):
375
354
  """
376
355
  Python 3.6 subprocess.check_output(), modded to accept more exit codes.
377
356
  """
@@ -412,7 +391,7 @@ def run(
412
391
  check=False,
413
392
  acceptable_exit_codes: SupportsIn[int] = [0],
414
393
  **kwargs,
415
- ):
394
+ ) -> subprocess.CompletedProcess:
416
395
  """
417
396
  Python 3.6 subprocess.run(), modded to accept more exit codes.
418
397
  """
@@ -440,9 +419,7 @@ def run(
440
419
  output=stdout,
441
420
  stderr=stderr,
442
421
  )
443
- return subprocess.CompletedProcess(
444
- process.args, retcode, stdout, stderr
445
- ) # pylint: disable=E1101
422
+ return subprocess.CompletedProcess(process.args, retcode, stdout, stderr) # pylint: disable=E1101
446
423
 
447
424
 
448
425
  def cmd(
@@ -453,7 +430,9 @@ def cmd(
453
430
  critical: bool = False,
454
431
  globbify: bool = True,
455
432
  acceptable_exit_codes: SupportsIn[int] = [0],
456
- ):
433
+ user: Optional[str | int] = None,
434
+ group: Optional[str | int] = None,
435
+ ) -> bool:
457
436
  new_env = _cmd_handle_env(env)
458
437
  command = _cmd_handle_args(command, globbify)
459
438
  if echo:
@@ -462,7 +441,7 @@ def cmd(
462
441
  output = ""
463
442
  try:
464
443
  if show_output:
465
- code = subprocess.call(command, env=new_env, shell=False)
444
+ code = subprocess.call(command, env=new_env, shell=False, user=user, group=group)
466
445
  # print(repr(code))
467
446
  success = code in acceptable_exit_codes
468
447
  if critical and not success:
@@ -475,6 +454,8 @@ def cmd(
475
454
  env=new_env,
476
455
  stderr=subprocess.STDOUT,
477
456
  acceptable_exit_codes=acceptable_exit_codes,
457
+ user=user,
458
+ group=group,
478
459
  )
479
460
  return True
480
461
  except CalledProcessError as cpe:
@@ -503,6 +484,8 @@ def cmd_output(
503
484
  env: Optional[BuildEnv] = None,
504
485
  critical: bool = False,
505
486
  globbify: bool = True,
487
+ user: Optional[str | int] = None,
488
+ group: Optional[str | int] = None,
506
489
  ) -> Optional[_CmdOutputResponse]:
507
490
  new_env = _cmd_handle_env(env)
508
491
  command = _cmd_handle_args(command, globbify)
@@ -511,7 +494,12 @@ def cmd_output(
511
494
 
512
495
  try:
513
496
  o = subprocess.Popen(
514
- command, env=new_env, stdout=subprocess.PIPE, stderr=subprocess.PIPE
497
+ command,
498
+ env=new_env,
499
+ stdout=subprocess.PIPE,
500
+ stderr=subprocess.PIPE,
501
+ user=user,
502
+ group=group,
515
503
  ).communicate()
516
504
  if o is not None:
517
505
  stdout, stderr = o
@@ -531,7 +519,10 @@ def cmd_out(
531
519
  critical: bool = False,
532
520
  globbify: bool = True,
533
521
  encoding: str = "utf-8",
522
+ user: Optional[str | int] = None,
523
+ group: Optional[str | int] = None,
534
524
  ) -> Optional[str]:
525
+
535
526
  new_env = _cmd_handle_env(env)
536
527
  command = _cmd_handle_args(command, globbify)
537
528
  if echo:
@@ -544,6 +535,8 @@ def cmd_out(
544
535
  stdout=subprocess.PIPE,
545
536
  stderr=subprocess.STDOUT,
546
537
  close_fds=True,
538
+ user=user,
539
+ group=group,
547
540
  )
548
541
  if p.stdout is not None:
549
542
  return p.stdout.read().decode(encoding)
@@ -562,6 +555,8 @@ def cmd_daemonize(
562
555
  critical: bool = False,
563
556
  globbify: bool = True,
564
557
  win_tempfile_dir: Optional[Path] = None,
558
+ user: Optional[str | int] = None,
559
+ group: Optional[str | int] = None,
565
560
  ):
566
561
  new_env = _cmd_handle_env(env)
567
562
  command = _cmd_handle_args(command, globbify)
@@ -572,9 +567,7 @@ def cmd_daemonize(
572
567
  if os.name == "nt":
573
568
  # HACK
574
569
  batchfile: Path
575
- with tempfile.NamedTemporaryFile(
576
- mode="w", delete=False, suffix=".bat", dir=win_tempfile_dir
577
- ) as tf:
570
+ with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".bat", dir=win_tempfile_dir) as tf:
578
571
  tf.write(" ".join(command))
579
572
  batchfile = Path(tf.name)
580
573
  os.startfile(batchfile)
@@ -598,10 +591,7 @@ def old_copytree(src, dst, symlinks=False, ignore=None):
598
591
  if os.path.isdir(s):
599
592
  copytree(s, d, symlinks, ignore)
600
593
  else:
601
- if (
602
- not os.path.exists(d)
603
- or os.path.getmtime(src) - os.path.getmtime(dst) > 1
604
- ):
594
+ if not os.path.exists(d) or os.path.getmtime(src) - os.path.getmtime(dst) > 1:
605
595
  shutil.copy2(s, d)
606
596
 
607
597
 
@@ -647,9 +637,7 @@ def single_copy(fromfile: str, newroot: str, **op_args):
647
637
  shutil.copy2(fromfile, newfile)
648
638
 
649
639
 
650
- def copytree(
651
- fromdir, todir, ignore=None, verbose=False, ignore_mtime=False, progress=False
652
- ):
640
+ def copytree(fromdir, todir, ignore=None, verbose=False, ignore_mtime=False, progress=False):
653
641
  if progress:
654
642
  count = {"a": 0}
655
643
 
@@ -789,9 +777,7 @@ def _args2str(cmdlist):
789
777
  return " ".join([shlex.quote(x) for x in cmdlist])
790
778
 
791
779
 
792
- def decompressFile(
793
- archive: os.PathLike, to: os.PathLike = ".", env=None, path7za: os.PathLike = "7za"
794
- ):
780
+ def decompressFile(archive: os.PathLike, to: os.PathLike = ".", env=None, path7za: os.PathLike = "7za"):
795
781
  """
796
782
  Decompresses the file to the current working directory.
797
783
 
@@ -904,9 +890,7 @@ def get_file_list(root_dir: str, start: str = None, prefix: str = "") -> list:
904
890
  start = root_dir
905
891
  for root, _, files in os.walk(root_dir):
906
892
  for filename in files:
907
- rpath = os.path.relpath(
908
- os.path.abspath(os.path.join(root, filename)), start
909
- )
893
+ rpath = os.path.relpath(os.path.abspath(os.path.join(root, filename)), start)
910
894
  if prefix is not None:
911
895
  rpath = os.path.join(prefix, rpath)
912
896
  output += [rpath]
@@ -997,8 +981,4 @@ else:
997
981
 
998
982
  buildtools._os_utils_linux.cmd_output = cmd_output
999
983
  buildtools._os_utils_linux.ENV = ENV
1000
- from buildtools._os_utils_linux import (
1001
- DpkgSearchFiles,
1002
- GetDpkgShlibs,
1003
- InstallDpkgPackages,
1004
- )
984
+ from buildtools._os_utils_linux import DpkgSearchFiles, GetDpkgShlibs, InstallDpkgPackages
@@ -33,14 +33,14 @@ class SCMRepository:
33
33
  path: str,
34
34
  quiet: bool = True,
35
35
  noisy_clone: bool = False,
36
- owner: Optional[str] = None,
37
- group: Optional[str] = None,
36
+ owner: Optional[str | int] = None,
37
+ group: Optional[str | int] = None,
38
38
  ) -> None:
39
39
  self.path: str = path
40
40
  self.quiet: bool = quiet
41
41
  self.noisy_clone: bool = noisy_clone
42
- self.owner: Optional[str] = owner
43
- self.group: Optional[str] = group
42
+ self.owner: Optional[str | int] = owner
43
+ self.group: Optional[str | int] = group
44
44
 
45
45
  def CheckForUpdates(
46
46
  self,
@@ -27,6 +27,7 @@ from typing import Dict, List, Optional
27
27
  from buildtools.bt_logging import log
28
28
  from buildtools.os_utils import ENV, BuildEnv, Chdir, cmd_out
29
29
  from buildtools.repo.base import SCMRepository
30
+ from buildtools.types import StrOrPath
30
31
  from buildtools.wrapper.git import Git
31
32
 
32
33
 
@@ -57,8 +58,9 @@ class GitRepository(SCMRepository):
57
58
  quiet: bool = True,
58
59
  noisy_clone: bool = False,
59
60
  submodule: bool = False,
60
- owner: Optional[str] = None,
61
- group: Optional[str] = None,
61
+ owner: Optional[str|int] = None,
62
+ group: Optional[str|int] = None,
63
+ git_executable:StrOrPath='git',
62
64
  ) -> None:
63
65
  super().__init__(
64
66
  path,
@@ -68,6 +70,8 @@ class GitRepository(SCMRepository):
68
70
  group=group,
69
71
  )
70
72
 
73
+ self.git_executable:StrOrPath=git_executable
74
+
71
75
  # Known remotes.
72
76
  origin = GitRemoteInfo()
73
77
  origin.id = "origin"
@@ -89,11 +93,12 @@ class GitRepository(SCMRepository):
89
93
 
90
94
  def _git(self, args: List[str], echo: bool = False) -> Optional[str]:
91
95
  return cmd_out(
92
- (["sudo", "-u", str(self.owner), "-H"] if self.owner is not None else [])
93
- + ["git"]
96
+ [str(self.git_executable)]
94
97
  + args,
95
98
  echo=echo,
96
99
  env=self.noPasswordEnv,
100
+ user=self.owner,
101
+ group=self.group,
97
102
  )
98
103
 
99
104
  def _syncRemote(self, remoteID: str, quiet: Optional[bool] = None) -> GitRemoteInfo:
@@ -0,0 +1,122 @@
1
+ """
2
+ cmake Wrapper
3
+
4
+ Copyright (c) 2015 - 2024 Rob "N3X15" Nelson <nexisentertainment@gmail.com>
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
23
+
24
+ """
25
+
26
+ import subprocess
27
+ from typing import Dict, List, Optional
28
+
29
+ from buildtools.bt_logging import log
30
+ from buildtools.os_utils import ENV, BuildEnv, cmd
31
+ from buildtools.types import StrOrPath
32
+
33
+
34
+ class CMake:
35
+ @classmethod
36
+ def GetVersion(
37
+ cls,
38
+ CMAKE: StrOrPath = "cmake",
39
+ user: Optional[str | int] = None,
40
+ group: Optional[str | int] = None,
41
+ ) -> Optional[str]:
42
+ rev = subprocess.check_output([str(CMAKE), "--version"], stderr=subprocess.STDOUT, user=user, group=group)
43
+ if rev:
44
+ return rev.decode("utf-8").split()[2]
45
+
46
+ def __init__(self) -> None:
47
+ self.flags: Dict[str, str] = {}
48
+ self.generator: str = None
49
+
50
+ def setFlag(self, key: str, val: str) -> None:
51
+ log.info(f"CMake: {key} = {val}")
52
+ self.flags[key] = val
53
+
54
+ def build(
55
+ self,
56
+ CMAKE: StrOrPath = "cmake",
57
+ dir: StrOrPath = ".",
58
+ env: Optional[BuildEnv] = None,
59
+ target: Optional[str] = None,
60
+ moreflags: Optional[List[str]] = None,
61
+ env_dump: bool = False,
62
+ user: Optional[str | int] = None,
63
+ group: Optional[str | int] = None,
64
+ ):
65
+ if moreflags is None:
66
+ moreflags = []
67
+ if env is None:
68
+ env = ENV.toDict()
69
+ flags = ["--build", str(dir)]
70
+ if target is not None:
71
+ moreflags += ["--target", target]
72
+
73
+ flags += moreflags
74
+
75
+ with log.info("Running CMake --build:"):
76
+ if env_dump:
77
+ BuildEnv.dump(env)
78
+ return cmd(
79
+ [str(CMAKE)] + flags,
80
+ env=env,
81
+ critical=True,
82
+ echo=True,
83
+ user=user,
84
+ group=group,
85
+ )
86
+
87
+ def run(
88
+ self,
89
+ CMAKE: StrOrPath = "cmake",
90
+ env: Optional[BuildEnv] = None,
91
+ dir: StrOrPath = ".",
92
+ moreflags: Optional[List[str]] = None,
93
+ env_dump: bool = False,
94
+ user: Optional[str | int] = None,
95
+ group: Optional[str | int] = None,
96
+ ) -> None:
97
+ if env is None:
98
+ env = ENV.toDict()
99
+ if moreflags is None:
100
+ moreflags = []
101
+ flags = []
102
+
103
+ if self.generator is not None:
104
+ flags += ["-G", self.generator]
105
+
106
+ for key, value in self.flags.items():
107
+ flags += [f"-D{key}={value}"]
108
+
109
+ flags += moreflags
110
+
111
+ with log.info("Running CMake:"):
112
+ if env_dump:
113
+ BuildEnv.dump(env)
114
+ return cmd(
115
+ [str(CMAKE)] + flags + [str(dir)],
116
+ env=env,
117
+ critical=True,
118
+ echo=True,
119
+ user=user,
120
+ group=group,
121
+ )
122
+ return False
@@ -22,10 +22,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  SOFTWARE.
23
23
 
24
24
  """
25
+
26
+ import warnings
25
27
  from typing import Dict, List, Optional
26
28
 
27
29
  from buildtools.bt_logging import log
28
- from buildtools.os_utils import cmd_out, cmd_output, _args2str
30
+ from buildtools.os_utils import _args2str, cmd_out, cmd_output
31
+ from buildtools.types import StrOrPath
29
32
 
30
33
 
31
34
  def _sudoize(cmd: List[str], as_user: Optional[str]) -> List[str]:
@@ -35,24 +38,33 @@ def _sudoize(cmd: List[str], as_user: Optional[str]) -> List[str]:
35
38
  class Git:
36
39
  @classmethod
37
40
  def GetCommit(
38
- cls, ref="HEAD", short=True, quiet=True, sudo_as: Optional[str] = None
41
+ cls,
42
+ ref: str = "HEAD",
43
+ short: bool = True,
44
+ quiet: bool = True,
45
+ sudo_as: Optional[str] = None,
46
+ user: Optional[str | int] = None,
47
+ group: Optional[str | int] = None,
48
+ git: StrOrPath = "git",
39
49
  ) -> Optional[str]:
50
+ if sudo_as is not None:
51
+ warnings.warn("sudo_as is deprecated. Please use user/group instead.", DeprecationWarning)
40
52
  try:
41
53
  addtl_flags = []
42
54
  if short:
43
55
  addtl_flags.append("--short")
44
56
  ret = cmd_output(
45
- _sudoize(["git", "rev-parse"] + addtl_flags + [ref], as_user=sudo_as),
57
+ _sudoize([str(git), "rev-parse"] + addtl_flags + [ref], as_user=sudo_as),
46
58
  echo=not quiet,
47
59
  critical=True,
60
+ user=user,
61
+ group=group,
48
62
  )
49
63
  if not ret:
50
64
  return None
51
65
  stdout, stderr = ret
52
66
  return (stdout + stderr).decode("utf-8").strip()
53
- # rev = subprocess.Popen(['git', 'rev-parse'] + addtl_flags + [ref], stdout=subprocess.PIPE).communicate()[0][:-1]
54
- # if rev:
55
- # return rev.decode('utf-8')
67
+
56
68
  except Exception as e:
57
69
  print(e)
58
70
  pass
@@ -60,8 +72,17 @@ class Git:
60
72
 
61
73
  @classmethod
62
74
  def LSRemote(
63
- cls, remote=None, ref=None, quiet=True, sudo_as: Optional[str] = None
75
+ cls,
76
+ remote: Optional[str] = None,
77
+ ref: Optional[str] = None,
78
+ quiet: bool = True,
79
+ sudo_as: Optional[str] = None,
80
+ user: Optional[str | int] = None,
81
+ group: Optional[str | int] = None,
82
+ git: StrOrPath = "git",
64
83
  ) -> Optional[Dict[str, str]]:
84
+ if sudo_as is not None:
85
+ warnings.warn("sudo_as is deprecated. Please use user/group instead.", DeprecationWarning)
65
86
  args = []
66
87
  if remote:
67
88
  args.append(remote)
@@ -69,13 +90,15 @@ class Git:
69
90
  args.append(ref)
70
91
  try:
71
92
  ret = cmd_out(
72
- _sudoize(["git", "ls-remote"] + args, sudo_as),
93
+ _sudoize([str(git), "ls-remote"] + args, sudo_as),
73
94
  echo=not quiet,
74
95
  critical=True,
96
+ user=user,
97
+ group=group,
75
98
  )
76
99
  if not ret:
77
100
  return None
78
- # print(repr(ret))
101
+
79
102
  o = {}
80
103
  for line in ret.split("\n"):
81
104
  line = line.strip()
@@ -94,7 +117,7 @@ class Git:
94
117
  return None
95
118
 
96
119
  @classmethod
97
- def OutputIsFatal(cls, output):
120
+ def OutputIsFatal(cls, output: str) -> bool:
98
121
  for line in output.splitlines():
99
122
  if line.startswith("fatal:"):
100
123
  log.critical(output)
@@ -102,11 +125,25 @@ class Git:
102
125
  return False
103
126
 
104
127
  @classmethod
105
- def GetBranch(cls, quiet=True, sudo_as: Optional[str] = None) -> Optional[str]:
128
+ def GetBranch(
129
+ cls,
130
+ quiet: bool = True,
131
+ sudo_as: Optional[str] = None,
132
+ user: Optional[str | int] = None,
133
+ group: Optional[str | int] = None,
134
+ git: StrOrPath = "git",
135
+ ) -> Optional[str]:
136
+ if sudo_as is not None:
137
+ warnings.warn("sudo_as is deprecated. Please use user/group instead.", DeprecationWarning)
106
138
  try:
107
- cmd = ["git", "symbolic-ref", "--short", "HEAD"]
108
- # stderr, stdout = cmd_output(["git", "rev-parse", "--abbrev-ref", 'HEAD', '--'], echo=not quiet, critical=True)
109
- ret = cmd_out(_sudoize(cmd, sudo_as), echo=not quiet, critical=True)
139
+ cmd = [str(git), "symbolic-ref", "--short", "HEAD"]
140
+ ret = cmd_out(
141
+ _sudoize(cmd, sudo_as),
142
+ echo=not quiet,
143
+ critical=True,
144
+ user=user,
145
+ group=group,
146
+ )
110
147
  if ret is None:
111
148
  return None
112
149
  if cls.OutputIsFatal(ret):
@@ -119,14 +156,23 @@ class Git:
119
156
  return None
120
157
 
121
158
  @classmethod
122
- def IsDirty(cls, quiet=True, sudo_as: Optional[str] = None) -> Optional[bool]:
159
+ def IsDirty(
160
+ cls,
161
+ quiet: bool = True,
162
+ sudo_as: Optional[str] = None,
163
+ user: Optional[str | int] = None,
164
+ group: Optional[str | int] = None,
165
+ git: StrOrPath = "git",
166
+ ) -> Optional[bool]:
167
+ if sudo_as is not None:
168
+ warnings.warn("sudo_as is deprecated. Please use user/group instead.", DeprecationWarning)
123
169
  try:
124
- # branch = subprocess.Popen(['git', 'ls-files', '-m', '-o', '-d', '--exclude-standard'], stdout=subprocess.PIPE).communicate()[0][:-1]
125
- # if branch:
126
170
  ret = cmd_out(
127
- ["git", "ls-files", "-m", "-o", "-d", "--exclude-standard"],
171
+ [str(git), "ls-files", "-m", "-o", "-d", "--exclude-standard"],
128
172
  echo=not quiet,
129
173
  critical=True,
174
+ user=user,
175
+ group=group,
130
176
  )
131
177
  if ret is None:
132
178
  return None
@@ -0,0 +1,54 @@
1
+ [project]
2
+ name = "pybuildtools"
3
+ description = "A set of tools for putting together buildscripts and other CLI applications"
4
+ license = "MIT"
5
+ dynamic = ["version"]
6
+ readme = "README.md"
7
+ authors = [{ name = "Rob Nelson", email = "nexisentertainment@gmail.com" }]
8
+ requires-python = '>=3.13,<4.0'
9
+ dependencies = [
10
+ 'ruamel.yaml (>=0.18.14,<0.19.0)',
11
+ 'colorama (>=0.4.6,<0.5.0)',
12
+ 'Jinja2 (==3.1.2)',
13
+ 'lxml (>=6.0.0,<7.0.0)',
14
+ 'MarkupSafe (>=3.0.2,<4.0.0)',
15
+ 'psutil (>=7.0.0,<8.0.0)',
16
+ 'requests (>=2.32.4,<3.0.0)',
17
+ 'six (>=1.17.0,<2.0.0)',
18
+ 'subprocess-tee (>=0.4.2,<0.5.0)',
19
+ 'toml (>=0.10.2,<0.11.0)',
20
+ 'tqdm (>=4.67.1,<5.0.0)',
21
+ ]
22
+
23
+ [project.urls]
24
+ homepage = "https://gitlab.com/N3X15/python-build-tools"
25
+ repository = "https://gitlab.com/N3X15/python-build-tools.git"
26
+
27
+ [project.optional-dependencies]
28
+ nuitka = ['nuitka (>=2.7.12,<3.0.0)']
29
+ pygit2 = ['pygit2 (>=1.18.0,<2.0.0)']
30
+ twisted = ['Twisted (>=25.5.0,<26.0.0)']
31
+ all = ['nuitka', 'Twisted', 'pygit2']
32
+
33
+ [tool.poetry]
34
+ version = "0.7.5"
35
+ packages = [{ include = 'buildtools' }]
36
+ requires-poetry = '>=2.0,<3.0'
37
+
38
+ [tool.poetry.group.dev.dependencies]
39
+ black = { extras = ["d"], version = "^25.1.0" }
40
+ isort = "^6.0.1"
41
+ mypy = { extras = ["d"], version = "^1.17.0" }
42
+ pytest = "^8.4.1"
43
+ twine = "^6.1.0"
44
+ types-requests = "^2.32.4.20250611"
45
+
46
+ [build-system]
47
+ requires = ["poetry-core>=1.0.0"]
48
+ build-backend = "poetry.core.masonry.api"
49
+
50
+ [tool.isort]
51
+ line_length = 200
52
+
53
+ [tool.black]
54
+ line-length = 200
@@ -1,78 +0,0 @@
1
- '''
2
- cmake Wrapper
3
-
4
- Copyright (c) 2015 - 2024 Rob "N3X15" Nelson <nexisentertainment@gmail.com>
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
23
-
24
- '''
25
- import os, subprocess
26
-
27
- from buildtools.bt_logging import log
28
- from buildtools.os_utils import cmd, ENV, BuildEnv
29
-
30
- class CMake(object):
31
- @classmethod
32
- def GetVersion(cls):
33
- rev = subprocess.Popen(['cmake', '--version'], stdout=subprocess.PIPE).communicate()[0][:-1]
34
- if rev:
35
- return rev.decode('utf-8').split()[2]
36
-
37
- def __init__(self):
38
- self.flags = {}
39
- self.generator = None
40
-
41
- def setFlag(self, key, val):
42
- log.info('CMake: {} = {}'.format(key, val))
43
- self.flags[key] = val
44
-
45
- def build(self, CMAKE='cmake', dir='.', env=None, target=None, moreflags=None, env_dump=False):
46
- if moreflags is None:
47
- moreflags=[]
48
- if env is None:
49
- env = ENV.toDict()
50
- flags = ['--build', dir]
51
- if target is not None:
52
- moreflags += ['--target', target]
53
-
54
- flags += moreflags
55
-
56
- with log.info('Running CMake --build:'):
57
- if env_dump: BuildEnv.dump(env)
58
- return cmd([CMAKE] + flags, env=env, critical=True, echo=True)
59
-
60
- def run(self, CMAKE='cmake', env=None, dir='.', moreflags=None, env_dump=False):
61
- if env is None:
62
- env = ENV.toDict()
63
- if moreflags is None:
64
- moreflags=[]
65
- flags = []
66
-
67
- if self.generator is not None:
68
- flags += ['-G', self.generator]
69
-
70
- for key, value in self.flags.items():
71
- flags += ['-D{0}={1}'.format(key, value)]
72
-
73
- flags += moreflags
74
-
75
- with log.info('Running CMake:'):
76
- if env_dump: BuildEnv.dump(env)
77
- return cmd([CMAKE] + flags + [dir], env=env, critical=True, echo=True)
78
- return False
@@ -1,57 +0,0 @@
1
- [tool.poetry]
2
- name = "pybuildtools"
3
- version = "0.7.3"
4
- description = "A set of tools for putting together buildscripts and other CLI applications"
5
- authors = ["Rob Nelson <nexisentertainment@gmail.com>"]
6
- license = "MIT"
7
- readme = "README.md"
8
- homepage = "https://gitlab.com/N3X15/python-build-tools"
9
- repository = "https://gitlab.com/N3X15/python-build-tools.git"
10
- packages = [{ include = 'buildtools' }]
11
-
12
- [tool.poetry.dependencies]
13
- python = ">=3.9,<4.0"
14
- colorama = "^0.4.6"
15
- Jinja2 = "3.1.2"
16
- psutil = "^6.0.0"
17
- lxml = "^5.3.0"
18
- pygit2 = "^1.15.1"
19
- requests = "^2.32.3"
20
- "ruamel.yaml" = "^0.18.6"
21
- six = "^1.16.0"
22
- toml = "^0.10.2"
23
- tqdm = "^4.66.5"
24
- Twisted = { version = "^24.7.0", optional = true }
25
- PyQt5 = { version = "^5.15.11", optional = true }
26
- #Nuitka = {git="https://github.com/Nuitka/Nuitka.git",branch="develop",optional=true}
27
- MarkupSafe = "^2.1.5"
28
- subprocess-tee = "^0.4.1"
29
- nuitka = { version = "^2.4.8", optional = true }
30
-
31
- [tool.poetry.extras]
32
- twisted = ["Twisted"]
33
- pyqt5 = ["PyQt5"]
34
- nuitka = ["nuitka"]
35
- all = ["nuitka", 'PyQt5', 'Twisted']
36
- # all = ['PyQt5','Twisted']
37
-
38
- [tool.poetry.group.dev.dependencies]
39
- build = "^1.2.2"
40
- isort = "^5.13.2"
41
- mypy = { extras = ["d"], version = "^1.11.2" }
42
- pytest = "^8.3.3"
43
- twine = "^5.1.1"
44
- autopep8 = "^2.3.1"
45
- types-requests = "^2.32.0.20240914"
46
- black = { extras = ["d"], version = "^24.8.0" }
47
-
48
- [build-system]
49
- requires = ["poetry-core>=1.0.0"]
50
- build-backend = "poetry.core.masonry.api"
51
-
52
- [tool.autopep8]
53
- max_line_length = 200
54
- ignore = ['E6', 'E501']
55
-
56
- [tool.isort]
57
- line_length = 200
File without changes