pybuildtools 0.7.6__tar.gz → 0.7.7__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.
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/PKG-INFO +19 -19
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/__init__.py +6 -5
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/_os_utils_linux.py +29 -27
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/_os_utils_win32.py +47 -40
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/as3.py +22 -20
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/bt_logging.py +44 -38
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/buildsystem/CCompiler.py +11 -9
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/buildsystem/__init__.py +3 -2
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/buildsystem/baseproject.py +12 -10
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/buildsystem/msbuild.py +11 -9
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/buildsystem/prebuild.py +65 -64
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/buildsystem/visualstudio.py +159 -189
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/cli/nuitka_plus/README.md +1 -1
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/cli/nuitka_plus/__main__.py +11 -9
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/cli.py +29 -21
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/config.py +53 -40
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/consts.py +10 -9
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/error.py +8 -5
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/ext/salt/jinja_ext.py +82 -129
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/http.py +23 -23
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/indentation.py +35 -36
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/lxml_utils.py +3 -2
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/maestro/__init__.py +14 -34
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/maestro/base_target.py +79 -88
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/maestro/coffeescript.py +44 -44
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/maestro/convert_data.py +33 -28
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/maestro/docs.py +10 -19
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/maestro/enumwriters/coffee.py +53 -55
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/maestro/enumwriters/enumwriter.py +2 -2
- pybuildtools-0.7.7/buildtools/maestro/enumwriters/php.py +175 -0
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/maestro/enumwriters/python.py +21 -21
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/maestro/enumwriters/types.py +48 -49
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/maestro/fileio.py +121 -150
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/maestro/genenum.py +9 -9
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/maestro/git.py +60 -58
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/maestro/jinja2.py +19 -13
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/maestro/nuitka.py +3 -2
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/maestro/package_managers.py +72 -55
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/maestro/shell.py +22 -24
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/maestro/utils.py +7 -6
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/maestro/web.py +26 -99
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/os_utils.py +3 -2
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/paths.py +5 -6
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/posix/elf.py +35 -30
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/pygit2_callbacks.py +20 -21
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/qconfig5.py +13 -13
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/repo/base.py +3 -2
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/repo/git.py +10 -14
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/repo/hg.py +53 -51
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/timing.py +13 -14
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/twisted_utils.py +46 -47
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/types.py +7 -6
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/utils.py +4 -5
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/wrapper/__init__.py +6 -5
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/wrapper/ant.py +19 -16
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/wrapper/ccache.py +20 -18
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/wrapper/cmake.py +1 -25
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/wrapper/cotire.py +3 -2
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/wrapper/distcc.py +4 -5
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/wrapper/fpm.py +52 -49
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/wrapper/git.py +2 -26
- pybuildtools-0.7.7/pyproject.toml +58 -0
- pybuildtools-0.7.6/buildtools/maestro/enumwriters/php.py +0 -182
- pybuildtools-0.7.6/pyproject.toml +0 -54
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/LICENSE +0 -0
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/README.md +0 -0
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/buildsystem/gcc.py +0 -0
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/cli/__init__.py +0 -0
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/cli/nuitka_plus/__init__.py +0 -0
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/ext/__init__.py +0 -0
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/ext/salt/__init__.py +0 -0
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/maestro/enumwriters/__init__.py +0 -0
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/posix/__init__.py +0 -0
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/repo/__init__.py +0 -0
- {pybuildtools-0.7.6 → pybuildtools-0.7.7}/buildtools/wrapper/repo/__init__.py +0 -0
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pybuildtools
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.7
|
|
4
4
|
Summary: A set of tools for putting together buildscripts and other CLI applications
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
License-File: LICENSE
|
|
7
7
|
Author: Rob Nelson
|
|
8
8
|
Author-email: nexisentertainment@gmail.com
|
|
9
9
|
Requires-Python: >=3.13,<4.0
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.13
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.14
|
|
13
13
|
Provides-Extra: all
|
|
14
14
|
Provides-Extra: nuitka
|
|
15
15
|
Provides-Extra: pygit2
|
|
16
16
|
Provides-Extra: twisted
|
|
17
|
-
Requires-Dist:
|
|
18
|
-
Requires-Dist:
|
|
19
|
-
Requires-Dist:
|
|
20
|
-
Requires-Dist:
|
|
21
|
-
Requires-Dist:
|
|
22
|
-
Requires-Dist:
|
|
23
|
-
Requires-Dist:
|
|
24
|
-
Requires-Dist:
|
|
25
|
-
Requires-Dist:
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
Requires-Dist:
|
|
28
|
-
Requires-Dist:
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist:
|
|
31
|
-
Requires-Dist:
|
|
32
|
-
Requires-Dist:
|
|
33
|
-
Requires-Dist:
|
|
17
|
+
Requires-Dist: colorama (>=0.4.6,<0.5)
|
|
18
|
+
Requires-Dist: jinja2 (==3.1)
|
|
19
|
+
Requires-Dist: lxml (>=6.0.2,<7)
|
|
20
|
+
Requires-Dist: markupsafe (>=3.0.3,<4)
|
|
21
|
+
Requires-Dist: nuitka (>=2.8.9,<3) ; extra == "all"
|
|
22
|
+
Requires-Dist: nuitka (>=2.8.9,<3) ; extra == "nuitka"
|
|
23
|
+
Requires-Dist: psutil (>=7.1.3,<8)
|
|
24
|
+
Requires-Dist: pygit2 (>=1.19,<2) ; extra == "all"
|
|
25
|
+
Requires-Dist: pygit2 (>=1.19,<2) ; extra == "pygit2"
|
|
26
|
+
Requires-Dist: requests (>=2.32.5,<3)
|
|
27
|
+
Requires-Dist: ruamel-yaml (>=0.18.16,<0.19)
|
|
28
|
+
Requires-Dist: six (>=1.17,<2)
|
|
29
|
+
Requires-Dist: subprocess-tee (>=0.4.2,<0.5)
|
|
30
|
+
Requires-Dist: toml (>=0.10.2,<0.11)
|
|
31
|
+
Requires-Dist: tqdm (>=4.67.1,<5)
|
|
32
|
+
Requires-Dist: twisted (>=25.5,<26) ; extra == "all"
|
|
33
|
+
Requires-Dist: twisted (>=25.5,<26) ; extra == "twisted"
|
|
34
34
|
Project-URL: Homepage, https://gitlab.com/N3X15/python-build-tools
|
|
35
35
|
Project-URL: Repository, https://gitlab.com/N3X15/python-build-tools.git
|
|
36
36
|
Description-Content-Type: text/markdown
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"""
|
|
2
2
|
Main Module.
|
|
3
3
|
|
|
4
4
|
Copyright (c) 2015 - 2025 Rob "N3X15" Nelson <nexisentertainment@gmail.com>
|
|
@@ -21,9 +21,10 @@ 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
|
-
|
|
25
|
-
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
__all__ = ["YAMLConfig", "Chdir", "cmd", "log", "Properties", "replace_vars", "cmd", "ENV", "BuildEnv", "cmd_output", "cmd_daemonize"]
|
|
26
27
|
|
|
27
|
-
from buildtools.config import YAMLConfig, Properties, replace_vars
|
|
28
|
-
from buildtools.os_utils import Chdir, cmd, ENV, BuildEnv, cmd_daemonize, cmd_output
|
|
29
28
|
from buildtools.bt_logging import log
|
|
29
|
+
from buildtools.config import Properties, YAMLConfig, replace_vars
|
|
30
|
+
from buildtools.os_utils import ENV, BuildEnv, Chdir, cmd, cmd_daemonize, cmd_output
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"""
|
|
2
2
|
Linux-specific part of os_utils.
|
|
3
3
|
|
|
4
4
|
Copyright (c) 2015 - 2025 Rob "N3X15" Nelson <nexisentertainment@gmail.com>
|
|
@@ -21,9 +21,10 @@ 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
|
-
|
|
25
|
-
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
26
|
import os
|
|
27
|
+
import sys
|
|
27
28
|
from typing import Iterable, List
|
|
28
29
|
|
|
29
30
|
from buildtools.bt_logging import log
|
|
@@ -32,66 +33,67 @@ from buildtools.paths import SCRIPTS_DIR
|
|
|
32
33
|
cmd_output = None
|
|
33
34
|
ENV = None
|
|
34
35
|
|
|
36
|
+
|
|
35
37
|
def InstallDpkgPackages(packages: Iterable[str]) -> None:
|
|
36
38
|
import apt # IGNORE:import-error
|
|
37
|
-
|
|
39
|
+
|
|
40
|
+
with log.info("Checking dpkg packages..."):
|
|
38
41
|
cache = apt.Cache()
|
|
39
42
|
num_changes = 0
|
|
40
43
|
with cache.actiongroup():
|
|
41
44
|
for pkg in packages:
|
|
42
45
|
if pkg not in cache:
|
|
43
|
-
log.critical(
|
|
46
|
+
log.critical("UNKNOWN APT PACKAGE {}!".format(pkg))
|
|
44
47
|
sys.exit(1)
|
|
45
48
|
package = cache[pkg]
|
|
46
49
|
if not package.is_installed:
|
|
47
50
|
package.mark_install()
|
|
48
51
|
num_changes += 1
|
|
49
52
|
if num_changes == 0:
|
|
50
|
-
log.info(
|
|
53
|
+
log.info("No changes required, skipping.")
|
|
51
54
|
return
|
|
52
55
|
|
|
53
|
-
cache.commit(apt.progress.text.AcquireProgress(),
|
|
54
|
-
apt.progress.base.InstallProgress())
|
|
56
|
+
cache.commit(apt.progress.text.AcquireProgress(), apt.progress.base.InstallProgress())
|
|
55
57
|
|
|
56
58
|
|
|
57
59
|
def GetDpkgShlibs(files: List[str]):
|
|
58
60
|
deps = {}
|
|
59
|
-
stdout, stderr = cmd_output([
|
|
61
|
+
stdout, stderr = cmd_output(["perl", os.path.join(SCRIPTS_DIR, "dpkg-dump-shpkgs.pl")] + files, critical=True)
|
|
60
62
|
if stdout or stderr:
|
|
61
|
-
for line in (stdout + stderr).decode(
|
|
63
|
+
for line in (stdout + stderr).decode("utf-8").split("\n"):
|
|
62
64
|
line = line.strip()
|
|
63
|
-
if line ==
|
|
65
|
+
if line == "":
|
|
64
66
|
continue
|
|
65
67
|
# dpkg-dump-shpkgs.pl: warning: binaries to analyze should already
|
|
66
68
|
# be installed in their package's directory
|
|
67
|
-
if
|
|
68
|
-
(_, msgtype, msg) = [x.strip() for x in line.split(
|
|
69
|
-
if msg ==
|
|
69
|
+
if "dpkg-dump-shpkgs.pl:" in line:
|
|
70
|
+
(_, msgtype, msg) = [x.strip() for x in line.split(":")]
|
|
71
|
+
if msg == "binaries to analyze should already be installed in their package's directory":
|
|
70
72
|
continue
|
|
71
|
-
if msgtype ==
|
|
73
|
+
if msgtype == "warning":
|
|
72
74
|
log.warning(msg)
|
|
73
|
-
elif msgtype ==
|
|
75
|
+
elif msgtype == "error":
|
|
74
76
|
log.error(msg)
|
|
75
77
|
continue
|
|
76
|
-
elif line.startswith(
|
|
78
|
+
elif line.startswith("shlibs:"):
|
|
77
79
|
# shlibs:Depends=libboost-context1.55.0,
|
|
78
80
|
# libboost-filesystem1.55.0, libboost-program-options1.55.0,
|
|
79
81
|
# ...
|
|
80
|
-
lc = line.split(
|
|
82
|
+
lc = line.split("=", 1)
|
|
81
83
|
assert len(lc) == 2
|
|
82
|
-
assert not lc[0][7:].startswith(
|
|
83
|
-
deps[lc[0][7:]] = [x.strip() for x in lc[1].split(
|
|
84
|
+
assert not lc[0][7:].startswith(":")
|
|
85
|
+
deps[lc[0][7:]] = [x.strip() for x in lc[1].split(",")]
|
|
84
86
|
else:
|
|
85
|
-
log.warning(
|
|
87
|
+
log.warning("UNHANDLED: %s", line)
|
|
86
88
|
return deps
|
|
87
89
|
|
|
88
90
|
|
|
89
91
|
def DpkgSearchFiles(files):
|
|
90
|
-
|
|
92
|
+
"""Find packages for a given set of files."""
|
|
91
93
|
|
|
92
|
-
stdout, stderr = cmd_output([
|
|
94
|
+
stdout, stderr = cmd_output(["dpkg", "--search"] + files, critical=True)
|
|
93
95
|
|
|
94
|
-
|
|
96
|
+
"""
|
|
95
97
|
libc6:amd64: /lib/x86_64-linux-gnu/libc-2.19.so
|
|
96
98
|
libcap2:amd64: /lib/x86_64-linux-gnu/libcap.so.2
|
|
97
99
|
libcap2:amd64: /lib/x86_64-linux-gnu/libcap.so.2.24
|
|
@@ -104,13 +106,13 @@ def DpkgSearchFiles(files):
|
|
|
104
106
|
libcryptsetup4:amd64: /lib/x86_64-linux-gnu/libcryptsetup.so.4.6.0
|
|
105
107
|
libc6:amd64: /lib/x86_64-linux-gnu/libcrypt.so.1
|
|
106
108
|
libc6:amd64: /lib/x86_64-linux-gnu/libc.so.6
|
|
107
|
-
|
|
109
|
+
"""
|
|
108
110
|
|
|
109
111
|
packages = []
|
|
110
112
|
if stdout or stderr:
|
|
111
|
-
for line in (stdout + stderr).decode(
|
|
113
|
+
for line in (stdout + stderr).decode("utf-8").split("\n"):
|
|
112
114
|
line = line.strip()
|
|
113
|
-
if line ==
|
|
115
|
+
if line == "":
|
|
114
116
|
continue
|
|
115
117
|
|
|
116
118
|
chunks = line.split()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"""
|
|
2
2
|
Windows-Specific os_utils.
|
|
3
3
|
|
|
4
4
|
Copyright (c) 2015 - 2025 Rob "N3X15" Nelson <nexisentertainment@gmail.com>
|
|
@@ -21,11 +21,12 @@ 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
|
-
|
|
25
|
-
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
26
|
import codecs
|
|
27
27
|
import ctypes
|
|
28
|
-
|
|
28
|
+
import sys
|
|
29
|
+
from ctypes.wintypes import HWND, LPARAM, LPVOID, UINT, WPARAM
|
|
29
30
|
|
|
30
31
|
from buildtools.bt_logging import log
|
|
31
32
|
|
|
@@ -33,19 +34,21 @@ LRESULT = LPARAM
|
|
|
33
34
|
|
|
34
35
|
cmd_output = None
|
|
35
36
|
ENV = None
|
|
37
|
+
|
|
38
|
+
|
|
36
39
|
class RegistryKey:
|
|
37
40
|
def __init__(self, hkey, key):
|
|
38
|
-
log.debug(
|
|
41
|
+
log.debug("Python version: 0x%0.8X" % sys.hexversion)
|
|
39
42
|
if sys.hexversion > 0x03000000:
|
|
40
|
-
import winreg
|
|
43
|
+
import winreg # IGNORE:import-error
|
|
41
44
|
else:
|
|
42
|
-
import _winreg as winreg
|
|
45
|
+
import _winreg as winreg # IGNORE:import-error
|
|
43
46
|
self.winreg = winreg
|
|
44
47
|
self.hkey = hkey
|
|
45
48
|
self.key = key
|
|
46
49
|
|
|
47
|
-
self._reg=None
|
|
48
|
-
self._key=None
|
|
50
|
+
self._reg = None
|
|
51
|
+
self._key = None
|
|
49
52
|
|
|
50
53
|
def __enter__(self):
|
|
51
54
|
self._reg = self.winreg.ConnectRegistry(None, self.hkey)
|
|
@@ -60,7 +63,7 @@ class RegistryKey:
|
|
|
60
63
|
try:
|
|
61
64
|
value = self.winreg.QueryValueEx(self._key, name)[0]
|
|
62
65
|
except WindowsError:
|
|
63
|
-
#if default is self.NO_DEFAULT_PROVIDED:
|
|
66
|
+
# if default is self.NO_DEFAULT_PROVIDED:
|
|
64
67
|
# raise ValueError("No such registry key", name)
|
|
65
68
|
value = default
|
|
66
69
|
return value
|
|
@@ -71,8 +74,10 @@ class RegistryKey:
|
|
|
71
74
|
else:
|
|
72
75
|
self.winreg.DeleteValue(self._key, name)
|
|
73
76
|
|
|
77
|
+
|
|
74
78
|
class WindowsEnv:
|
|
75
79
|
"""Utility class to get/set windows environment variable"""
|
|
80
|
+
|
|
76
81
|
HWND_BROADCAST = 0xFFFF
|
|
77
82
|
WM_SETTINGCHANGE = 0x1A
|
|
78
83
|
NO_DEFAULT_PROVIDED = object()
|
|
@@ -81,20 +86,20 @@ class WindowsEnv:
|
|
|
81
86
|
SendMessage.restype = LRESULT
|
|
82
87
|
|
|
83
88
|
def __init__(self, scope):
|
|
84
|
-
log.debug(
|
|
89
|
+
log.debug("Python version: 0x%0.8X" % sys.hexversion)
|
|
85
90
|
if sys.hexversion > 0x03000000:
|
|
86
|
-
import winreg
|
|
91
|
+
import winreg # IGNORE:import-error
|
|
87
92
|
else:
|
|
88
|
-
import _winreg as winreg
|
|
93
|
+
import _winreg as winreg # IGNORE:import-error
|
|
89
94
|
self.winreg = winreg
|
|
90
|
-
assert scope in (
|
|
95
|
+
assert scope in ("user", "system")
|
|
91
96
|
self.scope = scope
|
|
92
|
-
if scope ==
|
|
97
|
+
if scope == "user":
|
|
93
98
|
self.root = self.winreg.HKEY_CURRENT_USER
|
|
94
|
-
self.subkey =
|
|
99
|
+
self.subkey = "Environment"
|
|
95
100
|
else:
|
|
96
101
|
self.root = self.winreg.HKEY_LOCAL_MACHINE
|
|
97
|
-
self.subkey =
|
|
102
|
+
self.subkey = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"
|
|
98
103
|
|
|
99
104
|
def get(self, name, default=None):
|
|
100
105
|
with RegistryKey(self.root, self.subkey) as key:
|
|
@@ -105,30 +110,32 @@ class WindowsEnv:
|
|
|
105
110
|
return key.set(name, self.winreg.REG_EXPAND_SZ, value)
|
|
106
111
|
|
|
107
112
|
def notify(self):
|
|
108
|
-
self.SendMessage(self.HWND_BROADCAST, self.WM_SETTINGCHANGE, 0,
|
|
113
|
+
self.SendMessage(self.HWND_BROADCAST, self.WM_SETTINGCHANGE, 0, "Environment")
|
|
114
|
+
|
|
109
115
|
|
|
110
|
-
def getVSVars(vspath, arch=
|
|
111
|
-
|
|
116
|
+
def getVSVars(vspath, arch="x86", batfile=None, env=ENV):
|
|
117
|
+
"""
|
|
112
118
|
:param batfile:
|
|
113
119
|
Location to place the batch file.
|
|
114
|
-
|
|
120
|
+
"""
|
|
115
121
|
if batfile is None:
|
|
116
|
-
batfile=
|
|
117
|
-
#C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat
|
|
118
|
-
with codecs.open(batfile,
|
|
119
|
-
f.write(
|
|
120
|
-
f.write('echo call "{}\\vcvarsall.bat" {}\r\n'.format(vspath,arch))
|
|
121
|
-
f.write('call "{}\\vcvarsall.bat" {}\r\n'.format(vspath,arch))
|
|
122
|
-
f.write(
|
|
123
|
-
f.write(
|
|
124
|
-
f.write(
|
|
125
|
-
f.write(
|
|
126
|
-
f.write(
|
|
127
|
-
stdout, stderr = cmd_output([
|
|
128
|
-
inVSVars=False
|
|
129
|
-
for line in (stdout + stderr).decode(
|
|
130
|
-
#print(line)
|
|
131
|
-
if inVSVars and
|
|
132
|
-
k,v=line.split(
|
|
133
|
-
env.set(k,v,noisy=True)
|
|
134
|
-
if line ==
|
|
122
|
+
batfile = "getvsvars.bat"
|
|
123
|
+
# C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat
|
|
124
|
+
with codecs.open(batfile, "w", encoding="utf-8") as f:
|
|
125
|
+
f.write("@echo off\r\n")
|
|
126
|
+
f.write('echo call "{}\\vcvarsall.bat" {}\r\n'.format(vspath, arch))
|
|
127
|
+
f.write('call "{}\\vcvarsall.bat" {}\r\n'.format(vspath, arch))
|
|
128
|
+
f.write("echo ###\r\n")
|
|
129
|
+
f.write("echo INCLUDE=%INCLUDE%\r\n")
|
|
130
|
+
f.write("echo LIB=%LIB%\r\n")
|
|
131
|
+
f.write("echo LIBPATH=%LIBPATH%\r\n")
|
|
132
|
+
f.write("echo PATH=%PATH%\r\n")
|
|
133
|
+
stdout, stderr = cmd_output(["cmd", "/c", batfile], echo=True, critical=True)
|
|
134
|
+
inVSVars = False
|
|
135
|
+
for line in (stdout + stderr).decode("utf-8").splitlines():
|
|
136
|
+
# print(line)
|
|
137
|
+
if inVSVars and "=" in line:
|
|
138
|
+
k, v = line.split("=", 1)
|
|
139
|
+
env.set(k, v, noisy=True)
|
|
140
|
+
if line == "###":
|
|
141
|
+
inVSVars = True
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"""
|
|
2
2
|
ActionScript3-related shit
|
|
3
3
|
|
|
4
4
|
Copyright (c) 2015 - 2025 Rob "N3X15" Nelson <nexisentertainment@gmail.com>
|
|
@@ -21,7 +21,7 @@ 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
|
|
|
26
26
|
import os
|
|
27
27
|
import re
|
|
@@ -30,17 +30,18 @@ from typing import Container, Iterable, Mapping, Set, Union
|
|
|
30
30
|
|
|
31
31
|
from .indentation import getIndentChars
|
|
32
32
|
|
|
33
|
-
_REG_IMPORT_STOP_A = re.compile(r
|
|
34
|
-
_REG_IMPORT_STOP_B = re.compile(r
|
|
35
|
-
_REG_IMPORT = re.compile(r
|
|
33
|
+
_REG_IMPORT_STOP_A = re.compile(r"(public|private) (class|function)")
|
|
34
|
+
_REG_IMPORT_STOP_B = re.compile(r"/\*\*")
|
|
35
|
+
_REG_IMPORT = re.compile(r"import ([a-zA-Z0-9_\.\*]+);")
|
|
36
|
+
|
|
36
37
|
|
|
37
38
|
def calculateNewImports(readImports: Container[str], requiredImports: Iterable[str]) -> Set[str]:
|
|
38
39
|
# print(repr(readImports))
|
|
39
40
|
newImports = set()
|
|
40
41
|
for imp in requiredImports:
|
|
41
|
-
chunks = imp.split(
|
|
42
|
-
chunks[-1] =
|
|
43
|
-
genimport =
|
|
42
|
+
chunks = imp.split(".")
|
|
43
|
+
chunks[-1] = "*"
|
|
44
|
+
genimport = ".".join(chunks)
|
|
44
45
|
if genimport in readImports or imp in readImports:
|
|
45
46
|
continue
|
|
46
47
|
else:
|
|
@@ -48,9 +49,9 @@ def calculateNewImports(readImports: Container[str], requiredImports: Iterable[s
|
|
|
48
49
|
return newImports
|
|
49
50
|
|
|
50
51
|
|
|
51
|
-
def ensureConditionalImports(filename: Union[str, Path], matchToImports: Mapping[str, Iterable[str]], sort: bool=False) -> None:
|
|
52
|
+
def ensureConditionalImports(filename: Union[str, Path], matchToImports: Mapping[str, Iterable[str]], sort: bool = False) -> None:
|
|
52
53
|
requires = set()
|
|
53
|
-
with open(filename,
|
|
54
|
+
with open(filename, "r") as f:
|
|
54
55
|
for line in f:
|
|
55
56
|
line = line.strip()
|
|
56
57
|
for match, imports in matchToImports.items():
|
|
@@ -68,26 +69,27 @@ def _reg_matches(line, regex, action=None):
|
|
|
68
69
|
return True
|
|
69
70
|
return False
|
|
70
71
|
|
|
71
|
-
|
|
72
|
+
|
|
73
|
+
def ensureImportsExist(filename: Union[str, Path], requiredImports: Iterable[str], sort: bool = False) -> None:
|
|
72
74
|
readImports: Set[str] = set()
|
|
73
75
|
subject: Path = Path(filename)
|
|
74
|
-
subject_tmp: Path = subject.with_suffix(subject.suffix+
|
|
75
|
-
with subject.open(
|
|
76
|
-
with subject_tmp.open(
|
|
76
|
+
subject_tmp: Path = subject.with_suffix(subject.suffix + ".tmp")
|
|
77
|
+
with subject.open("r") as f:
|
|
78
|
+
with subject_tmp.open("w") as w:
|
|
77
79
|
ln = 0
|
|
78
|
-
#lastIndent = ''
|
|
80
|
+
# lastIndent = ''
|
|
79
81
|
writingImports = True
|
|
80
82
|
for line in f:
|
|
81
83
|
ln += 1
|
|
82
84
|
oline = line
|
|
83
|
-
currentLine = line.lstrip().strip(
|
|
85
|
+
currentLine = line.lstrip().strip("\r\n")
|
|
84
86
|
indent = getIndentChars(oline)
|
|
85
87
|
line = line.strip()
|
|
86
88
|
if writingImports:
|
|
87
89
|
m = _REG_IMPORT.search(line)
|
|
88
90
|
if m is not None:
|
|
89
91
|
readImports.add(m.group(1))
|
|
90
|
-
#lastIndent = indent
|
|
92
|
+
# lastIndent = indent
|
|
91
93
|
if sort:
|
|
92
94
|
continue
|
|
93
95
|
if _reg_matches(line, _REG_IMPORT_STOP_A) or _reg_matches(line, _REG_IMPORT_STOP_B):
|
|
@@ -96,8 +98,8 @@ def ensureImportsExist(filename: Union[str, Path], requiredImports: Iterable[str
|
|
|
96
98
|
added |= readImports
|
|
97
99
|
if added:
|
|
98
100
|
for newImport in sorted(added):
|
|
99
|
-
w.write(f
|
|
100
|
-
w.write(
|
|
101
|
+
w.write(f"{indent}import {newImport};\n")
|
|
102
|
+
w.write("\n")
|
|
101
103
|
writingImports = False
|
|
102
|
-
w.write(indent + currentLine +
|
|
104
|
+
w.write(indent + currentLine + "\n")
|
|
103
105
|
os.replace(subject_tmp, subject)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"""
|
|
2
2
|
Logging stuff.
|
|
3
3
|
|
|
4
4
|
Copyright (c) 2015 - 2025 Rob "N3X15" Nelson <nexisentertainment@gmail.com>
|
|
@@ -21,13 +21,15 @@ 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
26
|
import logging
|
|
26
27
|
import os
|
|
27
28
|
import re
|
|
28
29
|
|
|
29
30
|
import colorama
|
|
30
31
|
|
|
32
|
+
|
|
31
33
|
class NullIndenter(object):
|
|
32
34
|
def __enter__(self):
|
|
33
35
|
return self
|
|
@@ -35,46 +37,51 @@ class NullIndenter(object):
|
|
|
35
37
|
def __exit__(self, type, value, traceback):
|
|
36
38
|
return False
|
|
37
39
|
|
|
40
|
+
|
|
38
41
|
# Regular expression used to detect color tags for colorize()
|
|
39
|
-
_REGEX_COLOR = re.compile(r
|
|
40
|
-
|
|
41
|
-
_COLORSTART=
|
|
42
|
-
_COLOREND=
|
|
43
|
-
|
|
44
|
-
_COLORS={
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
_REGEX_COLOR = re.compile(r"<(red|green|yellow|blue|magenta|cyan|white)>([^<]+)</\1>")
|
|
43
|
+
|
|
44
|
+
_COLORSTART = "\033["
|
|
45
|
+
_COLOREND = "m"
|
|
46
|
+
|
|
47
|
+
_COLORS = {
|
|
48
|
+
"red": 31,
|
|
49
|
+
"green": 32,
|
|
50
|
+
"yellow": 33,
|
|
51
|
+
"blue": 34,
|
|
52
|
+
"magenta": 35,
|
|
53
|
+
"cyan": 36,
|
|
54
|
+
"white": 37,
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
INDENT = 0
|
|
55
58
|
|
|
59
|
+
|
|
56
60
|
def encodeColor(colorID):
|
|
57
|
-
return _COLORSTART+str(colorID)+_COLOREND
|
|
61
|
+
return _COLORSTART + str(colorID) + _COLOREND
|
|
62
|
+
|
|
58
63
|
|
|
59
64
|
def _colorWrapper(m):
|
|
60
|
-
colorName=m.group(1)
|
|
65
|
+
colorName = m.group(1)
|
|
61
66
|
text = m.group(2)
|
|
62
|
-
colorID=_COLORS[colorName]
|
|
63
|
-
return encodeColor(colorID)+text+encodeColor(0)
|
|
67
|
+
colorID = _COLORS[colorName]
|
|
68
|
+
return encodeColor(colorID) + text + encodeColor(0)
|
|
69
|
+
|
|
64
70
|
|
|
65
71
|
def colorize(text):
|
|
66
|
-
return _REGEX_COLOR.sub(_colorWrapper,text)
|
|
72
|
+
return _REGEX_COLOR.sub(_colorWrapper, text)
|
|
73
|
+
|
|
67
74
|
|
|
68
75
|
class IndentLogger:
|
|
69
|
-
|
|
76
|
+
"""
|
|
70
77
|
Indents stuff.
|
|
71
|
-
|
|
78
|
+
"""
|
|
72
79
|
|
|
73
80
|
INDENT = 0
|
|
74
81
|
|
|
75
82
|
def __init__(self, logger=None):
|
|
76
83
|
self.log = logger
|
|
77
|
-
self.useAnsiColors=False
|
|
84
|
+
self.useAnsiColors = False
|
|
78
85
|
if isinstance(self.log, str):
|
|
79
86
|
self.log = logging.getLogger(self.log)
|
|
80
87
|
if self.log is None:
|
|
@@ -88,8 +95,8 @@ class IndentLogger:
|
|
|
88
95
|
self.INDENT -= 1
|
|
89
96
|
return False
|
|
90
97
|
|
|
91
|
-
def enableANSIColors(self,on=True):
|
|
92
|
-
self.useAnsiColors=on
|
|
98
|
+
def enableANSIColors(self, on=True):
|
|
99
|
+
self.useAnsiColors = on
|
|
93
100
|
if self.useAnsiColors:
|
|
94
101
|
colorama.init(convert=True)
|
|
95
102
|
else:
|
|
@@ -153,7 +160,7 @@ class IndentLogger:
|
|
|
153
160
|
"""
|
|
154
161
|
Convenience method for logging an ERROR with exception information.
|
|
155
162
|
"""
|
|
156
|
-
kwargs[
|
|
163
|
+
kwargs["exc_info"] = 1
|
|
157
164
|
self.error(msg, *args, **kwargs)
|
|
158
165
|
return self
|
|
159
166
|
|
|
@@ -172,30 +179,28 @@ class IndentLogger:
|
|
|
172
179
|
|
|
173
180
|
def _log(self, level, msg, args, exc_info=None, extra=None):
|
|
174
181
|
if self.useAnsiColors:
|
|
175
|
-
msg=colorize(msg)
|
|
182
|
+
msg = colorize(msg)
|
|
176
183
|
if isinstance(msg, str):
|
|
177
|
-
indent = self.INDENT *
|
|
184
|
+
indent = self.INDENT * " "
|
|
178
185
|
self.log._log(level, indent + msg, args, exc_info, extra)
|
|
179
186
|
else:
|
|
180
187
|
self.log._log(level, msg, args, exc_info, extra)
|
|
181
188
|
|
|
182
189
|
|
|
183
|
-
logging.basicConfig(
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
level=logging.INFO)
|
|
187
|
-
# filename='logs/main.log',
|
|
188
|
-
# filemode='w')
|
|
190
|
+
logging.basicConfig(format="%(asctime)s [%(levelname)-8s]: %(message)s", datefmt="%m/%d/%Y %I:%M:%S %p", level=logging.INFO)
|
|
191
|
+
# filename='logs/main.log',
|
|
192
|
+
# filemode='w')
|
|
189
193
|
|
|
190
|
-
|
|
191
|
-
|
|
194
|
+
|
|
195
|
+
def logToFile(logID, mode="w", level=logging.INFO, sub_dir=None, start_message="Logging started", announce_location=False, formatter=None):
|
|
196
|
+
basedir = "logs"
|
|
192
197
|
if sub_dir is not None:
|
|
193
198
|
basedir = os.path.join(basedir, sub_dir)
|
|
194
199
|
if not os.path.isdir(basedir):
|
|
195
200
|
os.makedirs(basedir)
|
|
196
|
-
logfile = os.path.join(basedir, logID +
|
|
201
|
+
logfile = os.path.join(basedir, logID + ".log")
|
|
197
202
|
log = logging.getLogger(logID)
|
|
198
|
-
logging.info(
|
|
203
|
+
logging.info("Opening %s log at %s (mode: %s)...", logID, logfile, mode)
|
|
199
204
|
if len(log.handlers) == 0:
|
|
200
205
|
# if os.path.isfile(logfile):
|
|
201
206
|
# os.remove(logfile)
|
|
@@ -208,6 +213,7 @@ def logToFile(logID, mode='w', level=logging.INFO, sub_dir=None, start_message='
|
|
|
208
213
|
log.info(start_message)
|
|
209
214
|
return log
|
|
210
215
|
|
|
216
|
+
|
|
211
217
|
# define a Handler which writes INFO messages or higher to the sys.stderr
|
|
212
218
|
# console = logging.StreamHandler()
|
|
213
219
|
# console.setLevel(logging.INFO)
|