Commit Graph

119 Commits

Author SHA1 Message Date
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
Leandro Reina
48f25989c3 python3Packages.sphinxHook: Avoid propagating sphinx
Fixes some side effects of #249157 (see #255810)
2023-09-30 18:21:18 +02:00
github-actions[bot]
3e52e5929d
Merge master into staging-next 2023-09-25 12:01:02 +00:00
Peder Bergebakken Sundt
bdda7b0a53 python3Packages.flitBuildHook: remove 2023-09-22 21:11:24 +02:00
DavHau
c57e6b692a python3.pkgs.pypaBuildHook: fix conflicts
This modifies the pypaBuildHook to not propagate its own python dependencies into the build environment. This prevents package conflicts.

- modify pypa-build-hook.sh to call pyproject-build via an absolute path. This removes the need of putting the dependencies inside the hook's propagatedBuildInputs
- remove the hook's dependencies from propagatedBuildInputs
- add a passthru test to the hook testing for the fix
2023-09-12 21:04:26 +02:00
Leandro Reina
a391639845 python3Packages.sphinxHook: Fix cross compilation
Failed due to using host sphinx instead of build one.
2023-09-09 21:34:33 +02:00
Theodore Ni
130e063a3d
pypaInstallHook: enter "dist" directory before installing (#250464) 2023-08-21 08:45:47 +02:00
Theodore Ni
dd1256d2ca python3.pkgs.pythonRelaxDepsHook: don't propagate wheel
The usage of wheel should be restricted to the hook. I discovered this
when trying to remove wheel from the Python bootstrap. Some packages
that needed wheel did not need it added explicitly because they use this
hook. This implicit change to the dependency tree shouldn't happen (even
though it is mostly harmless).
2023-08-20 11:00:51 +02:00
Theodore Ni
93d25dda84 python3.pkgs.pypaBuildHook: switch to pyproject-build
Upstream's recommended "python -m build" way of invoking build fails
when the working directory contains a file named "build.py". This is
common for poetry projects that build C extensions.
2023-08-20 10:59:46 +02:00
Theodore Ni
a4d66bcc5f python3.pkgs.pypaInstallHook: init 2023-08-20 10:59:46 +02:00
Theodore Ni
ece0953571
Merge branch 'staging-next' into staging 2023-08-18 16:02:27 -07:00
github-actions[bot]
03146a5454
Merge master into staging-next 2023-08-18 06:01:01 +00:00
Nick Cao
e19e2222d7
python3Packages.pythonNamespacesHook: use findutils from buildPackages (#249864) 2023-08-18 07:39:36 +02:00
Thiago Kenji Okada
5dda73a162
Merge pull request #248516 from thiagokokada/remove-version-from-python-relax-deps-hook
pythonRelaxDepsHook: remove version from pkg_name
2023-08-12 00:57:55 +00:00
Thiago Kenji Okada
98de48fc8f pythonRelaxDepsHook: remove version from pkg_name
Since the wheel file name is based on the package metadata instead of
what we set in the derivation, if you set the version as `unstable-YYYYMMDD`,
for example, the hook would silently fail. We will ignore the version
now and just use a glob instead to match anything that has the package
name in its path.

Fixes #248185.
2023-08-11 14:56:14 +01:00
Artturin
8eff2eea8c Revert "Revert "python3: splice python within python3Packages.callPackage""
This reverts commit 2ffca30cde.

`793cc9d982415b71cdba729cf779bfc49e9d2ae7` `python3: splice python within python3Packages.callPackage`
Was reverted because it broke
`pkgsCross.aarch64-multiplatform.python3Packages.cryptography`

But by reverting the revert `pkgsCross.aarch64-multiplatform.python3Packages.cryptography` still builds.

I tried reverting the 2 cryptography update commits, and it still
worked, so I do not know why this would work now.
2023-08-05 02:37:16 +03:00
Doron Behar
6560d0086c python3.pkgs.pypaBuildHook: init 2023-07-28 12:13:25 +02:00
Doron Behar
1298c367b1 pip-build-hook.sh: Support $pipBuildFlags 2023-07-28 12:13:25 +02:00
Karel Kočí
9d663f7fcd
setuptools-rust: fix cross compilation
The setuptools-rust requires some environment variables to really
perform cross build, otherwise it just builds for build platform.

This adds setup hook that introduces these environment variables.

There are three variables.
The PYO3_CROSS_LIB_DIR has to point to the target's Python library
directory. This has to be directory for the target not for the build or
host. We have to choose the correct target Python. I am unsure how to do
that simply in nixpkgs and this this implementations just delays this
and waits for the correct Python when package using this hook is build.
The CARGO_BUILD_TARGET triggers cross compilation in setuptools-rust.
This is simply the Rust target specification.
The CARGO_TARGET_*_LINKER variable should not be essentially required
but setuptools-rust probably mangles the Rust build environment somewhat
and that results to the missing linker. By explicitly specifying it
using the environment variable we force the correct linker.
2023-06-30 14:52:25 +02:00
Frederik Rietdijk
f04278458b Revert "python.pipInstallHook: avoid producing wrong direct_url.json file"
Certain packages were failing since this was merged.
https://github.com/NixOS/nixpkgs/pull/229472#issuecomment-1544410416

This reverts commit bff6c67911.
2023-05-17 12:19:52 +02:00
Jairo Llopis
bff6c67911 python.pipInstallHook: avoid producing wrong direct_url.json file
When installing many python packages, a `direct_url.json` file appeared in the lib directory. Example:

```sh
➤ nix build nixpkgs/29755fec55e58a315b517d431b2be261772f2b80#python3Packages.flask

➤ cat result/lib/python3.10/site-packages/Flask-2.2.3.dist-info/direct_url.json
{"archive_info": {}, "url": "file:///build/Flask-2.2.3/dist/Flask-2.2.3-py3-none-any.whl"}⏎
```

As you can see, that file contains a wrong reference to `/build`.

In https://discuss.python.org/t/pep-610-usage-guidelines-for-linux-distributions/4012/4 there's an explanation on how to avoid this. Here, I'm implementing that change for nixpkgs.

@moduon MT-1075
2023-05-11 09:15:48 +02:00
Artturin
4e3dcf364e treewide: makeSetupHook deps -> propagatedBuildInputs 2023-02-07 21:02:00 +02:00
Martin Weinelt
e464bde9ba
Merge pull request #208962 from KAction/patch/v1/python3.pkgs.sphinxHook 2023-01-04 02:38:53 +01:00
Dmitry Bogatov
82ae2e8f06 python3.pkgs.sphinxHook: fix co-installability of generated documentation
Include full $name of the derivation into docdir, so documentation for
python package "foo" is installed into $out/share/doc/python3.10-foo-1.2.3
instead of just $out/share/doc/foo, where it may conflict with some
other package named "foo" and not-coinstallable with different
versions of the same python package.

Change from $name to $pname was introduced in [1ee5fca], probably as
unindented side-effect of adding support for formats other than html.
2023-01-03 20:28:48 -05:00
Robert Schütz
fa3feb9f65 python3Packages.pythonImportsCheck: set $PYTHONPATH
Don't rely on the installPhase doing so.
2022-12-29 04:11:02 -08:00
Jörg Thalheim
7eccc4973c
Merge pull request #195055 from Mic92/buildPythonPackage
buildPythonPackage: fix regression if no setuptools is used
2022-11-06 20:37:18 +01:00