Commit Graph

144 Commits

Author SHA1 Message Date
OTABI Tomoya
55f94d9fda python3Packages: Fix and document the removal of the local .overrideAttrs attribute (#350127) 2024-11-19 17:45:32 +09:00
Yueh-Shun Li
6597b74fea pypaBuildHook.tests: modernize 2024-11-05 10:47:23 +08:00
Yueh-Shun Li
e32457af0c setuptoolsRustHook: lint with ShellCheck 2024-11-05 10:47:23 +08:00
Yueh-Shun Li
65293f4247 pythonRemoveTestDirHook: lint with ShellCheck 2024-11-05 10:47:23 +08:00
Yueh-Shun Li
29c08adae1 pythonRelaxDepsHook: lint with ShellCheck
Ignore SC2164 at this moment, as it will be gone when adding `set -e`.
2024-11-05 10:47:22 +08:00
Yueh-Shun Li
3a79bc3aee pythonRelaxDepsHook: handle attributes __structuredAttrs-agnostically
Make the interation across pythonRelaxDeps and pythonRemoveDeps work
regardless of __structuredAttrs.
2024-11-05 10:47:22 +08:00
Yueh-Shun Li
e4f2f9dd22 pythonOutputDistHook: lint with ShellCheck 2024-11-05 10:47:22 +08:00
Yueh-Shun Li
ccb418b699 pythonNamespacesHook: lint with ShellCheck 2024-11-05 10:47:02 +08:00
Yueh-Shun Li
bab7ef307c pythonImportsCheckHook: lint with ShellCheck 2024-11-05 10:41:17 +08:00
Yueh-Shun Li
967e5b43ed pythonImportsCheckHook: support __structuredAttrs = true 2024-10-28 22:22:42 +08:00
Yueh-Shun Li
69f4871514 pypaBuildHook: lint with ShellCheck 2024-10-28 22:22:42 +08:00
Yueh-Shun Li
1f39bb6586 pypaBuildHook: handle pypaBuildFlags __structuredAttrs-agnostically 2024-10-28 22:22:41 +08:00
Yueh-Shun Li
3a0f6fabff pipInstallHook: handle pipInstallFlags __structuredAttrs-agnostically 2024-10-28 21:21:15 +08:00
Yueh-Shun Li
c4bc1a8bb6 pipBuildHook: handle pipBuildFlags __structuredAttrs-agnostically 2024-10-28 21:20:07 +08:00
Yueh-Shun Li
1f8bb94bca pythonOutputDistHook: append *Phases with appendToVar 2024-10-28 21:19:51 +08:00
Yueh-Shun Li
3e8d53b9e8 python3Packages.pythonCatchConflictsHook: fix tests with lib.overrideDerivation
Use lib.overrideDerivation instead of <pkg>.overrideDerivation
to fix the evaluation of
python3Packages.pythonCatchConflictsHook.tests.catches-conflict-multiple-chains,
as buildPythonPackage and buildPythonApplication no longer provide
<pkg>.overrideDerivation

Clean up the leftover of commit 58bfe74123 ("buildPython*:
Deprecate and remove (buildPython* { ... }).override")
2024-10-22 12:51:11 +08:00
Yueh-Shun Li
57c2e5683d buildPython hooks: format with shfmt 2024-10-08 07:42:21 +08:00
Yueh-Shun Li
758056dac7 treewide: handle postPhases __structuredAttrs-agnostically
Always specify the postPhases attribute as a list instead of a string.

Append elements to the postPhases Bash variable using appendToVar
instead of string or Bash array concatenation.
2024-09-03 05:56:17 +08:00
Yueh-Shun Li
054c5f0e10 treewide: handle preDistPhases __structuredAttrs-agnostically
Always specify the preDistPhases attribute as a list instead of a string.

Append elements to the preDistPhases Bash variable using appendToVar
instead of string or Bash array concatenation.

Handle element insertion before a specific element using string
substitution as before, but handle both structured and unstructured
attributes.
2024-09-03 05:33:59 +08:00
Yueh-Shun Li
385d523a8e treewide: handle preInstallPhases __structuredAttrs-agnostically
Always specify the preInstallPhases attribute as a list instead of a
string.

Append elements to the preInstallPhases Bash variable using appendToVar
instead of string or Bash array concatenation.
2024-09-03 05:33:59 +08:00
Martin Weinelt
0b0dd33e0a python312Packages.setuptoolsCheckHook: remove
The hook relied on the `test` command passed to `setup.py`, which has
long been deprecated and finally removed in setuptools 72.0.
2024-08-06 18:18:40 +02:00
Martin Weinelt
ad9505ddce python3Packages.pythonRelaxDepsHook: update example 2024-07-07 22:36:56 +02:00
Martin Weinelt
b6ef66ed3d Merge pull request #304741 from edgelesssys/python/fix-imports-check-py-output
[staging] python/hooks/python-imports-check-hook: use $python output if existing
2024-06-19 03:35:44 +02:00
Moritz Sanft
d163f12f2c python/hooks/python-imports-check-hook: use $python output if existing 2024-06-04 16:48:57 +02:00
Ben Wolsieffer
21833407b4 pythonCatchConflictsHook: add test for multiple dependency chains
Add a test where a conflicting package can be found at the end of
multiple dependency chains. This is far too simple an example to
demonstrate the ill effects of exponential time complexity, but does
serve to demonstrate how the error output changes when each path is only
visited once.
2024-04-26 21:05:41 -04:00
Sergei Trofimovich
187ac583a0 python/hooks/setuptools-build-hook.sh: use --parallel flag only for fresh setuptools
Without the change attempt to enable parallelist for `python2` packages
fails with unsupported `--parallel` flag for `setuptools`-based
packages:

    $ nix build --no-link -f. --arg config '{enableParallelBuildingByDefault = true;}' xdg-utils
    error: builder for '/nix/store/...-python2.7-setuptools-44.0.0.drv' failed with exit code 1;
       last 10 log lines:
       > no configure script, doing nothing
       > Running phase: buildPhase
       > Executing setuptoolsBuildPhase
       > 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
       >
       > error: option --parallel not recognized
2024-03-25 13:18:45 +01:00
Thomas Watson
d521f03303 python3Packages.setuptoolsBuildHook: correct name
Make `name` attribute into the same format as every other hook (modulo
.sh).

Nothing else in nixpkgs appears to refer to the old name.
2024-03-24 19:21:58 -05:00
Thomas Watson
26ccdea3d7 python3Packages.setuptoolsBuildHook: delete broken setuptoolsShellHook
Broken since the switch to PyPA's build/installer in
6c85fff302.

The hook was always janky and maintainers appear to not want its current
implementation in-tree. No replacement is currently planned.

However, this leaves the path open for future replacements as a broken
hook will no longer be installed by default.
2024-03-24 19:21:55 -05:00
Martin Weinelt
7c63b00262 Merge pull request #298086 from mweinelt/python-runtime-deps-skip-empty-specifier
python3.pkgs.pythonRuntimeDepsCheckHook: skip empty specifiers
2024-03-22 18:56:07 +01:00
Martin Weinelt
2c68d6b029 python311Packages.packaging: 23.2 -> 24.0
https://github.com/pypa/packaging/blob/24.0/CHANGELOG.rst

The `requires_dist` field now defaults to `None`, if the package does
not specify any requirements.
2024-03-22 16:34:52 +01:00
Martin Weinelt
bcd6e799e0 python3.pkgs.pythonRuntimeDepsCheckHook: skip empty specifiers
Prevent the hook from erroring out on missing specifiers, as reported for
`highspy`, which currently ships with a pre-release version, triggering
the following error message:

  - highspy not satisfied by version 1.7.1.dev1
2024-03-22 16:30:55 +01:00
Sandro Jäckel
be51056b85 pythonRelaxDepsHook: don't rely on pname as that could be normalized already
according to the language docs
2024-03-15 11:27:27 +01:00
Yarny0
b1bccc25ec pythonCatchConflictsHook: test cyclic dependency
Add test case where a package enlists
itself as propagated build input.
2024-02-25 11:54:49 +01:00
github-actions[bot]
68a2e7449b Merge staging-next into staging 2024-02-18 06:01:34 +00:00
adisbladis
e23b901321 python3.hooks: Dont completely overwrite passthru when creating setup hook 2024-02-17 21:19:26 +13:00
adisbladis
48a49f76d7 python3.pkgs.pypaBuildHook: Fix passthru.tests 2024-02-17 21:19:24 +13:00
DavHau
ffa815958e pythonCatchConflictsHook: make compatible to all python 3 versions 2024-02-13 11:15:41 +07:00
DavHau
0cbd114d41 pythonCatchConflictsHook: improve and add tests 2024-02-13 11:15:41 +07:00
github-actions[bot]
f50aae4fb1 Merge master into staging-next 2023-12-29 18:00:57 +00:00
Sergei Trofimovich
089b731d87 python/hooks: fix test attribute eval
Without the change `tests` attribute fails the eval as:

    $ nix build --no-link -f. pypy27Packages.pypaBuildHook.tests
    error:
           69|       #   versions of this hook's dependencies.
           70|       passthru.tests = import ./pypa-build-hook-tests.nix {
             |                        ^

Fixed file name and added missing runCommand import.
2023-12-29 11:27:59 +00:00
Martin Weinelt
48b43e51e5 pythonRelaxDepsHook: make distribution name matching case insensitive
Is it PyOpenSSL or pyOpenSSL or pyopenssl? With this change you don't
have to care. Write it as pYoPeNSsL for all I care¹.

Can we do it like that? Yes, we can. Distribution names should be matched
with `re.IGNORECASE` according to the wheel specification².

[1] https://packaging.python.org/en/latest/specifications/core-metadata/#name
[2] Just kidding, please make it look sane.
2023-12-20 20:46:12 +01:00
Martin Weinelt
8f3162f83f python3.pkgs.pythonRuntimeDepsCheckHook: init
Implements a hook, that checks whether all dependencies, as specified by
the wheel manifest, are present in the current environment.

Complains about missing packages, as well as version specifier
mismatches.
2023-12-20 20:10:22 +01:00
Alexandre Macabies
fc235bb0fc python/hooks: use python.pythonVersion to support PyPy
f292ef4 introduced a check for the Python version but uses `.version`,
which isn't friendly to other Pythons like PyPy which use versions
strings like 7.3, failing the >=3.10 check.

Using `.pythonVersion` fixes this check.

Co-authored-by: Pierre Bourdon <delroth@gmail.com>
2023-11-25 13:38:39 +01:00
Martin Weinelt
f292ef4958 python/hooks: restore catchConflictHook for python<3.10
By restoring and diverting to the old version.

Previously the newer language features and use of more modern stdlib
imports broke the hook on Python<3.10.
2023-11-18 12:57:18 +01:00
Alyssa Ross
e3e57b8f18 lib.systems: elaborate Rust metadata
We need this stuff to be available in lib so make-derivation.nix can
access it to construct the Meson cross file.

This has a couple of other advantages:

 - It makes Rust less special.  Now figuring out what Rust calls a
   platform is the same as figuring out what Linux or QEMU call it.

 - We can unify the schema used to define Rust targets, and the schema
   used to access those values later.  Just like you can set "config"
   or "system" in a platform definition, and then access those same
   keys on the elaborated platform, you can now set "rustcTarget" in
   your crossSystem, and then access "stdenv.hostPlatform.rustcTarget"
   in your code.

"rustcTarget", "rustcTargetSpec", "cargoShortTarget", and
"cargoEnvVarTarget" have the "rustc" and "cargo" prefixes because
these are not exposed to code by the compiler, and are not
standardized.  The arch/os/etc. variables are all named to match the
forms in the Rust target spec JSON.

The new rust.target-family only takes a list, since we don't need to
worry about backwards compatibility when that name is used.

The old APIs are all still functional with no warning for now, so that
it's possible for external code to use a single API on both 23.05 and
23.11.  We can introduce the warnings once 23.05 is EOL, and make them
hard errors when 23.11 is EOL.
2023-11-09 10:02:24 +01:00
github-actions[bot]
d49b3ff9e3 Merge staging-next into staging 2023-11-08 12:02:19 +00:00
Fabián Heredia Montiel
2188896a57 python3Packages.sphinxHook: fix eval after merge of bc2d598878 2023-11-08 01:51:41 -06:00
Adam Joseph
ba2ed469c2 Merge branch 'master' into staging-next 2023-11-08 06:15:46 +00:00
Adam Joseph
bc2d598878 treewide: change pythonForBuild to pythonOnBuildForHost 2023-11-05 17:42:12 -08:00
Martin Weinelt
646c23a2f7 buildPythonPackage: port catch-conflicts to importlib.metadata
To escape the pkg_resources API deprecation:

> catch-conflicts.py:1: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

Also remove exceptions for the previus bootstrap packages.
2023-10-30 12:42:36 +01:00