dbbdata 1.0.0__tar.gz → 1.0.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dbbdata
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: Odoo x DATEV. Jemand muss es ja tun.
5
5
  Author: DBB DATA Solutions GmbH
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "dbbdata"
7
- version = "1.0.0"
7
+ version = "1.0.1"
8
8
  description = "Odoo x DATEV. Jemand muss es ja tun."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -12,16 +12,41 @@ Farben lassen sich mit der Umgebungsvariable NO_COLOR abschalten.
12
12
  import os
13
13
  import sys
14
14
 
15
- __version__ = "1.0.0"
15
+ __version__ = "1.0.1"
16
16
  __all__ = ["banner", "slogan"]
17
17
 
18
18
  slogan = "Jemand muss es ja tun."
19
19
 
20
- _USE_COLOR = (
21
- sys.stdout.isatty()
22
- and os.environ.get("NO_COLOR") is None
23
- and os.environ.get("TERM") != "dumb"
24
- )
20
+
21
+ def _enable_windows_ansi():
22
+ """Aktiviert ANSI-Farben in aelteren Windows-Terminals. True bei Erfolg."""
23
+ try:
24
+ import ctypes
25
+
26
+ kernel32 = ctypes.windll.kernel32
27
+ handle = kernel32.GetStdHandle(-11) # STD_OUTPUT_HANDLE
28
+ mode = ctypes.c_uint32()
29
+ if not kernel32.GetConsoleMode(handle, ctypes.byref(mode)):
30
+ return False
31
+ # ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004
32
+ return bool(kernel32.SetConsoleMode(handle, mode.value | 0x0004))
33
+ except Exception:
34
+ return False
35
+
36
+
37
+ def _supports_color():
38
+ if os.environ.get("NO_COLOR") is not None:
39
+ return False
40
+ if not sys.stdout.isatty():
41
+ return False
42
+ if os.environ.get("TERM") == "dumb":
43
+ return False
44
+ if os.name == "nt":
45
+ return _enable_windows_ansi()
46
+ return True
47
+
48
+
49
+ _USE_COLOR = _supports_color()
25
50
 
26
51
  _BLUE = "\033[38;5;33m" if _USE_COLOR else ""
27
52
  _DIM = "\033[2m" if _USE_COLOR else ""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dbbdata
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: Odoo x DATEV. Jemand muss es ja tun.
5
5
  Author: DBB DATA Solutions GmbH
6
6
  License: MIT
File without changes
File without changes
File without changes