Commit graph

81 commits

Author SHA1 Message Date
Phillip Cloud
87c7794853
chore: use pip build hook 2023-10-24 08:29:43 -04:00
Phillip Cloud
9316bf3916
style: remove unnecessary parens 2023-10-24 08:29:36 -04:00
Phillip Cloud
fce7cb48c3
chore: bring back the pypa build hook 2023-10-24 08:29:31 -04:00
Phillip Cloud
e0351878f1
chore: checkpoint 2023-10-24 08:29:24 -04:00
Phillip Cloud
d0a117a06b
style: run nixpkgs-fmt 2023-07-25 07:44:43 -04:00
Phillip Cloud
5d9e60be13
chore: look at anything that could indicate a ref/rev 2023-07-25 07:20:14 -04:00
Phillip Cloud
c1e1486d6a
fix: also use allRefs = true when branch is given 2023-07-25 06:56:56 -04:00
Åsmund Østvold
b7b50835d5 Fix backwards incompatibility in fetchGit
The submodule argument was introduced in version >= 2.4
2023-06-12 16:01:16 +02:00
adisbladis
1a79e628b9 Add a hook to rewrite python_requires in setup.py to be PEP440 compliant
Upstream packaging has changed and using wildcards in python_requires is now considered a bug as it's not PEP400 compliant.
Realistically we have to work around this issue as we can't expect every older version to change.

We do this by rewriting the problematic definitions and dropping the
version precision. This works out because 3.9.* is functionally
equivalent to 3.9.
2023-03-23 15:23:57 +13:00
Ryan Swart
0e9c1d8599 fix: wheel is not tarball... 2023-01-17 21:41:17 +08:00
Ryan Swart
1a2045ef51 fix: use hash on url dep 2023-01-17 20:08:24 +08:00
Phillip Cloud
ffa5261510
fix: disallow the wheel package to preferWheels
Otherwise an infinite recursion error occurs.
2023-01-12 05:33:38 -05:00
Robert Hensing
31e6d68d59 feat: Show lock location in package errors
Tested by temporarily setting `meta.broken = true;` in
`mk-poetry-dep.nix`, and then

    $ nix-build tools -A env
    error: Package ‘python3.9-click-8.1.3’ in /home/user/h/poetry2nix/tools/poetry.lock:0 is marked as broken, refusing to evaluate.

       a) To temporarily allo[...]

As you can see, the location of the lock file is reported, which
is especially useful in Nixpkgs, which contains multiple lockfiles.

This used to be just the location of a generic python builder, which
is generally not what the user wants.

I've exposed the `poetrylockPos` variable as a parameter that callers
may set. This is intended as a contingency more so than a feature that
is useful to users. That's why I've decided not to document it,
because it would just add noise.
2023-01-03 16:38:09 +01:00
Bouke van der Bijl
75195c5074 Fetch git submodules
Poetry also fetches submodules when downloading a git dependency
2022-12-07 19:12:54 +01:00
László Vaskó
25254807bc mkPoetryDep: always calculate dependencies in when installing from files
`isSource` can be true e.g. when the package comes from a private
registry but we can still figure out e.g. manylinux dependencies based
on the fiename
2022-11-30 08:46:29 +01:00
K900
2c5c418746 fix: pull in hooks directly instead of sneaking them in through pythonPackages
This does technically break people that override hooks, but they deserve it.
2022-10-28 00:40:18 +03:00
adisbladis
b95cbe19ab fix build for many wheel packages 2022-10-08 03:23:23 +13:00
adisbladis
e31b5e4d29 mk-poetry-dep: prevent use of output separation
this doesn't work in a lot of cases and I don't see the point for us
to have the split output behaviour.
2022-10-07 23:30:49 +13:00
K900
33db1f30d0 feat: big messy refactoring
- normalize package names to match PEP-503
- don't assume build dependencies on setuptools{,-scm}
- automatically generate overrides for setuptools{,-scm}
- pull known build systems directly from nixpkgs
- fix a bunch of mostly unrelated warnings

Co-authored-by: Phillip Cloud <417981+cpcloud@users.noreply.github.com>
2022-10-06 19:54:08 +03:00
Samuel Cormier-Iijima
5ae5d85e56 Fix determining sourceSpec for git dependencies in pyproject.toml
Fixes #702
2022-09-08 16:02:32 -04:00
K900
a6480f2ce6 fix: also ignore typing-extensions when resolving dependencies
Fixes infinite recursion with recent setuptools-scm.
2022-06-28 09:40:15 +03:00
adisbladis
62bab8891f Fix infinite recursion in project with flit-core
Closes #538
2022-02-05 13:54:22 +12:00
adisbladis
9b5fba1b71 Fix cross compilation and add cross test 2022-01-19 04:35:12 +12:00
adisbladis
230e4fbb48 Remove __isBootstrap hack
Since #466 was merged we don't need it anymore.
2022-01-19 02:20:37 +12:00
adisbladis
23be9b3cb0
Merge pull request #466 from cpcloud/remove-bootstrap-poetry
build: remove bootstrap dependency on poetry
2022-01-18 15:18:22 +12:00
László Vaskó
8e1eef3751 fetchGit: use allRefs only when it is needed
If `branch` or `tag` is given in sourceSpec, then `fetchGit` would
work as before, the only problematic setup is `rev` when used with Nix 2.4+
2022-01-18 09:53:24 +12:00
László Vaskó
5c06704d45 fetchGit: work-around bug in Nix 2.4
Another approach to make `poetry2nix` work with dependencies specified
by arbitrary `rev=<hash>` values on newer Nix revisions.

