Skip to content

Commit

Permalink
cynthion: init at 0.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
carlossless committed Nov 6, 2024
1 parent 0c02b30 commit 1806bf8
Show file tree
Hide file tree
Showing 8 changed files with 384 additions and 18 deletions.
3 changes: 3 additions & 0 deletions pkgs/by-name/cy/cynthion/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{ python3Packages }:

python3Packages.toPythonApplication python3Packages.cynthion
56 changes: 56 additions & 0 deletions pkgs/development/python-modules/apollo-fpga/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
lib,
fetchFromGitHub,
buildPythonPackage,
pythonOlder,
setuptools,
pyusb,
pyvcd,
prompt-toolkit,
pyxdg,
deprecation,
}:

buildPythonPackage rec {
pname = "apollo-fpga";
version = "1.1.0";
pyproject = true;
disabled = pythonOlder "3.8";

src = fetchFromGitHub {
owner = "greatscottgadgets";
repo = "apollo";
rev = "refs/tags/v${version}";
hash = "sha256-9BoHGdqjnWkP83zXdjzyoAhYB6n7SJ/zlr8pvqb+9kg=";
};

postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail '"setuptools-git-versioning<2"' "" \
--replace-fail 'dynamic = ["version"]' 'version = "${version}"'
'';

build-system = [
setuptools
];

dependencies = [
pyusb
pyvcd
prompt-toolkit
pyxdg
deprecation
];

pythonImportsCheck = [
"apollo_fpga"
];

meta = {
changelog = "https://github.com/greatscottgadgets/apollo/releases/tag/v${version}";
description = "microcontroller-based FPGA / JTAG programmer";
homepage = "https://github.com/greatscottgadgets/apollo";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ carlossless ];
};
}
95 changes: 95 additions & 0 deletions pkgs/development/python-modules/cynthion/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
lib,
fetchFromGitHub,
buildPythonPackage,
amaranth,
pythonOlder,
setuptools,
future,
libusb1,
prompt-toolkit,
pyfwup,
pyserial,
pyusb,
tabulate,
tomli,
tqdm,
pygreat,
apollo-fpga,
luna-usb,
luna-soc,
pytestCheckHook,
}:

let
amaranth_0_4_1 = amaranth.overridePythonAttrs rec {
version = "0.4.1";

src = fetchFromGitHub {
owner = "amaranth-lang";
repo = "amaranth";
rev = "refs/tags/v${version}";
sha256 = "sha256-VMgycvxkphdpWIib7aZwh588En145RgYlG2Zfi6nnDo=";
};

postPatch = null;
};
in

buildPythonPackage rec {
pname = "cynthion";
version = "0.1.7";
pyproject = true;
disabled = pythonOlder "3.8";

src = fetchFromGitHub {
owner = "greatscottgadgets";
repo = "cynthion";
rev = "refs/tags/${version}";
hash = "sha256-2nVfODAg4t5hoSKUEP4IN23R+JGe3lw/rpfjW/UIsYw=";
};

sourceRoot = "${src.name}/cynthion/python";

postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail '"setuptools-git-versioning<2"' "" \
--replace-fail 'dynamic = ["version"]' 'version = "${version}"'
'';

build-system = [
setuptools
];

dependencies = [
future
libusb1
prompt-toolkit
pyfwup
pyserial
pyusb
tabulate
tomli
tqdm
pygreat
apollo-fpga
amaranth_0_4_1
luna-usb
luna-soc
];

nativeCheckInputs = [
pytestCheckHook
];

pythonImportsCheck = [ "cynthion" ];

meta = {
changelog = "https://github.com/greatscottgadgets/cynthion/releases/tag/${version}";
description = "Python package and utilities for the Great Scott Gadgets Cynthion USB Test Instrument";
homepage = "https://github.com/greatscottgadgets/cynthion";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ carlossless ];
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
}
46 changes: 46 additions & 0 deletions pkgs/development/python-modules/luna-soc/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
lib,
fetchFromGitHub,
buildPythonPackage,
pythonOlder,
setuptools,
luna-usb,
}:

buildPythonPackage rec {
pname = "luna-soc";
version = "0.2.0";
pyproject = true;
disabled = pythonOlder "3.8";

src = fetchFromGitHub {
owner = "greatscottgadgets";
repo = "luna-soc";
rev = "refs/tags/${version}";
hash = "sha256-P8P32hM1cVXENcDpCrmPe8BvkMCWdeEgHwbIU94uLe8=";
};

postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail '"setuptools-git-versioning<2"' "" \
--replace-fail 'dynamic = ["version"]' 'version = "${version}"'
'';

build-system = [
setuptools
];

dependencies = [ luna-usb ];

pythonImportsCheck = [
"luna_soc"
];

meta = {
changelog = "https://github.com/greatscottgadgets/luna-soc/releases/tag/${version}";
description = "Amaranth HDL libary for building USB-capable SoC designs.";
homepage = "https://github.com/greatscottgadgets/luna-soc";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ carlossless ];
};
}
90 changes: 90 additions & 0 deletions pkgs/development/python-modules/luna-usb/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
lib,
fetchFromGitHub,
buildPythonPackage,
pythonOlder,

