2020-05-09 13:22:04 +00:00
{ lib
, buildPythonApplication
, fetchFromGitHub
, click
, semantic-version
, requests
, colorama
, pyserial
, wheel
2021-12-28 20:54:13 +00:00
, scons
2020-05-09 13:22:04 +00:00
, setuptools
, tinyprog
, pytestCheckHook
} :
buildPythonApplication rec {
pname = " a p i o " ;
2022-04-29 10:14:35 +00:00
version = " 0 . 8 . 1 " ;
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 } " ;
2022-04-29 10:14:35 +00:00
sha256 = " s h a 2 5 6 - 0 4 q A G T z u s M T 3 G s a R x D o X N J K 1 M s l z x u + u g Q c l B J x 8 x z E = " ;
2020-05-09 13:22:04 +00:00
} ;
postPatch = ''
2022-04-29 10:14:35 +00:00
substituteInPlace pyproject . toml \
- - replace ' scons == 4 .2 . 0 ' ' scons' \
- - replace ' == ' ' >= '
2021-12-28 20:54:13 +00:00
2020-05-09 13:22:04 +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
2021-12-28 20:54:13 +00:00
scons
2020-05-09 13:22:04 +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 ] ;
} ;
}