Relates-to: https://github.com/nix-community/poetry2nix/pull/358
Relates-to: https://github.com/NixOS/nix/issues/5128
2022-01-18 09:53:24 +12:00
Phillip Cloud
261d1d5b22
fix: remove buildInput dependency on poetry 2021-12-29 09:32:41 -05:00
Phillip Cloud
2fed7bc910
pip: remove restriction 2021-11-08 08:07:04 -05:00
adisbladis
6457976cf6
Extend setuptools-scm infinite recursion workaround 2021-09-22 22:39:14 -05:00
Phillip Cloud
3fb12decf1
fix: add tomli to recursion list 2021-09-19 09:45:41 -04:00
Rowan Skewes
5cd5f01c90 enable '+' in versions 2021-09-17 17:06:44 +10:00
Niels Kristian Lyshøj Jensen
2eb8329319
Add support for local files 2021-07-10 13:38:34 +02:00
adisbladis
8ca15bdb12
Improve error message in case of a missing suitable source/wheel for a dependency 2021-07-02 04:25:00 -05:00
Antoine Eiche
28fba9f743
Add support to the legacy Pypi API
Some private repositories (such as Devpi) expose the legacy Pypi
API (https://warehouse.pypa.io/api-reference/legacy.html).

This commit adds a dedicated fetcher which basically queries this API
to get the URL pointing to the actual file.

Since Pypi still exposes this API, it has been possible to write a
test that uses this legacy API.

Fixes https://github.com/nix-community/poetry2nix/issues/277.
2021-06-01 16:25:29 -05:00
adisbladis
4b651e043e
Merge pull request #304 from andir/fetch-api
Always fallback to querying the Pypi API when the predicted URL 404s
2021-06-01 16:14:37 -05:00
hlolli
f786624415 fix regex for darwin-aarch64 compatability 2021-05-31 04:15:54 +02:00
Andreas Rammhold
cd693810c3
Always fallback to the Pypi API when fetching sources & wheels
Previously we randomly encountered issues where the Pypi mirror URLs
wouldn't be correct with packages whos first character is frequently
written in upper case (e.g. SqlAlchemy, MarkupSafe, ...). The Pypi
mirrors are aparently not consistent in the naming of the file locations
which lead to random errors after package version bumps.

By falling back to the API lookup (that we already did for wheels) we
can workaround that situation.
2021-05-13 21:48:03 +02:00
Michael Lingelbach
9191fbae30
Ensure ref passed to builtins.fetchGit points to refs/tags/sourceSpec.tag 2021-02-02 12:43:50 +01:00
K900
324cc0cb2a Fix stdenv.platform accesses for latest nixpkgs
This fixes builds being completely broken after:
* https://github.com/NixOS/nixpkgs/pull/110726
* https://github.com/NixOS/nixpkgs/pull/110544

This also fixes poetry2nix on ARM and PowerPC platforms by introducing a
mapping from Nixpkgs targets to manylinux_* machine names and using it
when matching wheels for dependencies.
2021-01-30 20:17:54 +03:00
adisbladis
98e0220502
Use build packages in setup hook
https://github.com/NixOS/nixpkgs/pull/104201 broke this.
2020-11-26 20:28:09 +01:00
Jörg Thalheim
38704165d4
support url source types 2020-11-26 14:51:44 +01:00
adisbladis
ba41e216a6
Fix wheel builds 2020-11-26 14:46:51 +01:00
Daiderd Jordan
4beb2b2941
always include setuptools in buildInputs
When cross compiling setuptools isn't available in the build environment
but needed for eg. python setup.py egg_info.
2020-11-24 23:04:10 +01:00
adisbladis
74d3b4ff1c
Fall back to old behaviour for git references, prefer resolved_reference 2020-10-06 14:44:26 +02:00
yihuang
ef9935c98c
fix "invalid Git revision 'master'" 2020-10-04 14:20:17 +08:00
adisbladis
52a484be33
Reformat with nixpkgs-fmt 1.0.0 2020-10-01 19:08:57 +02:00
adisbladis
99cdaa7cca
mk-poetry-dep: Add pep508 evaluation to dependency selection
Poetry 1.1.0 changed the marker format in https://github.com/python-poetry/poetry/pull/2361
2020-10-01 18:20:59 +02:00
adisbladis
cd604e2384
mk-poetry-dep: Remove redundant pythonPackages argument 2020-10-01 14:35:49 +02:00
adisbladis
10e417df85
Add support for non-pyproject local dependencies
We were previously assuming that pyproject.toml always exists in a
local dependency.

This is not the case for setup.py.
2020-08-21 14:00:35 +02:00