mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-05 20:43:28 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
64 lines
1.6 KiB
Nix
64 lines
1.6 KiB
Nix
{
|
|
stdenv,
|
|
lib,
|
|
buildPythonPackage,
|
|
fetchFromGitHub,
|
|
keyring,
|
|
mock,
|
|
pytestCheckHook,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "plyer";
|
|
version = "2.1.0";
|
|
format = "setuptools";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "kivy";
|
|
repo = pname;
|
|
rev = "refs/tags/${version}";
|
|
sha256 = "sha256-7Icb2MVj5Uit86lRHxal6b7y9gIJ3UT2HNqpA9DYWVE=";
|
|
};
|
|
|
|
postPatch = ''
|
|
rm -r examples
|
|
# remove all the wifi stuff. Depends on a python wifi module that has not been updated since 2016
|
|
find -iname "wifi*" -exec rm {} \;
|
|
substituteInPlace plyer/__init__.py \
|
|
--replace "wifi = Proxy('wifi', facades.Wifi)" "" \
|
|
--replace "'wifi', " ""
|
|
substituteInPlace plyer/facades/__init__.py \
|
|
--replace "from plyer.facades.wifi import Wifi" ""
|
|
'';
|
|
|
|
propagatedBuildInputs = [ keyring ];
|
|
|
|
nativeCheckInputs = [
|
|
mock
|
|
pytestCheckHook
|
|
];
|
|
|
|
pytestFlagsArray = [ "plyer/tests" ];
|
|
disabledTests = [
|
|
# assumes dbus is not installed, it fails and is not very robust.
|
|
"test_notification_notifysend"
|
|
# fails during nix-build, but I am not able to explain why.
|
|
# The test and the API under test do work outside the nix build.
|
|
"test_uniqueid"
|
|
];
|
|
preCheck = ''
|
|
HOME=$(mktemp -d)
|
|
mkdir -p $HOME/.config/ $HOME/Pictures
|
|
'';
|
|
|
|
pythonImportsCheck = [ "plyer" ];
|
|
|
|
meta = with lib; {
|
|
broken = stdenv.hostPlatform.isDarwin;
|
|
description = "Plyer is a platform-independent api to use features commonly found on various platforms";
|
|
homepage = "https://github.com/kivy/plyer";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ rski ];
|
|
};
|
|
}
|