torizon-templates-utils 0.0.4__tar.gz → 0.0.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 (19) hide show
  1. {torizon_templates_utils-0.0.4 → torizon_templates_utils-0.0.5}/PKG-INFO +1 -1
  2. {torizon_templates_utils-0.0.4 → torizon_templates_utils-0.0.5}/pyproject.toml +1 -1
  3. torizon_templates_utils-0.0.5/torizon_templates_utils/network.py +35 -0
  4. {torizon_templates_utils-0.0.4 → torizon_templates_utils-0.0.5}/torizon_templates_utils.egg-info/PKG-INFO +1 -1
  5. torizon_templates_utils-0.0.4/torizon_templates_utils/network.py +0 -17
  6. {torizon_templates_utils-0.0.4 → torizon_templates_utils-0.0.5}/LICENSE +0 -0
  7. {torizon_templates_utils-0.0.4 → torizon_templates_utils-0.0.5}/README.md +0 -0
  8. {torizon_templates_utils-0.0.4 → torizon_templates_utils-0.0.5}/setup.cfg +0 -0
  9. {torizon_templates_utils-0.0.4 → torizon_templates_utils-0.0.5}/torizon_templates_utils/__init__.py +0 -0
  10. {torizon_templates_utils-0.0.4 → torizon_templates_utils-0.0.5}/torizon_templates_utils/animations.py +0 -0
  11. {torizon_templates_utils-0.0.4 → torizon_templates_utils-0.0.5}/torizon_templates_utils/args.py +0 -0
  12. {torizon_templates_utils-0.0.4 → torizon_templates_utils-0.0.5}/torizon_templates_utils/colors.py +0 -0
  13. {torizon_templates_utils-0.0.4 → torizon_templates_utils-0.0.5}/torizon_templates_utils/debug.py +0 -0
  14. {torizon_templates_utils-0.0.4 → torizon_templates_utils-0.0.5}/torizon_templates_utils/errors.py +0 -0
  15. {torizon_templates_utils-0.0.4 → torizon_templates_utils-0.0.5}/torizon_templates_utils/tasks.py +0 -0
  16. {torizon_templates_utils-0.0.4 → torizon_templates_utils-0.0.5}/torizon_templates_utils.egg-info/SOURCES.txt +0 -0
  17. {torizon_templates_utils-0.0.4 → torizon_templates_utils-0.0.5}/torizon_templates_utils.egg-info/dependency_links.txt +0 -0
  18. {torizon_templates_utils-0.0.4 → torizon_templates_utils-0.0.5}/torizon_templates_utils.egg-info/requires.txt +0 -0
  19. {torizon_templates_utils-0.0.4 → torizon_templates_utils-0.0.5}/torizon_templates_utils.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: torizon_templates_utils
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: Package with utilities for Torizon Templates scripts
5
5
  Author-email: Matheus Castello <matheus.castello@toradex.com>
6
6
  Project-URL: Homepage, https://github.com/torizon/vscode-torizon-templates
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "torizon_templates_utils"
7
- version = "0.0.4"
7
+ version = "0.0.5"
8
8
  authors = [
9
9
  { name="Matheus Castello", email="matheus.castello@toradex.com" },
10
10
  ]
@@ -0,0 +1,35 @@
1
+
2
+ import os
3
+ import re
4
+ import subprocess
5
+
6
+
7
+ def get_host_ip():
8
+ if 'WSL_DISTRO_NAME' in os.environ:
9
+ command = ["/mnt/c/Windows/System32/Wbem/WMIC.exe", "NICCONFIG", "WHERE", "IPEnabled=true", "GET", "IPAddress"]
10
+
11
+ # if inside a container we need to run the command in the host
12
+ if "APOLLOX_CONTAINER" in os.environ:
13
+ command = [
14
+ "sudo", "nsenter", "-t", "1", "-m", "-u", "-n", "-i",
15
+ "--",
16
+ "/mnt/c/Windows/System32/Wbem/WMIC.exe", "NICCONFIG", "WHERE", "IPEnabled=true", "GET", "IPAddress"
17
+ ]
18
+
19
+ result = subprocess.run(command, capture_output=True, text=True)
20
+ ip_address = re.search(r'((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])', result.stdout)
21
+ if ip_address:
22
+ return ip_address.group(0)
23
+ else:
24
+ command = ["hostname", "-I"]
25
+
26
+ # if inside a container we need to run the command in the host
27
+ if "APOLLOX_CONTAINER" in os.environ:
28
+ command = [
29
+ "sudo", "nsenter", "-t", "1", "-m", "-u", "-n", "-i",
30
+ "--",
31
+ "hostname", "-I"
32
+ ]
33
+
34
+ result = subprocess.run(command, capture_output=True, text=True)
35
+ return result.stdout.split()[0]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: torizon_templates_utils
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: Package with utilities for Torizon Templates scripts
5
5
  Author-email: Matheus Castello <matheus.castello@toradex.com>
6
6
  Project-URL: Homepage, https://github.com/torizon/vscode-torizon-templates
@@ -1,17 +0,0 @@
1
-
2
- import os
3
- import re
4
- import subprocess
5
-
6
-
7
- def get_host_ip():
8
- if 'WSL_DISTRO_NAME' in os.environ:
9
- command = ["/mnt/c/Windows/System32/Wbem/WMIC.exe", "NICCONFIG", "WHERE", "IPEnabled=true", "GET", "IPAddress"]
10
- result = subprocess.run(command, capture_output=True, text=True)
11
- ip_address = re.search(r'((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])', result.stdout)
12
- if ip_address:
13
- return ip_address.group(0)
14
- else:
15
- command = ["hostname", "-I"]
16
- result = subprocess.run(command, capture_output=True, text=True)
17
- return result.stdout.split()[0]