# build-system
setuptools,

# dependencies
libusb1,
pyserial,
pyusb,
pyvcd,
amaranth,
usb-protocol,

# tests
pytestCheckHook,
apollo-fpga,
}:

let
amaranth_0_4_1 = amaranth.overridePythonAttrs rec {
version = "0.4.1";

src = fetchFromGitHub {
owner = "amaranth-lang";
repo = "amaranth";
rev = "refs/tags/v${version}";
sha256 = "sha256-VMgycvxkphdpWIib7aZwh588En145RgYlG2Zfi6nnDo=";
};

postPatch = null;
};
in

buildPythonPackage rec {
pname = "luna-usb";
version = "0.1.2";
pyproject = true;
disabled = pythonOlder "3.8";

src = fetchFromGitHub {
owner = "greatscottgadgets";
repo = "luna";
rev = "refs/tags/${version}";
hash = "sha256-T9V0rI6vcEpM3kN/duRni6v2plCU4B379Zx07dBGKjk=";
};

postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail '"setuptools-git-versioning<2"' "" \
--replace-fail 'dynamic = ["version"]' 'version = "${version}"'
'';

build-system = [
setuptools
];

dependencies = [
libusb1
pyserial
pyusb
pyvcd
amaranth_0_4_1
usb-protocol
];

nativeCheckInputs = [
pytestCheckHook
apollo-fpga
];

pytestFlagsArray = [
"tests/"
];

pythonImportsCheck = [
"luna"
];

meta = {
changelog = "https://github.com/greatscottgadgets/luna/releases/tag/${version}";
description = "Amaranth HDL framework for monitoring, hacking, and developing USB devices";
homepage = "https://github.com/greatscottgadgets/luna";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ carlossless ];
};
}
51 changes: 33 additions & 18 deletions pkgs/development/python-modules/pygreat/default.nix
Original file line number Diff line number Diff line change
@@ -1,41 +1,56 @@
{
lib,
buildPythonPackage,
isPy3k,
fetchFromGitHub,
setuptools,
pythonOlder,
future,
pyusb,
}:

buildPythonPackage {
buildPythonPackage rec {
pname = "pygreat";
version = "2019.5.1.dev0";
format = "setuptools";
version = "2024.0.2";
pyproject = true;
disabled = pythonOlder "3.8";

src = fetchFromGitHub {
owner = "greatscottgadgets";
repo = "libgreat";
rev = "14c00b7c8f036f4d467e4b1a324ffa3566b126fa";
sha256 = "1h0z83k1k4z8j36z936h61l8j3cjr3wsxr86k91v5c5h93g9dkqh";
rev = "refs/tags/v${version}";
hash = "sha256-yYp+2y4QIOykkrObWaXbZMMc2fsRn/+tGWqySA7V534=";
};

propagatedBuildInputs = [
sourceRoot = "${src.name}/host";

postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail '"setuptools-git-versioning<2"' "" \
--replace-fail 'dynamic = ["version"]' 'version = "${version}"'
'';

build-system = [
setuptools
];

pythonRemoveDeps = [
"backports.functools-lru-cache"
];

dependencies = [
future
pyusb
];

disabled = !isPy3k;

preBuild = ''
cd host
substituteInPlace setup.py --replace "'backports.functools_lru_cache'" ""
substituteInPlace pygreat/comms.py --replace "from backports.functools_lru_cache import lru_cache as memoize_with_lru_cache" "from functools import lru_cache as memoize_with_lru_cache"
echo "$version" > ../VERSION
'';
pythonImportsCheck = [
"pygreat"
];

meta = with lib; {
meta = {
changelog = "https://github.com/greatscottgadgets/libgreat/releases/tag/v${version}";
description = "Python library for talking with libGreat devices";
homepage = "https://greatscottgadgets.com/greatfet/";
license = with licenses; [ bsd3 ];
homepage = "https://github.com/greatscottgadgets/libgreat/";
license = with lib.licenses; [ bsd3 ];
maintainers = with lib.maintainers; [ carlossless ];
};
}
Loading

0 comments on commit 1806bf8

Please sign in to comment.