1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 pytestCheckHook, 6 replaceVars, 7 setuptools, 8 rich, 9 rclone, 10 writableTmpDirAsHomeHook, 11}: 12 13buildPythonPackage rec { 14 pname = "rclone-python"; 15 version = "0.1.23"; 16 pyproject = true; 17 18 src = fetchFromGitHub { 19 owner = "Johannes11833"; 20 repo = "rclone_python"; 21 tag = "v${version}"; 22 hash = "sha256-vvsiXS3uI0TcL+X8+75BQmycrF+EGIgQE1dmGef35rI="; 23 }; 24 25 patches = [ 26 (replaceVars ./hardcode-rclone-path.patch { 27 rclone = lib.getExe rclone; 28 }) 29 ]; 30 31 build-system = [ setuptools ]; 32 33 dependencies = [ 34 rich 35 ]; 36 37 nativeCheckInputs = [ 38 pytestCheckHook 39 writableTmpDirAsHomeHook 40 ]; 41 42 preCheck = '' 43 # Unlike upstream we don't actually run an S3 server for testing. 44 # See https://github.com/Johannes11833/rclone_python/blob/master/launch_test_server.sh 45 mkdir -p "$HOME/.config/rclone" 46 cat > "$HOME/.config/rclone/rclone.conf" <<EOF 47 [test_server_s3] 48 type = combine 49 upstreams = "testdir=$(mktemp -d)" 50 EOF 51 ''; 52 53 disabledTestPaths = [ 54 # test requires a remote that supports public links 55 "tests/test_link.py" 56 # test looks up latest version on rclone.org 57 "tests/test_version.py" 58 ]; 59 60 pythonImportsCheck = [ "rclone_python" ]; 61 62 meta = { 63 changelog = "https://github.com/Johannes11833/rclone_python/releases/tag/${src.tag}"; 64 description = "Python wrapper for rclone"; 65 homepage = "https://github.com/Johannes11833/rclone_python"; 66 license = lib.licenses.mit; 67 maintainers = with lib.maintainers; [ CaptainJawZ ]; 68 }; 69}