python311Packages.youseedee: init at 0.4.1

This commit is contained in:
Dan Callaghan 2023-04-23 16:20:45 +10:00
parent 1e0460a072
commit b863e2cab8
No known key found for this signature in database
GPG Key ID: 26B5AA2FDAF2F30A
3 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,25 @@
From 9013d36cfe7b2958eb18ce373f49193b66a0bbf6 Mon Sep 17 00:00:00 2001
From: Dan Callaghan <djc@djc.id.au>
Date: Sun, 23 Apr 2023 16:14:55 +1000
Subject: [PATCH] use packaged unicode data
diff --git a/lib/youseedee/__init__.py b/lib/youseedee/__init__.py
index 4424ef1..9a72f52 100644
--- a/lib/youseedee/__init__.py
+++ b/lib/youseedee/__init__.py
@@ -11,10 +11,7 @@
UCD_URL = "https://unicode.org/Public/UCD/latest/ucd/UCD.zip"
def ucd_dir():
- ucddir = os.path.expanduser("~/.youseedee")
- if not os.path.isdir(ucddir):
- os.mkdir(ucddir)
- return ucddir
+ return "@ucd_dir@"
def ensure_files():
if os.path.isfile(os.path.join(ucd_dir(), "UnicodeData.txt")):
--
2.38.4

View File

@ -0,0 +1,45 @@
{ lib
, buildPythonPackage
, fetchPypi
, substituteAll
, requests
, unicode-character-database
}:
buildPythonPackage rec {
pname = "youseedee";
version = "0.4.1";
src = fetchPypi {
inherit pname version;
hash = "sha256-fdI4CBUSMbdKW0qg4y22wjWI6bhotgDkQdFMc9X00as=";
};
patches = [
# Load data files from the unicode-character-database package instead of
# downloading them from the internet. (nixpkgs-specific, not upstreamable)
(substituteAll {
src = ./0001-use-packaged-unicode-data.patch;
ucd_dir = "${unicode-character-database}/share/unicode";
})
];
propagatedBuildInputs = [
requests
];
doCheck = true;
# Package has no unit tests, but we can check an example as per README.rst:
checkPhase = ''
runHook preCheck
python -m youseedee 0x078A | grep -q "'Block': 'Thaana'"
runHook postCheck
'';
meta = with lib; {
description = "Python library for querying the Unicode Character Database";
homepage = "https://github.com/simoncozens/youseedee";
license = licenses.mit;
maintainers = with maintainers; [ danc86 ];
};
}

View File

@ -16075,6 +16075,8 @@ self: super: with self; {
youless-api = callPackage ../development/python-modules/youless-api { };
youseedee = callPackage ../development/python-modules/youseedee { };
youtube-dl = callPackage ../tools/misc/youtube-dl { };
youtube-dl-light = callPackage ../tools/misc/youtube-dl {