nixpkgs/pkgs/development/python-modules/python-miio/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

53 lines
1.1 KiB
Nix

{ lib, stdenv
, buildPythonPackage
, fetchPypi
, appdirs
, click
, construct
, croniter
, cryptography
, importlib-metadata
, pytest
, pytest-mock
, zeroconf
, attrs
, pytz
, tqdm
, netifaces
}:
buildPythonPackage rec {
pname = "python-miio";
version = "0.5.4";
src = fetchPypi {
inherit pname version;
sha256 = "5a6fd3bb2cc2f75cdfe5673f36a5a418144d08add6e53b384cb146e99f27bd39";
};
postPatch = ''
substituteInPlace setup.py \
--replace "zeroconf>=0.25.1,<0.26.0" "zeroconf"
substituteInPlace setup.py \
--replace "pytz>=2019.3,<2020.0" "pytz"
substituteInPlace setup.py \
--replace "cryptography>=2.9,<3.0" "cryptography"
'';
checkInputs = [ pytest pytest-mock];
propagatedBuildInputs = [ appdirs click construct croniter cryptography importlib-metadata zeroconf attrs pytz tqdm netifaces ];
checkPhase = ''
pytest
'';
meta = with lib; {
description = "Python library for interfacing with Xiaomi smart appliances";
homepage = "https://github.com/rytilahti/python-miio";
license = licenses.gpl3;
maintainers = with maintainers; [ flyfloh ];
};
}