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