daktari: init at 0.0.319 (#503764)
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
diff --git a/daktari/result_printer.py b/daktari/result_printer.py
|
||||
--- a/daktari/result_printer.py
|
||||
+++ b/daktari/result_printer.py
|
||||
@@ -1,7 +1,11 @@
|
||||
import re
|
||||
import textwrap
|
||||
-import pyclip
|
||||
from typing import Callable, Dict, Optional
|
||||
|
||||
+try:
|
||||
+ import pyclip
|
||||
+except ImportError:
|
||||
+ pyclip = None
|
||||
+
|
||||
from colors import green, red, underline, yellow
|
||||
|
||||
from daktari.check import CheckResult, CheckStatus
|
||||
@@ -58,10 +62,13 @@ def copy_to_clipboard(suggestion: Optional[str]):
|
||||
command_regex = re.compile(r"\<cmd\>(.*?)\<\/cmd\>")
|
||||
results = command_regex.findall(suggestion)
|
||||
if len(results) > 0:
|
||||
- try:
|
||||
- pyclip.copy("\n".join(results))
|
||||
+ if pyclip is not None:
|
||||
+ try:
|
||||
+ pyclip.copy("\n".join(results))
|
||||
+ print("ⓘ Command copied to clipboard")
|
||||
+ except pyclip.base.ClipboardSetupException:
|
||||
print("ⓘ Clipboard not available")
|
||||
+ else:
|
||||
+ print("ⓘ Clipboard not available")
|
||||
return
|
||||
print("ⓘ No command available to copy to clipboard")
|
||||
@@ -0,0 +1,72 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
python3Packages,
|
||||
fetchFromGitHub,
|
||||
}:
|
||||
|
||||
python3Packages.buildPythonApplication (finalAttrs: {
|
||||
pname = "daktari";
|
||||
version = "0.0.319";
|
||||
pyproject = true;
|
||||
__structuredAttrs = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "genio-learn";
|
||||
repo = "daktari";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-NxTDyul1BESr/fBow9hwmTLr6jcl4p5RlIKNzFbaJvc=";
|
||||
};
|
||||
|
||||
patches = [ ./optional-pyclip.patch ];
|
||||
|
||||
pythonRelaxDeps = true;
|
||||
|
||||
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
# pyclip is broken on macOS in nixpkgs
|
||||
substituteInPlace requirements.txt --replace-fail "pyclip==0.7.0" ""
|
||||
'';
|
||||
|
||||
build-system = with python3Packages; [
|
||||
setuptools
|
||||
];
|
||||
|
||||
dependencies =
|
||||
with python3Packages;
|
||||
[
|
||||
ansicolors
|
||||
distro
|
||||
pyfiglet
|
||||
importlib-resources
|
||||
packaging
|
||||
requests
|
||||
responses
|
||||
semver
|
||||
python-hosts
|
||||
pyyaml
|
||||
types-pyyaml
|
||||
requests-unixsocket
|
||||
dpath
|
||||
pyopenssl
|
||||
types-pyopenssl
|
||||
urllib3
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||
pyclip
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
pyobjc-core
|
||||
pyobjc-framework-Cocoa
|
||||
];
|
||||
|
||||
pythonImportsCheck = [ "daktari" ];
|
||||
|
||||
meta = {
|
||||
description = "Tool to assist in setting up and maintaining developer environments";
|
||||
homepage = "https://github.com/genio-learn/daktari";
|
||||
changelog = "https://github.com/genio-learn/daktari/releases/tag/v${finalAttrs.version}";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ tymscar ];
|
||||
mainProgram = "daktari";
|
||||
};
|
||||
})
|
||||
Reference in New Issue
Block a user