Merge pull request #188338 from squalus/write-python

This commit is contained in:
Lassulus 2022-08-26 08:15:26 +02:00 committed by GitHub
commit 57102926ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -237,7 +237,7 @@ let
# makePythonWriter takes python and compatible pythonPackages and produces python script writer, # makePythonWriter takes python and compatible pythonPackages and produces python script writer,
# which validates the script with flake8 at build time. If any libraries are specified, # which validates the script with flake8 at build time. If any libraries are specified,
# python.withPackages is used as interpreter, otherwise the "bare" python is used. # python.withPackages is used as interpreter, otherwise the "bare" python is used.
makePythonWriter = python: pythonPackages: name: { libraries ? [], flakeIgnore ? [] }: makePythonWriter = python: pythonPackages: buildPythonPackages: name: { libraries ? [], flakeIgnore ? [] }:
let let
ignoreAttribute = optionalString (flakeIgnore != []) "--ignore ${concatMapStringsSep "," escapeShellArg flakeIgnore}"; ignoreAttribute = optionalString (flakeIgnore != []) "--ignore ${concatMapStringsSep "," escapeShellArg flakeIgnore}";
in in
@ -248,7 +248,7 @@ let
else "${python.withPackages (ps: libraries)}/bin/python" else "${python.withPackages (ps: libraries)}/bin/python"
; ;
check = optionalString python.isPy3k (writeDash "pythoncheck.sh" '' check = optionalString python.isPy3k (writeDash "pythoncheck.sh" ''
exec ${pythonPackages.flake8}/bin/flake8 --show-source ${ignoreAttribute} "$1" exec ${buildPythonPackages.flake8}/bin/flake8 --show-source ${ignoreAttribute} "$1"
''); '');
} name; } name;
@ -264,7 +264,7 @@ let
# #
# print Test.a # print Test.a
# '' # ''
writePyPy2 = makePythonWriter pkgs.pypy2 pkgs.pypy2Packages; writePyPy2 = makePythonWriter pkgs.pypy2 pkgs.pypy2Packages buildPackages.pypy2Packages;
# writePyPy2Bin takes the same arguments as writePyPy2 but outputs a directory (like writeScriptBin) # writePyPy2Bin takes the same arguments as writePyPy2 but outputs a directory (like writeScriptBin)
writePyPy2Bin = name: writePyPy2Bin = name:
@ -282,7 +282,7 @@ let
# """) # """)
# print(y[0]['test']) # print(y[0]['test'])
# '' # ''
writePython3 = makePythonWriter pkgs.python3 pkgs.python3Packages; writePython3 = makePythonWriter pkgs.python3 pkgs.python3Packages buildPackages.python3Packages;
# writePython3Bin takes the same arguments as writePython3 but outputs a directory (like writeScriptBin) # writePython3Bin takes the same arguments as writePython3 but outputs a directory (like writeScriptBin)
writePython3Bin = name: writePython3Bin = name:
@ -300,7 +300,7 @@ let
# """) # """)
# print(y[0]['test']) # print(y[0]['test'])
# '' # ''
writePyPy3 = makePythonWriter pkgs.pypy3 pkgs.pypy3Packages; writePyPy3 = makePythonWriter pkgs.pypy3 pkgs.pypy3Packages buildPackages.pypy3Packages;
# writePyPy3Bin takes the same arguments as writePyPy3 but outputs a directory (like writeScriptBin) # writePyPy3Bin takes the same arguments as writePyPy3 but outputs a directory (like writeScriptBin)
writePyPy3Bin = name: writePyPy3Bin = name: