-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
python3Packages.*Hook: support __structuredAttrs = true (the easier ones)
#351734
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
Changes from all commits
1f8bb94
c4bc1a8
3a0f6fa
1f39bb6
69f4871
967e5b4
bab7ef3
ccb418b
e4f2f9d
3a79bc3
29c08ad
65293f4
e32457a
6597b74
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,21 +10,23 @@ | |
| ''; | ||
| # the source of the example project | ||
| projectSource = runCommand "my-project-source" {} '' | ||
| mkdir -p $out/src | ||
| mkdir -p $out/src/my_project | ||
| cp ${pyprojectToml} $out/pyproject.toml | ||
| touch $out/src/__init__.py | ||
| touch $out/src/my_project/__init__.py | ||
|
||
| ''; | ||
| in | ||
| # this build must never triger conflicts | ||
| pythonOnBuildForHost.pkgs.buildPythonPackage { | ||
| pname = "dont-propagate-conflicting-deps"; | ||
| version = "0.0.0"; | ||
| src = projectSource; | ||
| format = "pyproject"; | ||
| propagatedBuildInputs = [ | ||
| pyproject = true; | ||
| dependencies = [ | ||
| # At least one dependency of `build` should be included here to | ||
| # keep the test meaningful | ||
| (mkConflict pythonOnBuildForHost.pkgs.tomli) | ||
| ]; | ||
| build-system = [ | ||
| # setuptools is also needed to build the example project | ||
| pythonOnBuildForHost.pkgs.setuptools | ||
| ]; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,28 @@ | ||
| # shellcheck shell=bash | ||
|
|
||
| # Setup hook for checking whether Python imports succeed | ||
| echo "Sourcing python-imports-check-hook.sh" | ||
|
|
||
| pythonImportsCheckPhase() { | ||
| echo "Executing pythonImportsCheckPhase" | ||
|
|
||
| if [ -n "$pythonImportsCheck" ]; then | ||
| echo "Check whether the following modules can be imported: $pythonImportsCheck" | ||
| pythonImportsCheckOutput=$out | ||
| if [ -n "$python" ]; then | ||
| if [[ -n "${pythonImportsCheck[*]-}" ]]; then | ||
| echo "Check whether the following modules can be imported: ${pythonImportsCheck[*]}" | ||
| # shellcheck disable=SC2154 | ||
| pythonImportsCheckOutput="$out" | ||
| if [[ -n "${python-}" ]]; then | ||
| echo "Using python specific output \$python for imports check" | ||
| pythonImportsCheckOutput=$python | ||
| fi | ||
| export PYTHONPATH="$pythonImportsCheckOutput/@pythonSitePackages@:$PYTHONPATH" | ||
| (cd $pythonImportsCheckOutput && @pythonCheckInterpreter@ -c 'import os; import importlib; list(map(lambda mod: importlib.import_module(mod), os.environ["pythonImportsCheck"].split()))') | ||
| # Python modules and namespaces names are Python identifiers, which must not contain spaces. | ||
| # See https://docs.python.org/3/reference/lexical_analysis.html | ||
| # shellcheck disable=SC2048,SC2086 | ||
| (cd "$pythonImportsCheckOutput" && @pythonCheckInterpreter@ -c 'import sys; import importlib; list(map(lambda mod: importlib.import_module(mod), sys.argv[1:]))' ${pythonImportsCheck[*]}) | ||
| fi | ||
| } | ||
|
|
||
| if [ -z "${dontUsePythonImportsCheck-}" ]; then | ||
| if [[ -z "${dontUsePythonImportsCheck-}" ]]; then | ||
| echo "Using pythonImportsCheckPhase" | ||
| appendToVar preDistPhases pythonImportsCheckPhase | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| # shellcheck shell=bash | ||
|
|
||
| echo "Sourcing setuptools-rust-hook" | ||
|
|
||
| setuptoolsRustSetup() { | ||
|
|
||
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.
Not blocking, but: would be nice to do a trick like that
/dev/nullthing to get declarations of all these essential variables.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.
The
/dev/null/ source stuff was there before, see my reasoning in #351734 (comment) for removing it for now.