torizon-templates-utils 0.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.
@@ -0,0 +1,23 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) .NET Foundation and Contributors
4
+
5
+ All rights reserved.
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
@@ -0,0 +1,19 @@
1
+ Metadata-Version: 2.1
2
+ Name: torizon_templates_utils
3
+ Version: 0.0.1
4
+ Summary: Package with utilities for Torizon Templates scripts
5
+ Author-email: Matheus Castello <matheus.castello@toradex.com>
6
+ Project-URL: Homepage, https://github.com/torizon/vscode-torizon-templates
7
+ Project-URL: Issues, https://github.com/torizon/vscode-torizon-templates/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: POSIX :: Linux
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+
15
+ # Torizon Templates Utils
16
+
17
+ This package contains a set of utilities to help the scripts that generate the Torizon OS applications and containers.
18
+
19
+ If you want to know more about check [Toradex developer website](https://developer.toradex.com/torizon/application-development/ide-extension/).
@@ -0,0 +1,5 @@
1
+ # Torizon Templates Utils
2
+
3
+ This package contains a set of utilities to help the scripts that generate the Torizon OS applications and containers.
4
+
5
+ If you want to know more about check [Toradex developer website](https://developer.toradex.com/torizon/application-development/ide-extension/).
@@ -0,0 +1,22 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "torizon_templates_utils"
7
+ version = "0.0.1"
8
+ authors = [
9
+ { name="Matheus Castello", email="matheus.castello@toradex.com" },
10
+ ]
11
+ description = "Package with utilities for Torizon Templates scripts"
12
+ readme = "README.md"
13
+ requires-python = ">=3.8"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: POSIX :: Linux",
18
+ ]
19
+
20
+ [project.urls]
21
+ Homepage = "https://github.com/torizon/vscode-torizon-templates"
22
+ Issues = "https://github.com/torizon/vscode-torizon-templates/issues"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,49 @@
1
+
2
+ import builtins
3
+ import enum
4
+
5
+ class Color(enum.IntEnum):
6
+ NONE = 0
7
+ BLACK = 30
8
+ RED = 31
9
+ GREEN = 32
10
+ YELLOW = 33
11
+ BLUE = 34
12
+ MAGENTA = 35
13
+ CYAN = 36
14
+ WHITE = 37
15
+
16
+ class BgColor(enum.IntEnum):
17
+ NONE = 0
18
+ BLACK = 40
19
+ RED = 41
20
+ GREEN = 42
21
+ YELLOW = 43
22
+ BLUE = 44
23
+ MAGENTA = 45
24
+ CYAN = 46
25
+ WHITE = 47
26
+
27
+ # override print to have color and background color
28
+ def print(
29
+ *args,
30
+ color: Color = Color.NONE,
31
+ bg_color: BgColor = BgColor.NONE,
32
+ **kwargs
33
+ ) -> None:
34
+ _color: int = color.value
35
+ _bg_color: int = bg_color.value
36
+
37
+ start_escape = ""
38
+
39
+ if _color != 0 and _bg_color != 0:
40
+ start_escape += f"\033[{_color};{_bg_color}m"
41
+ elif _color != 0:
42
+ start_escape += f"\033[{_color}m"
43
+ elif _bg_color != 0:
44
+ start_escape += f"\033[{_bg_color}m"
45
+
46
+ end_escape = "\033[0m"
47
+
48
+ text = ' '.join(map(str, args))
49
+ builtins.print(f'{start_escape}{text}{end_escape}', **kwargs)
@@ -0,0 +1,38 @@
1
+
2
+ import sys
3
+ from enum import Enum
4
+ from torizon_templates_utils.colors import Color, BgColor, print
5
+
6
+ class _error_struct:
7
+ code: int
8
+ message: str
9
+
10
+ def __init__(self, code: int, message: str):
11
+ self.code = code
12
+ self.message = message
13
+
14
+
15
+ class Error(Enum):
16
+ ENOPKG = _error_struct(
17
+ 65, "Package not installed"
18
+ )
19
+ EUSER = _error_struct(
20
+ 69, "User fault"
21
+ )
22
+ ENOCONF = _error_struct(
23
+ 1, "Not configured"
24
+ )
25
+ ENOFOUND = _error_struct(
26
+ 404, "Not found"
27
+ )
28
+
29
+
30
+ def Error_Out(msg: str, error: Error) -> None:
31
+ print(f"\n{msg}", color=Color.RED)
32
+ print(f"Error cause: {error.value.message}\n", color=Color.RED)
33
+ sys.exit(error.value.code)
34
+
35
+ def last_return_code() -> int:
36
+ # we are ignoring the type here because this will get the current
37
+ # xonsh shell instance
38
+ return __xonsh__.last.returncode # type: ignore
@@ -0,0 +1,19 @@
1
+ Metadata-Version: 2.1
2
+ Name: torizon_templates_utils
3
+ Version: 0.0.1
4
+ Summary: Package with utilities for Torizon Templates scripts
5
+ Author-email: Matheus Castello <matheus.castello@toradex.com>
6
+ Project-URL: Homepage, https://github.com/torizon/vscode-torizon-templates
7
+ Project-URL: Issues, https://github.com/torizon/vscode-torizon-templates/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: POSIX :: Linux
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+
15
+ # Torizon Templates Utils
16
+
17
+ This package contains a set of utilities to help the scripts that generate the Torizon OS applications and containers.
18
+
19
+ If you want to know more about check [Toradex developer website](https://developer.toradex.com/torizon/application-development/ide-extension/).
@@ -0,0 +1,10 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ torizon_templates_utils/__init__.py
5
+ torizon_templates_utils/colors.py
6
+ torizon_templates_utils/errors.py
7
+ torizon_templates_utils.egg-info/PKG-INFO
8
+ torizon_templates_utils.egg-info/SOURCES.txt
9
+ torizon_templates_utils.egg-info/dependency_links.txt
10
+ torizon_templates_utils.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ torizon_templates_utils