mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-03 10:44:18 +00:00
Merge pull request #305753 from jonboh/solidpython2
This commit is contained in:
commit
febf0c4594
49
pkgs/development/python-modules/solidpython2/default.nix
Normal file
49
pkgs/development/python-modules/solidpython2/default.nix
Normal file
@ -0,0 +1,49 @@
|
||||
{ buildPythonPackage
|
||||
, fetchFromGitHub
|
||||
, lib
|
||||
, ply
|
||||
, setuptools
|
||||
, poetry-core
|
||||
, withOpenSCAD ? false
|
||||
, openscad
|
||||
}:
|
||||
buildPythonPackage rec {
|
||||
pname = "solidpython2";
|
||||
version = "2.1.0";
|
||||
pyproject = true;
|
||||
src = fetchFromGitHub {
|
||||
owner = "jeff-dh";
|
||||
repo = "SolidPython";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-Tq3hrsC2MmueCqChk6mY/u/pCjF/pFuU2o3K+qw7ImY=";
|
||||
};
|
||||
|
||||
# NOTE: this patch makes tests runnable outside the source-tree
|
||||
# - it uses diff instead of git-diff
|
||||
# - modifies the tests output to resemble the paths resulting from running inside the source-tree
|
||||
# - drop the openscad image geneneration tests, these don't work on the nix sandbox due to the need for xserver
|
||||
patches = [ ./difftool_tests.patch ];
|
||||
|
||||
propagatedBuildInputs = lib.optionals withOpenSCAD [openscad];
|
||||
|
||||
build-system = [
|
||||
poetry-core
|
||||
];
|
||||
dependencies = [
|
||||
ply
|
||||
setuptools
|
||||
];
|
||||
pythonImportsCheck = [ "solid2" ];
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
python $TMPDIR/source/tests/run_tests.py
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/jeff-dh/SolidPython";
|
||||
description = "A python frontend for solid modelling that compiles to OpenSCAD";
|
||||
license = licenses.lgpl2Plus;
|
||||
maintainers = with maintainers; [ jonboh ];
|
||||
};
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
diff --git a/tests/examples_test.py b/tests/examples_test.py
|
||||
index 77204fd..9784389 100644
|
||||
--- a/tests/examples_test.py
|
||||
+++ b/tests/examples_test.py
|
||||
@@ -48,14 +48,19 @@ class ExamplesTest(unittest.TestCase):
|
||||
subprocess.check_call(["python3", f.as_posix()])
|
||||
# copy generated scad file to examples_scad/
|
||||
copyWithRelativeIncludes(f.with_suffix(".scad"), test_scad_file)
|
||||
- # call git diff test/examples_scad/{f}.scad
|
||||
- diff = subprocess.check_output(["git", "diff",
|
||||
- test_scad_file.as_posix()])
|
||||
- # make sure there's no diff
|
||||
- self.assertEqual(diff.decode(), "")
|
||||
- # render with openscad
|
||||
- subprocess.check_call([get_openscad_executable(), "-o",
|
||||
- test_scad_file.with_suffix(".png"),
|
||||
- "--preview", "-",
|
||||
- test_scad_file],
|
||||
- stderr=subprocess.DEVNULL)
|
||||
+ subprocess.check_call(
|
||||
+ [
|
||||
+ "sed",
|
||||
+ "-i",
|
||||
+ f"s#^include <.*/solid2#include <../../solid2#g",
|
||||
+ test_scad_file.as_posix(),
|
||||
+ ]
|
||||
+ )
|
||||
+ nixsrc = os.getenv("src")
|
||||
+ subprocess.check_call(
|
||||
+ [
|
||||
+ "diff",
|
||||
+ f"{nixsrc}/tests/examples_scad/{f.with_suffix('.scad').name}",
|
||||
+ test_scad_file.as_posix(),
|
||||
+ ]
|
||||
+ )
|
@ -14313,6 +14313,8 @@ self: super: with self; {
|
||||
|
||||
solc-select = callPackage ../development/python-modules/solc-select { };
|
||||
|
||||
solidpython2 = callPackage ../development/python-modules/solidpython2 { };
|
||||
|
||||
solo-python = disabledIf (!pythonAtLeast "3.6") (callPackage ../development/python-modules/solo-python { });
|
||||
|
||||
somajo = callPackage ../development/python-modules/somajo { };
|
||||
|
Loading…
Reference in New Issue
Block a user