2021-08-05 21:33:18 +00:00
{ lib
, buildPythonApplication
, fetchFromGitHub
, click
, semantic-version
, requests
, colorama
, pyserial
, wheel
2022-01-22 01:22:15 +00:00
, scons
2021-08-05 21:33:18 +00:00
, setuptools
, tinyprog
, pytestCheckHook
} :
buildPythonApplication rec {
pname = " a p i o " ;
2022-01-22 01:22:15 +00:00
version = " 0 . 8 . 0 " ;
2021-08-05 21:33:18 +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 } " ;
2022-01-22 01:22:15 +00:00
sha256 = " s h a 2 5 6 - n O Z I + F H d Z R n k J F / N o 8 z 0 m Z 4 Q 5 a H F n F 7 c 2 0 a j T P I 0 0 N 4 = " ;
2021-08-05 21:33:18 +00:00
} ;
postPatch = ''
2022-01-22 01:22:15 +00:00
substituteInPlace pyproject . toml - - replace \
' scons == 4 .2 . 0 ' ' scons'
2021-08-05 21:33:18 +00:00
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
2022-01-22 01:22:15 +00:00
scons
2021-08-05 21:33:18 +00:00
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 ] ;
} ;
}