mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 01:14:15 +02:00
[arch] improvement -> AUR: upgrade checking now considers modification dates as well
This commit is contained in:
@@ -4,7 +4,7 @@ import sys
|
||||
import time
|
||||
from io import StringIO
|
||||
from subprocess import PIPE
|
||||
from typing import List, Tuple, Set, Dict
|
||||
from typing import List, Tuple, Set, Dict, Optional
|
||||
|
||||
# default environment variables for subprocesses.
|
||||
from bauh.api.abstract.handler import ProcessWatcher
|
||||
@@ -322,6 +322,11 @@ def check_enabled_services(*names: str) -> Dict[str, bool]:
|
||||
return {s: status[i].strip().lower() == 'enabled' for i, s in enumerate(names) if s}
|
||||
|
||||
|
||||
def execute(cmd: str, shell: bool = False) -> Tuple[int, str]:
|
||||
p = subprocess.run(args=cmd.split(' ') if not shell else [cmd], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=shell)
|
||||
def execute(cmd: str, shell: bool = False, cwd: Optional[str] = None) -> Tuple[int, str]:
|
||||
p = subprocess.run(args=cmd.split(' ') if not shell else [cmd],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
shell=shell,
|
||||
cwd=cwd)
|
||||
|
||||
return p.returncode, p.stdout.decode()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import collections
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
def deep_update(source: dict, overrides: dict):
|
||||
@@ -26,3 +26,7 @@ def size_to_byte(size: float, unit: str) -> int:
|
||||
final_size = size * 1000000000000000
|
||||
|
||||
return int(final_size)
|
||||
|
||||
|
||||
def datetime_as_milis(date: datetime) -> int:
|
||||
return int(round(date.timestamp() * 1000))
|
||||
|
||||
Reference in New Issue
Block a user