mirror of
https://codeberg.org/privacy1st/exec-notify
synced 2024-12-22 23:16:04 +01:00
v0.1.9
re-add setup.py; check python version before using subprocess module
This commit is contained in:
parent
eba239f5ad
commit
b53c282509
@ -22,8 +22,8 @@ pip --version
|
||||
Then install with one of the following options:
|
||||
|
||||
```shell
|
||||
sudo python3 -m pip install --upgrade git+https://codeberg.org/privacy1st/execNotify
|
||||
sudo python3 -m pip install --upgrade .
|
||||
sudo python3 -m pip install --upgrade --force-reinstall git+https://codeberg.org/privacy1st/execNotify
|
||||
sudo python3 -m pip install --upgrade --force-reinstall .
|
||||
sudo python3 -m pip install --upgrade --index-url https://test.pypi.org/simple/ --no-deps de.p1st.exec-notify
|
||||
```
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
[metadata]
|
||||
name = de.p1st.exec_notify
|
||||
version = 0.1.8
|
||||
version = 0.1.9
|
||||
author = Daniel Langbein
|
||||
author_email = daniel@systemli.org
|
||||
description = mail notification if command fails
|
||||
@ -24,9 +24,7 @@ classifiers =
|
||||
package_dir =
|
||||
= src
|
||||
packages = find:
|
||||
; capture_output was added in 3.7
|
||||
; - https://docs.python.org/3/library/subprocess.html#subprocess.run
|
||||
python_requires = >=3.7
|
||||
python_requires = >=3.6
|
||||
|
||||
[options.packages.find]
|
||||
where = src
|
||||
|
4
setup.py
Normal file
4
setup.py
Normal file
@ -0,0 +1,4 @@
|
||||
# This file is required for `pip install` on Ubuntu 18.04.
|
||||
# It loads `setup.cfg`.
|
||||
from setuptools import setup
|
||||
setup()
|
@ -1,3 +1,4 @@
|
||||
import sys
|
||||
from typing import List
|
||||
from sys import stdin
|
||||
import subprocess
|
||||
@ -12,6 +13,19 @@ def execute(command: List[str]):
|
||||
:return: (exit_code, stdout, stderr)
|
||||
"""
|
||||
|
||||
if sys.version_info.major == 3 and sys.version_info.minor < 7:
|
||||
# capture_output was added in 3.7
|
||||
# - https://docs.python.org/3/library/subprocess.html#subprocess.run
|
||||
|
||||
completed: subprocess.CompletedProcess = subprocess.run(
|
||||
command,
|
||||
stdin=stdin,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
check=False,
|
||||
)
|
||||
return completed.returncode, str(completed.stdout), str(completed.stderr)
|
||||
|
||||
completed: subprocess.CompletedProcess = subprocess.run(
|
||||
command,
|
||||
stdin=stdin,
|
||||
|
Loading…
Reference in New Issue
Block a user