File tree Expand file tree Collapse file tree 4 files changed +68
-18
lines changed Expand file tree Collapse file tree 4 files changed +68
-18
lines changed Original file line number Diff line number Diff line change 66, eigen
77, fetchFromGitHub
88, fmt
9- , freecad
109, gfortran
1110, gts
1211, hdf5
2322, opencascade-occt_7_6
2423, pkg-config
2524, python311Packages
26- , runCommand # for passthru.tests
2725, spaceNavSupport ? stdenv . hostPlatform . isLinux
2826, stdenv
2927, swig
@@ -177,22 +175,7 @@ freecad-utils.makeCustomizable (stdenv.mkDerivation (finalAttrs: {
177175 ln -s $out/bin/FreeCADCmd $out/bin/freecadcmd
178176 '' ;
179177
180- passthru . tests = {
181- # Check that things such as argument parsing still work correctly with
182- # the above PYTHONPATH patch. Previously the patch used above changed
183- # the `PyConfig_InitIsolatedConfig` to `PyConfig_InitPythonConfig`,
184- # which caused the built-in interpreter to attempt (and fail) to doubly
185- # parse argv. This should catch if that ever regresses and also ensures
186- # that PYTHONPATH is still respected enough for the FreeCAD console to
187- # successfully run and check that it was included in `sys.path`.
188- python-path =
189- runCommand "freecad-test-console"
190- {
191- nativeBuildInputs = [ freecad ] ;
192- } ''
193- HOME="$(mktemp -d)" PYTHONPATH="$(pwd)/test" FreeCADCmd --log-file $out -c "if not '$(pwd)/test' in sys.path: sys.exit(1)" </dev/null
194- '' ;
195- } ;
178+ passthru . tests = callPackage ./tests { } ;
196179
197180 meta = {
198181 homepage = "https://www.freecad.org" ;
Original file line number Diff line number Diff line change 1+ {
2+ callPackage ,
3+ } :
4+ {
5+ python-path = callPackage ./python-path.nix { } ;
6+ modules = callPackage ./modules.nix { } ;
7+ }
Original file line number Diff line number Diff line change 1+ {
2+ freecad ,
3+ runCommand ,
4+ writeTextFile ,
5+ } :
6+ let
7+ mkModule =
8+ n :
9+ writeTextFile {
10+ name = "module-${ n } " ;
11+ destination = "/Init.py" ;
12+ text = ''
13+ import sys
14+ import os
15+
16+ out = os.environ['out']
17+ f = open(out + "/module-${ n } .touch", "w")
18+ f.write("module-${ n } ");
19+ f.close()
20+ '' ;
21+ } ;
22+ module-1 = mkModule "1" ;
23+ module-2 = mkModule "2" ;
24+ freecad-customized = freecad . customize {
25+ modules = [
26+ module-1
27+ module-2
28+ ] ;
29+ } ;
30+ in
31+ runCommand "freecad-test-modules"
32+ {
33+ nativeBuildInputs = [ freecad-customized ] ;
34+ }
35+ ''
36+ mkdir $out
37+ HOME="$(mktemp -d)" FreeCADCmd --log-file $out/freecad.log -c "sys.exit(0)" </dev/null
38+ test -f $out/module-1.touch
39+ test -f $out/module-2.touch
40+ grep -q 'Initializing ${ module-1 } ... done' $out/freecad.log
41+ grep -q 'Initializing ${ module-2 } ... done' $out/freecad.log
42+ ''
Original file line number Diff line number Diff line change 1+ {
2+ freecad ,
3+ runCommand ,
4+ } :
5+ # Check that things such as argument parsing still work correctly with
6+ # the above PYTHONPATH patch. Previously the patch used above changed
7+ # the `PyConfig_InitIsolatedConfig` to `PyConfig_InitPythonConfig`,
8+ # which caused the built-in interpreter to attempt (and fail) to doubly
9+ # parse argv. This should catch if that ever regresses and also ensures
10+ # that PYTHONPATH is still respected enough for the FreeCAD console to
11+ # successfully run and check that it was included in `sys.path`.
12+ runCommand "freecad-test-console"
13+ {
14+ nativeBuildInputs = [ freecad ] ;
15+ }
16+ ''
17+ HOME="$(mktemp -d)" PYTHONPATH="$(pwd)/test" FreeCADCmd --log-file $out -c "if not '$(pwd)/test' in sys.path: sys.exit(1)" </dev/null
18+ ''
You can’t perform that action at this time.
0 commit comments