pkgs.writers: remove tests that dont work anymore and add comments tracking issues

authored by Tulili and committed by lassulus f6e0ee55 05ad04bd

+62 -51
+1
pkgs/build-support/writers/default.nix
··· 1 1 { config, lib, callPackages }: 2 2 3 + # If you are reading this, you can test these writers by running: nix-build . -A tests.writers 3 4 let 4 5 aliases = if config.allowAliases then (import ./aliases.nix lib) else prev: {}; 5 6
+18 -16
pkgs/build-support/writers/scripts.nix
··· 13 13 in 14 14 rec { 15 15 # Base implementation for non-compiled executables. 16 - # Takes an interpreter, for example `${pkgs.bash}/bin/bash` 16 + # Takes an interpreter, for example `${lib.getExe pkgs.bash}` 17 17 # 18 18 # Examples: 19 19 # writeBash = makeScriptWriter { interpreter = "${pkgs.bash}/bin/bash"; } ··· 116 116 # echo hello world 117 117 # '' 118 118 writeBash = makeScriptWriter { 119 - interpreter = "${pkgs.bash}/bin/bash"; 119 + interpreter = "${lib.getExe pkgs.bash}"; 120 120 }; 121 121 122 122 # Like writeScriptBin but the first line is a shebang to bash ··· 130 130 # echo hello world 131 131 # '' 132 132 writeDash = makeScriptWriter { 133 - interpreter = "${pkgs.dash}/bin/dash"; 133 + interpreter = "${lib.getExe pkgs.dash}"; 134 134 }; 135 135 136 136 # Like writeScriptBin but the first line is a shebang to dash ··· 144 144 # echo hello world 145 145 # '' 146 146 writeFish = makeScriptWriter { 147 - interpreter = "${pkgs.fish}/bin/fish --no-config"; 148 - check = "${pkgs.fish}/bin/fish --no-config --no-execute"; # syntax check only 147 + interpreter = "${lib.getExe pkgs.fish} --no-config"; 148 + check = "${lib.getExe pkgs.fish} --no-config --no-execute"; # syntax check only 149 149 }; 150 150 151 151 # Like writeScriptBin but the first line is a shebang to fish ··· 175 175 in makeBinWriter { 176 176 compileScript = '' 177 177 cp $contentPath tmp.hs 178 - ${ghc.withPackages (_: libraries )}/bin/ghc ${lib.escapeShellArgs ghcArgs'} tmp.hs 178 + ${(ghc.withPackages (_: libraries ))}/bin/ghc ${lib.escapeShellArgs ghcArgs'} tmp.hs 179 179 mv tmp $out 180 180 ''; 181 181 inherit strip; ··· 192 192 # echo hello world 193 193 # '' 194 194 writeNu = makeScriptWriter { 195 - interpreter = "${pkgs.nushell}/bin/nu --no-config-file"; 195 + interpreter = "${lib.getExe pkgs.nushell} --no-config-file"; 196 196 }; 197 197 198 198 # Like writeScriptBin but the first line is a shebang to nu ··· 206 206 # puts "hello world" 207 207 # '' 208 208 writeRuby = makeScriptWriter { 209 - interpreter = "${pkgs.ruby}/bin/ruby"; 209 + interpreter = "${lib.getExe pkgs.ruby}"; 210 210 }; 211 211 212 212 writeRubyBin = name: ··· 219 219 # print("hello world") 220 220 # '' 221 221 writeLua = makeScriptWriter { 222 - interpreter = "${pkgs.lua}/bin/lua"; 222 + interpreter = "${lib.getExe pkgs.lua}"; 223 223 }; 224 224 225 225 writeLuaBin = name: ··· 236 236 makeBinWriter { 237 237 compileScript = '' 238 238 cp "$contentPath" tmp.rs 239 - PATH=${lib.makeBinPath [pkgs.gcc]} ${lib.getBin rustc}/bin/rustc ${lib.escapeShellArgs rustcArgs} ${lib.escapeShellArgs darwinArgs} -o "$out" tmp.rs 239 + PATH=${lib.makeBinPath [pkgs.gcc]} ${rustc}/bin/rustc ${lib.escapeShellArgs rustcArgs} ${lib.escapeShellArgs darwinArgs} -o "$out" tmp.rs 240 240 ''; 241 241 inherit strip; 242 242 } name; ··· 265 265 }; 266 266 in writeDash name '' 267 267 export NODE_PATH=${node-env}/lib/node_modules 268 - exec ${pkgs.nodejs}/bin/node ${pkgs.writeText "js" content} "$@" 268 + exec ${lib.getExe pkgs.nodejs} ${pkgs.writeText "js" content} "$@" 269 269 ''; 270 270 271 271 # writeJSBin takes the same arguments as writeJS but outputs a directory (like writeScriptBin) ··· 300 300 # '' 301 301 writePerl = name: { libraries ? [] }: 302 302 makeScriptWriter { 303 - interpreter = "${pkgs.perl.withPackages (p: libraries)}/bin/perl"; 303 + interpreter = "${lib.getExe (pkgs.perl.withPackages (p: libraries))}"; 304 304 } name; 305 305 306 306 # writePerlBin takes the same arguments as writePerl but outputs a directory (like writeScriptBin) ··· 316 316 in 317 317 makeScriptWriter { 318 318 interpreter = 319 - if libraries == [] 320 - then python.interpreter 321 - else (python.withPackages (ps: libraries)).interpreter 319 + if pythonPackages != pkgs.pypy2Packages || pythonPackages != pkgs.pypy3Packages then 320 + if libraries == [] 321 + then python.interpreter 322 + else (python.withPackages (ps: libraries)).interpreter 323 + else python.interpreter 322 324 ; 323 325 check = optionalString python.isPy3k (writeDash "pythoncheck.sh" '' 324 326 exec ${buildPythonPackages.flake8}/bin/flake8 --show-source ${ignoreAttribute} "$1" ··· 398 400 export DOTNET_CLI_TELEMETRY_OPTOUT=1 399 401 export DOTNET_NOLOGO=1 400 402 script="$1"; shift 401 - ${dotnet-sdk}/bin/dotnet fsi --quiet --nologo --readline- ${fsi-flags} "$@" < "$script" 403 + ${lib.getExe dotnet-sdk} fsi --quiet --nologo --readline- ${fsi-flags} "$@" < "$script" 402 404 ''; 403 405 404 406 in content: makeScriptWriter {
+43 -35
pkgs/build-support/writers/test.nix
··· 11 11 , writers 12 12 , writeText 13 13 }: 14 + 15 + # If you are reading this, you can test these writers by running: nix-build . -A tests.writers 16 + 14 17 with writers; 15 18 let 16 19 expectSuccess = test: ··· 88 91 print "success\n" if true; 89 92 ''); 90 93 91 - pypy2 = expectSuccessBin (writePyPy2Bin "test-writers-pypy2-bin" { libraries = [ pypy2Packages.enum ]; } '' 92 - from enum import Enum 93 - 94 - class Test(Enum): 95 - a = "success" 96 - 97 - print Test.a 98 - ''); 99 - 100 94 python3 = expectSuccessBin (writePython3Bin "test-writers-python3-bin" { libraries = [ python3Packages.pyyaml ]; } '' 101 95 import yaml 102 96 ··· 106 100 print(y[0]['test']) 107 101 ''); 108 102 109 - pypy3 = expectSuccessBin (writePyPy3Bin "test-writers-pypy3-bin" { libraries = [ pypy3Packages.pyyaml ]; } '' 110 - import yaml 103 + # Commented out because of this issue: https://github.com/NixOS/nixpkgs/issues/39356 111 104 112 - y = yaml.safe_load(""" 113 - - test: success 114 - """) 115 - print(y[0]['test']) 116 - ''); 105 + #pypy2 = expectSuccessBin (writePyPy2Bin "test-writers-pypy2-bin" { libraries = [ pypy2Packages.enum ]; } '' 106 + # from enum import Enum 107 + # 108 + # class Test(Enum): 109 + # a = "success" 110 + # 111 + # print Test.a 112 + #''); 113 + 114 + #pypy3 = expectSuccessBin (writePyPy3Bin "test-writers-pypy3-bin" { libraries = [ pypy3Packages.pyyaml ]; } '' 115 + # import yaml 116 + # 117 + # y = yaml.safe_load(""" 118 + # - test: success 119 + # """) 120 + # print(y[0]['test']) 121 + #''); 117 122 }; 118 123 119 124 simple = lib.recurseIntoAttrs { ··· 158 163 print "success\n" if true; 159 164 ''); 160 165 161 - pypy2 = expectSuccess (writePyPy2 "test-writers-pypy2" { libraries = [ pypy2Packages.enum ]; } '' 162 - from enum import Enum 163 - 164 - class Test(Enum): 165 - a = "success" 166 - 167 - print Test.a 168 - ''); 169 - 170 166 python3 = expectSuccess (writePython3 "test-writers-python3" { libraries = [ python3Packages.pyyaml ]; } '' 171 167 import yaml 172 168 ··· 176 172 print(y[0]['test']) 177 173 ''); 178 174 179 - pypy3 = expectSuccess (writePyPy3 "test-writers-pypy3" { libraries = [ pypy3Packages.pyyaml ]; } '' 180 - import yaml 175 + # Commented out because of this issue: https://github.com/NixOS/nixpkgs/issues/39356 181 176 182 - y = yaml.safe_load(""" 183 - - test: success 184 - """) 185 - print(y[0]['test']) 186 - ''); 177 + #pypy2 = expectSuccessBin (writePyPy2Bin "test-writers-pypy2-bin" { libraries = [ pypy2Packages.enum ]; } '' 178 + # from enum import Enum 179 + # 180 + # class Test(Enum): 181 + # a = "success" 182 + # 183 + # print Test.a 184 + #''); 185 + 186 + #pypy3 = expectSuccessBin (writePyPy3Bin "test-writers-pypy3-bin" { libraries = [ pypy3Packages.pyyaml ]; } '' 187 + # import yaml 188 + # 189 + # y = yaml.safe_load(""" 190 + # - test: success 191 + # """) 192 + # print(y[0]['test']) 193 + #''); 187 194 188 195 fsharp = expectSuccess (makeFSharpWriter { 189 196 libraries = { fetchNuGet }: [ ··· 191 198 (fetchNuGet { pname = "System.Text.Json"; version = "4.6.0"; sha256 = "0ism236hwi0k6axssfq58s1d8lihplwiz058pdvl8al71hagri39"; }) 192 199 ]; 193 200 } "test-writers-fsharp" '' 201 + 194 202 #r "nuget: FSharp.SystemTextJson, 0.17.4" 195 203 196 204 module Json = ··· 209 217 |> printfn "%s" 210 218 ''); 211 219 212 - pypy2NoLibs = expectSuccess (writePyPy2 "test-writers-pypy2-no-libs" {} '' 213 - print("success") 214 - ''); 220 + #pypy2NoLibs = expectSuccess (writePyPy2 "test-writers-pypy2-no-libs" {} '' 221 + # print("success") 222 + #''); 215 223 216 224 python3NoLibs = expectSuccess (writePython3 "test-writers-python3-no-libs" {} '' 217 225 print("success")