Commit graph

44 commits

Author SHA1 Message Date
hlolli
f786624415 fix regex for darwin-aarch64 compatability 2021-05-31 04:15:54 +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
adisbladis
1d41a55f88
Always add Poetry as a build input unless bootstrapping
Currently Poetry does not have a notion of build-time
dependencies (setup-requires) in it's lock file.

When installing a dependency built with Poetry this has to be added
via an override which is really bad UX.

This change always adds Poetry as an interim solution until we have
resolved this in upstream Poetry.
2020-07-14 15:30:07 +02:00
adisbladis
db06bdd6e7
Format with nixpkgs-fmt 0.9 2020-05-19 21:06:02 +01:00
adisbladis
4ebbfdacd1
nixpkgs-fmt broke it's format yet again 2020-04-29 14:12:59 +01:00
Raito Bezarius
54f4afca6d
Enable global preference for wheels for top-level functions 2020-04-29 14:08:21 +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
b9221f61b5
Automatically build most packages without passing format param
We should never have to use `format = "setuptools"` since pip can
_also_ handle setuptools packages.

This uses a custom pipBuildHook that removes pyproject.toml in case
there is also a setup.py in the same sources.
2020-04-01 00:14:30 +01:00
adisbladis
df8c9819f4
Fix git dependencies on non-default branches
Closes #73
2020-03-27 19:13:12 +00:00
adisbladis
f7e435407e
nixpkgs-fmt all the things (again...) 2020-03-14 23:13:51 +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
090e2dd957
Add fixup hook
This hook should fix common mistakes like installing `tests` in
site-packages which leads to collisions.
2020-02-28 19:45:23 +00:00
adisbladis
1f413d27c9
Implement a proper fix for #52
We need to check pyproject.toml & poetry.lock constraints
_separately_.

Consider the following scenario:

- `poetry` depends on `tox` which in turn depends on `virtualenv`.

- `poetry` _also_ depends directly on virtualenv, but only for older
python versions.

In this case we don't want `virtualenv` as a direct input to `poetry`
but we _do_ want it as an input for `tox`.
2020-02-28 14:01:46 +00:00
adisbladis
7f7499462f
Set meta.platforms to something reasonable by default 2020-02-28 08:38:36 +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
8504e52c27
fmt fixup 2020-01-28 20:04:44 +00:00
adisbladis
1ffabaa066
Prevent infinite recursion for setuptools-scm extras 2020-01-28 19:42:35 +00:00
adisbladis
2caffda3ef
Use the canonical name setuptools-scm
Nixpkgs calls this setuptools_scm which is a mismatch for pypi.

Create an alias so any setuptools-scm installed by a user impacts all packages.
2020-01-21 12:12:36 +00:00
adisbladis
b125af3789
Make dependency function variadic and passthru args
This will enable feature flags such as enableFoo to be added in an override.
2020-01-21 11:43:03 +00:00
adisbladis
7170aad633
Add Pypy support (#40) 2020-01-18 20:29:07 +00:00
adisbladis
224973c59c
Dont strip binary wheels 2020-01-17 18:06:09 +00:00
Oleh Stolyar
fd450ae21d Reduce closure size of packages built with poetry2nix
- Strip libraries and executables.
  If they are not stripped, they will retain debug symbols that often reference
  compilers (standard library includes), or dev outputs
  (headers that are not needed at runtime).

- Put buildSystemPkgs in buildInputs instead of propagatedBuildInputs.
  This removes intreehooks and Poetry from runtime closure.
  During fixupPhase, scripts in $out/bin are wrapped, and the wrapping
  script walks all propagatedBuildInputs when collecting PATH and
  PYTHONPATH.
2020-01-17 15:45:16 +00:00
adisbladis
2f59f1db2a
Fix Egg support 2020-01-12 20:00:17 +00:00
adisbladis
136f008a03
Add preferWheel option to <derivation>.override
Previously override wasn't really useful as it inherited the args from
buildPythonPackage.
Now we can create custom args for overrides.
2020-01-12 19:38:22 +00:00
adisbladis
31a2bf6216
Always add setuptools_scm as a build input
Adding overrides is an uphill battle we are never going to win and
poetry2nix should try to attempt to make things "just work" to the
largest extent possible.

This only increases the build closures slightly while making
poetry2nix much easier to use.

setuptools_scm itself does not have any dependencies so will not cause
compatibility issues.
2020-01-10 13:01:33 +00:00
adisbladis
cebf3ced84
Add support for eggs 2020-01-08 14:03:01 +00:00
adisbladis
4acf604723
Add support for local path dependencies 2019-12-29 13:20:35 +00:00
adisbladis
737ed5a372
Add Git support 2019-12-27 19:17:35 +00:00
Tobias Pflug
7a73ffdb36 Remove NIX_PYTHON_MANYLINUX
As per https://github.com/NixOS/nixpkgs/pull/75763 this environment
variable is not needed anymore. Instead python interpreters are now
assuming compatibility by default.
2019-12-16 16:47:51 +01: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