py-app-dev 2.3.2__tar.gz → 2.3.3__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.
- {py_app_dev-2.3.2 → py_app_dev-2.3.3}/PKG-INFO +1 -1
- {py_app_dev-2.3.2 → py_app_dev-2.3.3}/pyproject.toml +2 -2
- py_app_dev-2.3.3/src/py_app_dev/__init__.py +1 -0
- {py_app_dev-2.3.2 → py_app_dev-2.3.3}/src/py_app_dev/core/scoop_wrapper.py +8 -6
- {py_app_dev-2.3.2 → py_app_dev-2.3.3}/src/py_app_dev/core/subprocess.py +15 -9
- py_app_dev-2.3.2/src/py_app_dev/__init__.py +0 -1
- {py_app_dev-2.3.2 → py_app_dev-2.3.3}/LICENSE +0 -0
- {py_app_dev-2.3.2 → py_app_dev-2.3.3}/README.md +0 -0
- {py_app_dev-2.3.2 → py_app_dev-2.3.3}/src/py_app_dev/core/__init__.py +0 -0
- {py_app_dev-2.3.2 → py_app_dev-2.3.3}/src/py_app_dev/core/cmd_line.py +0 -0
- {py_app_dev-2.3.2 → py_app_dev-2.3.3}/src/py_app_dev/core/docs_utils.py +0 -0
- {py_app_dev-2.3.2 → py_app_dev-2.3.3}/src/py_app_dev/core/exceptions.py +0 -0
- {py_app_dev-2.3.2 → py_app_dev-2.3.3}/src/py_app_dev/core/logging.py +0 -0
- {py_app_dev-2.3.2 → py_app_dev-2.3.3}/src/py_app_dev/core/pipeline.py +0 -0
- {py_app_dev-2.3.2 → py_app_dev-2.3.3}/src/py_app_dev/core/runnable.py +0 -0
- {py_app_dev-2.3.2 → py_app_dev-2.3.3}/src/py_app_dev/mvp/__init__.py +0 -0
- {py_app_dev-2.3.2 → py_app_dev-2.3.3}/src/py_app_dev/mvp/event_manager.py +0 -0
- {py_app_dev-2.3.2 → py_app_dev-2.3.3}/src/py_app_dev/mvp/presenter.py +0 -0
- {py_app_dev-2.3.2 → py_app_dev-2.3.3}/src/py_app_dev/mvp/view.py +0 -0
- {py_app_dev-2.3.2 → py_app_dev-2.3.3}/src/py_app_dev/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "py-app-dev"
|
|
3
|
-
version = "2.3.
|
|
3
|
+
version = "2.3.3"
|
|
4
4
|
description = "My application development modules."
|
|
5
5
|
authors = ["cuinixam <me@cuinixam.com>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -68,7 +68,7 @@ match = "(?!main$)"
|
|
|
68
68
|
prerelease = true
|
|
69
69
|
|
|
70
70
|
[tool.pytest.ini_options]
|
|
71
|
-
addopts = "-
|
|
71
|
+
addopts = "-vv -Wdefault --cov=py_app_dev --cov-report=term-missing:skip-covered -s"
|
|
72
72
|
pythonpath = ["src"]
|
|
73
73
|
|
|
74
74
|
[tool.coverage.run]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.3.3"
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import json
|
|
2
|
-
import os
|
|
3
2
|
import re
|
|
4
3
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
5
4
|
from dataclasses import dataclass, field
|
|
@@ -209,13 +208,16 @@ class ScoopWrapper:
|
|
|
209
208
|
with TemporaryDirectory() as tmp_dir:
|
|
210
209
|
tmp_scoop_file = Path(tmp_dir).joinpath("scoopfile.json")
|
|
211
210
|
ScoopInstallConfigFile(scoop_install_config.buckets, apps_to_install).to_file(tmp_scoop_file)
|
|
212
|
-
|
|
213
|
-
# See more details here: https://github.com/PowerShell/PowerShell/issues/8635
|
|
214
|
-
env = os.environ.copy()
|
|
215
|
-
env["PSMODULEPATH"] = f"$PSHOME/Modules;{env.get('PSMODULEPATH', '')}"
|
|
216
|
-
SubprocessExecutor(["powershell.exe", self.scoop_script, "import", tmp_scoop_file], env=env).execute()
|
|
211
|
+
self.run_powershell_command(f"{self.scoop_script} import {tmp_scoop_file}")
|
|
217
212
|
return apps_to_install
|
|
218
213
|
|
|
214
|
+
@staticmethod
|
|
215
|
+
def run_powershell_command(command: str, update_ps_module_path: bool = True) -> None:
|
|
216
|
+
# (!) Make sure powershell core module does not pollute the module path. Without this change scoop.ps1 fails because 'Get-FileHash' cannot be found.
|
|
217
|
+
# See more details here: https://github.com/PowerShell/PowerShell/issues/8635
|
|
218
|
+
ps_command = f'$env:PSModulePath=\\"$PSHOME\\Modules;$env:PSMODULEPATH\\"; {command}' if update_ps_module_path else f"{command}"
|
|
219
|
+
SubprocessExecutor(f"powershell.exe -Command {ps_command}").execute()
|
|
220
|
+
|
|
219
221
|
@staticmethod
|
|
220
222
|
def map_required_apps_to_installed_apps(
|
|
221
223
|
app_names: List[str],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import shutil
|
|
2
2
|
import subprocess # nosec
|
|
3
3
|
from pathlib import Path
|
|
4
|
-
from typing import Dict, List, Optional
|
|
4
|
+
from typing import Dict, List, Optional, Union
|
|
5
5
|
|
|
6
6
|
from .exceptions import UserNotificationException
|
|
7
7
|
from .logging import logger
|
|
@@ -16,31 +16,37 @@ def which(app_name: str) -> Optional[Path]:
|
|
|
16
16
|
class SubprocessExecutor:
|
|
17
17
|
def __init__(
|
|
18
18
|
self,
|
|
19
|
-
command: List[str | Path],
|
|
19
|
+
command: Union[str, List[str | Path]],
|
|
20
20
|
cwd: Optional[Path] = None,
|
|
21
21
|
capture_output: bool = True,
|
|
22
22
|
env: Optional[Dict[str, str]] = None,
|
|
23
23
|
shell: bool = False,
|
|
24
24
|
):
|
|
25
25
|
self.logger = logger.bind()
|
|
26
|
-
self.command =
|
|
26
|
+
self.command = command
|
|
27
27
|
self.current_working_directory = cwd
|
|
28
28
|
self.capture_output = capture_output
|
|
29
29
|
self.env = env
|
|
30
30
|
self.shell = shell
|
|
31
31
|
|
|
32
|
+
@property
|
|
33
|
+
def command_str(self) -> str:
|
|
34
|
+
if isinstance(self.command, str):
|
|
35
|
+
return self.command
|
|
36
|
+
return " ".join(str(arg) if not isinstance(arg, str) else arg for arg in self.command)
|
|
37
|
+
|
|
32
38
|
def execute(self) -> None:
|
|
33
39
|
try:
|
|
34
|
-
self.logger.info(f"Running command: {self.
|
|
40
|
+
self.logger.info(f"Running command: {self.command_str}")
|
|
35
41
|
cwd_path = (self.current_working_directory or Path.cwd()).as_posix()
|
|
36
42
|
with subprocess.Popen(
|
|
37
|
-
self.command
|
|
43
|
+
args=self.command,
|
|
38
44
|
cwd=cwd_path,
|
|
39
45
|
stdout=(subprocess.PIPE if self.capture_output else subprocess.DEVNULL),
|
|
40
46
|
stderr=(subprocess.STDOUT if self.capture_output else subprocess.DEVNULL),
|
|
41
47
|
text=True,
|
|
42
48
|
env=self.env,
|
|
43
|
-
shell=self.shell,
|
|
49
|
+
shell=self.shell,
|
|
44
50
|
) as process: # nosec
|
|
45
51
|
if self.capture_output and process.stdout is not None:
|
|
46
52
|
for line in iter(process.stdout.readline, ""):
|
|
@@ -49,8 +55,8 @@ class SubprocessExecutor:
|
|
|
49
55
|
|
|
50
56
|
# Check return code
|
|
51
57
|
if process.returncode != 0:
|
|
52
|
-
raise subprocess.CalledProcessError(process.returncode, self.
|
|
58
|
+
raise subprocess.CalledProcessError(process.returncode, self.command_str)
|
|
53
59
|
except subprocess.CalledProcessError as e:
|
|
54
|
-
raise UserNotificationException(f"Command '{self.
|
|
60
|
+
raise UserNotificationException(f"Command '{self.command_str}' failed with return code {e.returncode}") from None
|
|
55
61
|
except FileNotFoundError as e:
|
|
56
|
-
raise UserNotificationException(f"Command '{self.
|
|
62
|
+
raise UserNotificationException(f"Command '{self.command_str}' failed with error {e}") from None
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.3.2"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|