nixpkgs/pkgs/development/python-modules/toggl-cli/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

71 lines
1.5 KiB
Nix

{ lib, stdenv, buildPythonPackage, fetchPypi, pythonAtLeast, pythonOlder
, click
, click-completion
, factory_boy
, faker
, inquirer
, notify-py
, pbr
, pendulum
, ptable
, pytest
, pytestcov
, pytest-mock
, requests
, twine
, validate-email
}:
buildPythonPackage rec {
pname = "toggl-cli";
version = "2.4.1";
disabled = pythonOlder "3.5";
src = fetchPypi {
pname = "togglCli";
inherit version;
sha256 = "19lry8adcznzmzbvghyid3yl4j05db6931bw38af5vrkkyzyf62i";
};
postPatch = ''
substituteInPlace requirements.txt \
--replace "inquirer==2.6.3" "inquirer>=2.6.3" \
--replace "notify-py==0.2.2" "notify-py>=0.2.2"
'';
nativeBuildInputs = [ pbr twine ];
checkInputs = [ pbr pytest pytestcov pytest-mock faker factory_boy ];
preCheck = ''
export TOGGL_API_TOKEN=your_api_token
export TOGGL_PASSWORD=toggl_password
export TOGGL_USERNAME=user@example.com
'';
checkPhase = ''
runHook preCheck
pytest -k "not premium and not TestDateTimeType and not TestDateTimeField" tests/unit --maxfail=20
runHook postCheck
'';
propagatedBuildInputs = [
click
click-completion
inquirer
notify-py
pendulum
ptable
requests
pbr
validate-email
];
meta = with lib; {
homepage = "https://toggl.uhlir.dev/";
description = "Command line tool and set of Python wrapper classes for interacting with toggl's API";
license = licenses.mit;
maintainers = [ maintainers.mmahut ];
};
}