2020-05-09 13:22:04 +00:00
{ lib
, buildPythonApplication
, fetchFromGitHub
, click
, semantic-version
, requests
, colorama
, pyserial
, wheel
, setuptools
, tinyprog
, pytestCheckHook
} :
buildPythonApplication rec {
pname = " a p i o " ;
2021-07-26 10:13:15 +00:00
version = " 0 . 7 . 6 " ;
2020-05-09 13:22:04 +00:00
format = " f l i t " ;
src = fetchFromGitHub {
owner = " F P G A w a r s " ;
repo = " a p i o " ;
rev = " v ${ version } " ;
2021-07-26 10:13:15 +00:00
sha256 = " s h a 2 5 6 - K m q x w Y K s v c T S u U S V X g e g R 4 7 y 9 V e U / v I C b Y W D 7 z 3 a D R M = " ;
2020-05-09 13:22:04 +00:00
} ;
postPatch = ''
substituteInPlace apio/managers/scons.py - - replace \
' return " t i n y p r o g - - l i b u s b - - p r o g r a m " ' \
' return " ${ tinyprog } / b i n / t i n y p r o g - - l i b u s b - - p r o g r a m " '
substituteInPlace apio/util.py - - replace \
' _command = join ( get_bin_dir ( ) , " t i n y p r o g " ) ' \
' _command = " ${ tinyprog } / b i n / t i n y p r o g " '
# semantic-version seems to not support version numbers like the one of tinyprog in Nixpkgs (1.0.24.dev114+gxxxxxxx).
# See https://github.com/rbarrois/python-semanticversion/issues/47.
# This leads to an error like "Error: Invalid version string: '1.0.24.dev114+g97f6353'"
# when executing "apio upload" for a TinyFPGA.
# Replace the dot with a dash to work around this problem.
substituteInPlace apio/managers/scons.py - - replace \
' version = semantic_version . Version ( pkg_version ) ' \
' version = semantic_version . Version ( pkg_version . replace ( " . d e v " , " - d e v " ) ) '
'' ;
propagatedBuildInputs = [
click
semantic-version
requests
colorama
pyserial
wheel
setuptools # needs pkg_resources at runtime (technically not needed when tinyprog is also in this list because of the propagatedBuildInputs of tinyprog)
tinyprog # needed for upload to TinyFPGA
] ;
checkInputs = [
pytestCheckHook
] ;
pytestFlagsArray = [ " - - o f f l i n e " ] ;
meta = with lib ; {
description = " O p e n s o u r c e e c o s y s t e m f o r o p e n F P G A b o a r d s " ;
homepage = " h t t p s : / / g i t h u b . c o m / F P G A w a r s / a p i o " ;
license = licenses . gpl2Only ;
maintainers = with maintainers ; [ Luflosi ] ;
} ;
}