New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
buildPythonPackage: add support for setupPyDistFlags #64682
Conversation
Flags passed to the "python setup.py" command.
By the way how to add labels? I think this one needs |
in attrs // { | ||
# we copy nix_run_setup over so it's executed relative to the root of the source | ||
# many project make that assumption | ||
buildPhase = attrs.buildPhase or '' | ||
runHook preBuild | ||
cp ${setuppy} nix_run_setup | ||
${python.pythonForBuild.interpreter} nix_run_setup ${lib.optionalString (setupPyBuildFlags != []) ("build_ext " + (lib.concatStringsSep " " setupPyBuildFlags))} bdist_wheel | ||
${python.pythonForBuild.interpreter} nix_run_setup ${setupPyDistFlagsString} ${setupPyBuildExtString} bdist_wheel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I read nix_run_setup
docs correctly setupPyDistFlags
here will be applied to all commands, not just dist. In fact I need just that for Tensorflow but we need to either fix the option name to setupPyCommonFlags
or force the arguments to be for bdist_wheel
only by placing them after bdist_wheel
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you give a link to the docs you've used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct the name is a bit too specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usage: nix_run_setup [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: nix_run_setup --help [cmd1 cmd2 ...]
or: nix_run_setup --help-commands
or: nix_run_setup cmd --help
From reading run_setup.py
source code I assume this actually comes from setuptools.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, setup.py
is distutils/setuptools and these options come from the setup
function.
# Execute before shell hook | ||
, preShellHook ? "" | ||
# Execute after shell hook | ||
, postShellHook ? "" | ||
, ... } @ attrs: | ||
|
||
let | ||
installOptions = lib.concatMapStringsSep " " (option: "--install-option ${option}") setupPyDistFlags; | ||
options = lib.concatMapStringsSep " " (option: "--global-option ${option}") setupPyBuildFlags; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also if we rename setupPyDistFlags
option to pass global flags instead we also need to add them to options
here as --global-option
s instead of --install-option
s.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Speaking of which, is that right to use --global-option
instead of some kind of --build-option
here for setupPyBuildFlags
?
I will revert this and we can have another go at it. There are indeed some mistakes regarding |
@aske Given that you de facto used this as global options and I need it too for Tensorflow we could add
|
Follow-up in #64701. |
Flags passed to the "python setup.py" command.
Motivation for this change
Allow to pass flags to "python setup.py", see #64627.
Things done
Added a new
setupPyDistFlags
option (not sure about the name).cc @FRidh
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)