From 1f31b264a44a4f66cd4fd23d8bf5490215eb5385 Mon Sep 17 00:00:00 2001 From: yuu Date: Tue, 12 Apr 2022 02:31:38 -0300 Subject: [PATCH 1/4] python3Packages.datauri: init at 1.1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sandro Jäckel --- .../python-modules/datauri/default.nix | 37 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 39 insertions(+) create mode 100644 pkgs/development/python-modules/datauri/default.nix diff --git a/pkgs/development/python-modules/datauri/default.nix b/pkgs/development/python-modules/datauri/default.nix new file mode 100644 index 000000000000..da6ffe3bd266 --- /dev/null +++ b/pkgs/development/python-modules/datauri/default.nix @@ -0,0 +1,37 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "datauri"; + version = "1.1.0"; + + src = fetchFromGitHub { + owner = "fcurella"; + repo = "python-datauri"; + rev = "v${version}"; + sha256 = "sha256-Eevd/xxKgxvvsAfI/L/KShH+PfxffBGyVwKewLgyEu0="; + }; + + pythonImportsCheck = [ + "datauri" + ]; + + checkInputs = [ + pytestCheckHook + ]; + + disabledTestPaths = [ + # UnicodeDecodeError: 'utf-8' codec can't decode + "tests/test_file_ebcdic.txt" + ]; + + meta = with lib; { + description = "Data URI manipulation made easy."; + homepage = "https://github.com/fcurella/python-datauri"; + license = licenses.unlicense; + maintainers = with maintainers; [ yuu ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 6d16359d29f1..3ff64f4707f5 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2152,6 +2152,8 @@ in { datatable = callPackage ../development/python-modules/datatable { }; + datauri = callPackage ../development/python-modules/datauri { }; + dateparser = callPackage ../development/python-modules/dateparser { }; dateutils = callPackage ../development/python-modules/dateutils { }; From 84ed70a789f8b4d51b137638607d8913c49fa50c Mon Sep 17 00:00:00 2001 From: yuu Date: Tue, 12 Apr 2022 02:32:40 -0300 Subject: [PATCH 2/4] python3Packages.reqif: init at 0.0.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sandro Jäckel --- .../python-modules/reqif/default.nix | 60 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 62 insertions(+) create mode 100644 pkgs/development/python-modules/reqif/default.nix diff --git a/pkgs/development/python-modules/reqif/default.nix b/pkgs/development/python-modules/reqif/default.nix new file mode 100644 index 000000000000..3f8376f659ef --- /dev/null +++ b/pkgs/development/python-modules/reqif/default.nix @@ -0,0 +1,60 @@ +{ lib +, buildPythonPackage +, python3 +, pythonOlder +, fetchFromGitHub +, poetry-core +, beautifulsoup4 +, lxml +, jinja2 +, dataclasses +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "reqif"; + version = "0.0.8"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "strictdoc-project"; + repo = pname; + rev = version; + sha256 = "sha256-PtzRJUvv+Oee08+sdakFviKIhwfLngyal1WSWDtMELg="; + }; + + postPatch = '' + substituteInPlace ./tests/unit/conftest.py --replace \ + "os.path.abspath(os.path.join(__file__, \"../../../../reqif\"))" \ + "\"${placeholder "out"}/${python3.sitePackages}/reqif\"" + substituteInPlace pyproject.toml --replace "^" ">=" + substituteInPlace requirements.txt --replace "==" ">=" + ''; + + nativeBuildInputs = [ + poetry-core + ]; + + propagatedBuildInputs = [ + beautifulsoup4 + lxml + jinja2 + ] ++ lib.optionals (pythonOlder "3.7") [ + dataclasses + ]; + + pythonImportsCheck = [ + "reqif" + ]; + + checkInputs = [ + pytestCheckHook + ]; + + meta = with lib; { + description = "Python library for ReqIF format"; + homepage = "https://github.com/strictdoc-project/reqif"; + license = licenses.asl20; + maintainers = with maintainers; [ yuu ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 3ff64f4707f5..271a57e491e1 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -9219,6 +9219,8 @@ in { reproject = callPackage ../development/python-modules/reproject { }; + reqif = callPackage ../development/python-modules/reqif { }; + requests-aws4auth = callPackage ../development/python-modules/requests-aws4auth { }; requests-cache = callPackage ../development/python-modules/requests-cache { }; From ddd6313bff5885731b1e62c77affc2d654ea1a47 Mon Sep 17 00:00:00 2001 From: yuu Date: Tue, 12 Apr 2022 02:33:11 -0300 Subject: [PATCH 3/4] python3Packages.textx: init at 3.0.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sandro Jäckel Co-authored-by: Martin Weinelt Co-authored-by: Jonathan Ringer Co-authored-by: Gaute Ravndal --- .../python-modules/textx/default.nix | 178 ++++++++++++++++++ .../python-modules/textx/tests.nix | 53 ++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 233 insertions(+) create mode 100644 pkgs/development/python-modules/textx/default.nix create mode 100644 pkgs/development/python-modules/textx/tests.nix diff --git a/pkgs/development/python-modules/textx/default.nix b/pkgs/development/python-modules/textx/default.nix new file mode 100644 index 000000000000..9243d3a3edb0 --- /dev/null +++ b/pkgs/development/python-modules/textx/default.nix @@ -0,0 +1,178 @@ +{ lib +, buildPythonPackage +, python3 +, fetchFromGitHub +, mkdocs +, twine +, arpeggio +, click +, future +, setuptools +, callPackage +, gprof2dot +, html5lib +, jinja2 +, memory_profiler +, psutil +, pytestCheckHook +}: + +let + textx = buildPythonPackage rec { + pname = "textx"; + version = "3.0.0"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = pname; + repo = pname; + rev = version; + sha256 = "sha256-uZlO82dKtWQQR5+Q7dWk3+ZoUzAjDJ8qzC4UMLCtnBk="; + }; + + postPatch = '' + substituteInPlace setup.cfg --replace "click >=7.0, <8.0" "click >=7.0" + ''; + + outputs = [ + "out" + "testout" + ]; + + nativeBuildInputs = [ + mkdocs + twine + ]; + + propagatedBuildInputs = [ + arpeggio + click + future + setuptools + ]; + + postInstall = '' + # FileNotFoundError: [Errno 2] No such file or directory: '$out/lib/python3.10/site-packages/textx/textx.tx + cp "$src/textx/textx.tx" "$out/${python3.sitePackages}/${pname}/" + + # Install tests as the tests output. + mkdir $testout + cp -r tests $testout/tests + ''; + + pythonImportsCheck = [ + "textx" + ]; + + # Circular dependencies, do tests in passthru.tests instead. + doCheck = false; + + passthru.tests = { + textxTests = callPackage ./tests.nix { + inherit + textx-data-dsl + textx-example-project + textx-flow-codegen + textx-flow-dsl + textx-types-dsl; + }; + }; + + meta = with lib; { + description = "Domain-specific languages and parsers in Python"; + homepage = "https://github.com/textx/textx/"; + license = licenses.mit; + maintainers = with maintainers; [ yuu ]; + }; + }; + + textx-data-dsl = buildPythonPackage rec { + pname = "textx-data-dsl"; + version = "1.0.0"; + inherit (textx) src; + # `format` isn't included in the output of `mk-python-derivation`. + # So can't inherit format: `error: attribute 'format' missing`. + format = "setuptools"; + pathToSourceRoot = "tests/functional/registration/projects/data_dsl"; + sourceRoot = "${src.name}/" + pathToSourceRoot; + propagatedBuildInputs = [ + textx + textx-types-dsl + ]; + meta = with lib; { + inherit (textx.meta) license maintainers; + description = "Sample textX language for testing"; + homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot; + }; + }; + + textx-flow-codegen = buildPythonPackage rec { + pname = "textx-flow-codegen"; + version = "1.0.0"; + inherit (textx) src; + format = "setuptools"; + pathToSourceRoot = "tests/functional/registration/projects/flow_codegen"; + sourceRoot = "${src.name}/" + pathToSourceRoot; + propagatedBuildInputs = [ + click + textx + ]; + meta = with lib; { + inherit (textx.meta) license maintainers; + description = "Sample textX language for testing"; + homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot; + }; + }; + + textx-flow-dsl = buildPythonPackage rec { + pname = "textx-flow-dsl"; + version = "1.0.0"; + inherit (textx) src; + format = "setuptools"; + pathToSourceRoot = "tests/functional/registration/projects/flow_dsl"; + sourceRoot = "${src.name}/" + pathToSourceRoot; + propagatedBuildInputs = [ + textx + ]; + meta = with lib; { + inherit (textx.meta) license maintainers; + description = "Sample textX language for testing"; + homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot; + }; + }; + + textx-types-dsl = buildPythonPackage rec { + pname = "textx-types-dsl"; + version = "1.0.0"; + inherit (textx) src; + format = "setuptools"; + pathToSourceRoot = "tests/functional/registration/projects/types_dsl"; + sourceRoot = "${src.name}/" + pathToSourceRoot; + propagatedBuildInputs = [ + textx + ]; + meta = with lib; { + inherit (textx.meta) license maintainers; + description = "Sample textX language for testing"; + homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot; + }; + }; + + textx-example-project = buildPythonPackage rec { + pname = "textx-example-project"; + version = "1.0.0"; + inherit (textx) src; + format = "setuptools"; + pathToSourceRoot = "tests/functional/subcommands/example_project"; + sourceRoot = "${src.name}/" + pathToSourceRoot; + propagatedBuildInputs = [ + textx + ]; + meta = with lib; { + inherit (textx.meta) license maintainers; + description = "Sample textX sub-command for testing"; + homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot; + }; + }; +in + textx diff --git a/pkgs/development/python-modules/textx/tests.nix b/pkgs/development/python-modules/textx/tests.nix new file mode 100644 index 000000000000..021224e9f35d --- /dev/null +++ b/pkgs/development/python-modules/textx/tests.nix @@ -0,0 +1,53 @@ +{ lib +, buildPythonPackage +, click +, gprof2dot +, html5lib +, jinja2 +, memory_profiler +, psutil +, pytestCheckHook +, setuptools +, textx +, textx-data-dsl +, textx-example-project +, textx-flow-codegen +, textx-flow-dsl +, textx-types-dsl +}: + +buildPythonPackage { + pname = "textx-tests"; + inherit (textx) version; + + srcs = textx.testout; + + dontBuild = true; + dontInstall = true; + + checkInputs = [ + click + gprof2dot + html5lib + jinja2 + memory_profiler + psutil + pytestCheckHook + setuptools + textx-data-dsl + textx-example-project + textx-flow-codegen + textx-flow-dsl + textx-types-dsl + ]; + + pytestFlagsArray = [ + "tests/functional" + ]; + + meta = with lib; { + inherit (textx.meta) license maintainers; + description = "passthru.tests for textx"; + homepage = textx.homepage + "tree/${version}/" + "tests/"; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 271a57e491e1..171c358e8067 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -10516,6 +10516,8 @@ in { textwrap3 = callPackage ../development/python-modules/textwrap3 { }; + textx = callPackage ../development/python-modules/textx { }; + tflearn = callPackage ../development/python-modules/tflearn { }; tgcrypto = callPackage ../development/python-modules/tgcrypto { }; From 7b560da1dc984749e111251da401b6b395b2ca66 Mon Sep 17 00:00:00 2001 From: yuu Date: Tue, 12 Apr 2022 02:33:57 -0300 Subject: [PATCH 4/4] strictdoc: init at 0.0.26 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sandro Jäckel Co-authored-by: Jonathan Ringer --- .../engineering/strictdoc/conftest.py.patch | 15 +++ .../science/engineering/strictdoc/default.nix | 100 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 117 insertions(+) create mode 100644 pkgs/applications/science/engineering/strictdoc/conftest.py.patch create mode 100644 pkgs/applications/science/engineering/strictdoc/default.nix diff --git a/pkgs/applications/science/engineering/strictdoc/conftest.py.patch b/pkgs/applications/science/engineering/strictdoc/conftest.py.patch new file mode 100644 index 000000000000..2fadf242b7a3 --- /dev/null +++ b/pkgs/applications/science/engineering/strictdoc/conftest.py.patch @@ -0,0 +1,15 @@ +diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py +index 932747c..9b3d6ac 100644 +--- a/tests/unit/conftest.py ++++ b/tests/unit/conftest.py +@@ -1,9 +1,7 @@ + import os + import sys + +-STRICTDOC_ROOT_PATH = os.path.abspath( +- os.path.join(__file__, "../../../../strictdoc") +-) ++STRICTDOC_ROOT_PATH = "@strictdoc_root_path@" + assert os.path.exists(STRICTDOC_ROOT_PATH), "does not exist: {}".format( + STRICTDOC_ROOT_PATH + ) diff --git a/pkgs/applications/science/engineering/strictdoc/default.nix b/pkgs/applications/science/engineering/strictdoc/default.nix new file mode 100644 index 000000000000..3fc61b845156 --- /dev/null +++ b/pkgs/applications/science/engineering/strictdoc/default.nix @@ -0,0 +1,100 @@ +{ lib +, stdenv +, buildPythonApplication +, fetchFromGitHub +, python3 +, pythonOlder +, html5lib +, invoke +, openpyxl +, poetry-core +, tidylib +, beautifulsoup4 +, dataclasses +, datauri +, docutils +, jinja2 +, lxml +, markupsafe +, pygments +, reqif +, setuptools +, textx +, xlrd +, XlsxWriter +, pytestCheckHook +}: + +buildPythonApplication rec { + pname = "strictdoc"; + version = "0.0.26"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "strictdoc-project"; + repo = pname; + rev = version; + sha256 = "sha256-SMAwji75AjW8CzXRKBDF+fR/a5++GhgIvkcuD+a/vp4="; + }; + + patches = [ + ./conftest.py.patch + ]; + + postPatch = '' + substituteInPlace ./tests/unit/conftest.py \ + --replace @strictdoc_root_path@ "${placeholder "out"}/${python3.sitePackages}/strictdoc" + + substituteInPlace requirements.txt \ + --replace "jinja2 >= 2.11.2, <3.0" "jinja2 >= 2.11.2" \ + --replace "reqif >= 0.0.18, == 0.*" "reqif>=0.0.8" \ + --replace "==" ">=" \ + --replace "~=" ">=" + ''; + + nativeBuildInputs = [ + html5lib + invoke + openpyxl + poetry-core + tidylib + ]; + + propagatedBuildInputs = [ + beautifulsoup4 + datauri + docutils + jinja2 + lxml + markupsafe + pygments + reqif + setuptools + textx + xlrd + XlsxWriter + ] ++ lib.optionals (pythonOlder "3.7") [ + dataclasses + ]; + + checkInputs = [ + pytestCheckHook + ]; + + pythonImportsCheck = [ + "strictdoc" + ]; + + disabledTests = [ + # fixture 'fs' not found + "test_001_load_from_files" + ]; + + meta = with lib; { + description = "Software requirements specification tool"; + homepage = "https://github.com/strictdoc-project/strictdoc"; + changelog = "https://github.com/strictdoc-project/strictdoc/releases"; + license = licenses.asl20; + maintainers = with maintainers; [ yuu ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f5f1a48ba964..24dd3606db7b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -34057,6 +34057,8 @@ with pkgs; jflap = callPackage ../applications/science/engineering/jflap { }; + strictdoc = python3.pkgs.callPackage ../applications/science/engineering/strictdoc { }; + ### SCIENCE / ELECTRONICS adms = callPackage ../applications/science/electronics/adms { };