Unverified Commit 0b95d24d authored by Brian McGillion's avatar Brian McGillion
Browse files

cflib: init at 0.1.28



Python library to communicate with and control the crazyflie micro
quadcopters.

Signed-off-by: default avatarBrian McGillion <bmg.avoin@gmail.com>
parent 14918d8f
Loading
Loading
Loading
Loading
+90 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  setuptools-scm,
  libusb-package,
  numpy,
  packaging,
  pyserial,
  pyusb,
  scipy,
  pytestCheckHook,
  pyyaml,
  udevCheckHook,
}:

buildPythonPackage rec {
  pname = "cflib";
  version = "0.1.28";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "bitcraze";
    repo = "crazyflie-lib-python";
    tag = version;
    hash = "sha256-vGqwQVD80NcFJosVAmqj66uxYNoVtAqzVhVQiuWP5yM=";
  };

  strictDeps = true;

  build-system = [
    setuptools
    setuptools-scm
  ];

  pythonRelaxDeps = [ "numpy" ];

  dependencies = [
    libusb-package
    numpy
    packaging
    pyserial
    pyusb
    scipy
  ];

  disabledTestPaths = [
    # exception: Cannot find a Crazyradio Dongle (HW required)
    "sys_test/single_cf_grounded/"
    "sys_test/swarm_test_rig/"
  ];

  pythonImportsCheck = [ "cflib" ];
  nativeCheckInputs = [
    pytestCheckHook
    pyyaml
  ];

  # The udevCheckHook is used to verify udev rules
  # requires diInstallCheck to be enabled, which is default for pythonPackages
  nativeInstallCheckInputs = [
    udevCheckHook
  ];

  # Install udev rules as defined
  # https://www.bitcraze.io/documentation/repository/crazyflie-lib-python/master/installation/usb_permissions/
  postInstall = ''
    # Install udev rules
    mkdir -p $out/etc/udev/rules.d

    cat <<EOF > $out/etc/udev/rules.d/99-bitcraze.rules
    # Crazyradio (normal operation)
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1915", ATTRS{idProduct}=="7777", MODE="0664", GROUP="plugdev"
    # Bootloader
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1915", ATTRS{idProduct}=="0101", MODE="0664", GROUP="plugdev"
    # Crazyflie (over USB)
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE="0664", GROUP="plugdev"
    EOF
  '';

  meta = {
    description = "Python library for the Crazyflie quadcopter by Bitcraze";
    homepage = "https://github.com/bitcraze/crazyflie-lib-python";
    changelog = "https://github.com/bitcraze/crazyflie-lib-python/releases/tag/${version}";
    license = lib.licenses.gpl2Only;
    maintainers = [ lib.maintainers.brianmcgillion ];
    platforms = lib.platforms.linux;
  };
}
+2 −0
Original line number Diff line number Diff line
@@ -2366,6 +2366,8 @@ self: super: with self; {
  cfgv = callPackage ../development/python-modules/cfgv { };
  cflib = callPackage ../development/python-modules/cflib { };
  cfn-flip = callPackage ../development/python-modules/cfn-flip { };
  cfn-lint = callPackage ../development/python-modules/cfn-lint { };