Commit graph

41 commits

Author SHA1 Message Date
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
64d8615983 fix poetry replacing underscores with hyphens 2022-08-30 10:59:05 +02:00
adisbladis
5e667bc527 Fix infinite recusion in the case where no gitignores are found 2022-04-14 16:19:59 +12:00
Jairo Llopis
1daf54da67 fix: avoid infinite recursion while searching for path
In `findGitIgnores`, to find the parent path, we do `path + "/.."`. This means that, for each iteration, the path name grows:

1. `/nix/store/1234-example/a/b/`
2. `/nix/store/1234-example/a/b/..`
3. `/nix/store/1234-example/a/b/../..`
4. etc.

Thus, checking if path is not equal to `/` will always return `true`.

With this fix, it will instead check that the path exists. If the path goes higher than `/`, it will not exist, thus fixing the false positive.

@moduon MT-83
2022-04-14 15:54:04 +12:00
Sem Mulder
87350abfc8 Add support for PEP 600 2022-03-28 23:39:16 +02:00
adisbladis
8ca929109d fetchFromPypi: Fix cross 2022-01-19 18:59:50 +12:00
adisbladis
9b5fba1b71 Fix cross compilation and add cross test 2022-01-19 04:35:12 +12:00
Rowan Skewes
f7ab15e390 Enable private PYPI repositories via netrc 2021-12-26 02:44:11 -08:00
adisbladis
2c63047ee1 Run nixpkgs-fmt after the nixpkgs bump 2021-12-25 21:55:18 -08:00
adisbladis
106c4248ed
fetch_from_legacy: Ignore TLS certificates validity
We want this fetcher to still work even when the CA certs and server
certs are expired or otherwise considered insecure for backwards
compatibility reasons.
2021-06-01 16:25:29 -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
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
adisbladis
36f46f7696
Incorporate string escaping changes from nixpkgs #108086 2021-03-04 14:11:52 +02: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
52a484be33
Reformat with nixpkgs-fmt 1.0.0 2020-10-01 19:08:57 +02:00
adisbladis
3de03cdddc
Use build-system selection from requires field 2020-10-01 18:21:00 +02:00
Silvan Mosberger
b3014009e9
throw an error when no build-backend is specified
If a project doesn't have this specified, poetry doesn't do its thing,
leading to package metadata not being detected (UNKNOWN packages)
2020-07-14 23:09:10 +02:00
adisbladis
db06bdd6e7
Format with nixpkgs-fmt 0.9 2020-05-19 21:06:02 +01:00
adisbladis
c5acd18a59
fetchWheelFromPypi: Map closer to nixpkgs fetchurl 2020-05-03 10:10:19 +01:00
Raito Bezarius
330b56105c
fetchwheel: initial version 2020-05-03 10:10:09 +01:00
adisbladis
4ebbfdacd1
nixpkgs-fmt broke it's format yet again 2020-04-29 14:12:59 +01:00
adisbladis
e164fdd78a
Fix semver pythonVersion checks
We're only looking at the major.minor currently. We need to look
major.minor.patch instead.

This is made slighty problematic non-cpython where the patch version
doesn't match. If major.minor is the same for both the Python version
& the derivation version we default to derivation.version otherwise we
set the pythonVersion to pythonVersion major.minor.0.
2020-04-29 13:22:20 +01:00
adisbladis
9dfb080d3f
Add canonicalisation of module names
This shouldn't be required and I think that these are actually
packaging bugs and not something that poetry2nix should really be
concerned with.

Closes #84
2020-04-15 10:24:46 +01:00
adisbladis
b16cfe598b
lib: Minor nixpkgs-fmt 2020-04-14 13:07:15 +01:00
adisbladis
a7a882f88f
Set default build system to empty string
In case a build-system is not set.

Closes #83
2020-04-14 11:42:16 +01:00
adisbladis
f7e435407e
nixpkgs-fmt all the things (again...) 2020-03-14 23:13:51 +00:00
adisbladis
a7fec487f8
Prevent infinite recursion in gitignore filter construction 2020-03-01 08:45:52 +00:00
adisbladis
b81a94878f
nixpkgs-fmt lib.nix 2020-02-29 21:27:38 +00:00
adisbladis
924746ff9a
Make gitignore recursive 2020-02-29 21:22:34 +00:00
adisbladis
bb3c2d57d5
Add a default source filter when projectDir is used
Also use the same source filter for path deps.

The default source filter currently filters:
- Filters gitignore (if it exists, non-recursive)
- Filters pycache/pyc files
- Uses cleanSourceFilter to filter out .git/.hg, .o/.so, editor backup files & nix result symlinks
2020-02-29 12:05:23 +00:00
adisbladis
dc88082f58
Add support for python version constraints from pyproject.toml
Pep508 markers alone are not always enough, see #50

This sadly introduces a minor breakage in `mkPoetryEnv`.
2020-02-24 12:25:51 +00:00
adisbladis
0367b93492
Turn pyproject.toml patching into a hook
We should not be setting pre/post phases as it's counter intuitive
when working with overrides.
2020-02-23 14:37:01 +00:00
Steve Purcell
71cdd20018 Remove "path" dependencies in indirectly referenced packages 2020-02-18 15:58:31 +13:00
adisbladis
8591164784
Add overrides to build pyqt5
Extra functionality exposed in nixpkgs needs further overrides.
2020-01-13 00:27:14 +00:00
adisbladis
301760e845
Remove getAttrDefault
Nix has built-in syntax for this operation, so lets use it.
2020-01-13 00:27:10 +00:00
adisbladis
0d5719df26
Add IFD based fallback for fromTOML 2020-01-11 23:33:40 +00:00
adisbladis
f394798d72
Add full operator support 2020-01-09 12:48:07 +00:00
adisbladis
03d439fed3
Remove hard-coded known build systems
We can attempt to dynamically fetch this from the python package set instead.
2020-01-02 18:27:01 +00:00
adisbladis
4acf604723
Add support for local path dependencies 2019-12-29 13:20:35 +00:00
Andreas Rammhold
5741d9e59e
nixpkgs-fmt all the things 2019-12-16 15:03:49 +01:00
Tobias Pflug
84f27ee31d
Refactoring
- Extract utility functions to ./lib.nix
- Extract buildPythonPackage to ./mk-poetry-dep.nix
- Replace some functions with existing builtin functions
- Use lib.partition for python package splitting
- Drop package filtering on the top-level and leave it to pep425.nix
2019-12-16 15:03:49 +01:00