From b9e249951a6268b949510dd9de3d4f87041bc01d Mon Sep 17 00:00:00 2001 From: Ethan Carter Edwards Date: Fri, 30 May 2025 14:09:40 -0400 Subject: [PATCH] compare50: init at 1.2.6 Signed-off-by: Ethan Carter Edwards --- pkgs/by-name/co/compare50/package.nix | 74 +++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 pkgs/by-name/co/compare50/package.nix diff --git a/pkgs/by-name/co/compare50/package.nix b/pkgs/by-name/co/compare50/package.nix new file mode 100644 index 000000000000..0981bb9454b7 --- /dev/null +++ b/pkgs/by-name/co/compare50/package.nix @@ -0,0 +1,74 @@ +{ + lib, + python3Packages, + fetchFromGitHub, + versionCheckHook, +}: + +python3Packages.buildPythonApplication rec { + pname = "compare50"; + version = "1.2.7"; + pyproject = true; + + src = fetchFromGitHub { + owner = "cs50"; + repo = "compare50"; + tag = "v${version}"; + hash = "sha256-T7ts/9Uux2gVhh5EGv8PRh9cbCQDbLBYD06sWqNSvLU="; + }; + + postPatch = '' + substituteInPlace setup.py --replace-fail \ + 'scripts=["bin/compare50"]' 'entry_points={"console_scripts": ["compare50=compare50.__main__:main"]}' + # auto included in current python version, no install needed + substituteInPlace setup.py --replace-fail \ + 'importlib' ' ' + ''; + + build-system = [ + python3Packages.setuptools + ]; + + dependencies = with python3Packages; [ + attrs + intervaltree + jinja2 + lib50 + numpy + packaging + pygments + termcolor + tqdm + ]; + + pythonRelaxDeps = [ + "attrs" + "numpy" + "termcolor" + ]; + + pythonImportsCheck = [ "compare50" ]; + + versionCheckProgramArg = "--version"; + nativeCheckInputs = [ versionCheckHook ]; + + # repo does not use pytest + checkPhase = '' + runHook preCheck + + ${python3Packages.python.interpreter} -m tests + + runHook postCheck + ''; + + meta = { + description = "Tool for detecting similarity in code supporting over 300 languages"; + homepage = "https://cs50.readthedocs.io/projects/compare50/en/latest/"; + downloadPage = "https://github.com/cs50/compare50"; + changelog = "https://github.com/cs50/compare50/releases/tag/v${version}"; + license = lib.licenses.gpl3Only; + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [ ethancedwards8 ]; + mainProgram = "compare50"; + }; +}