a20691048e
# 2.2.0 (09 Aug 2020) Improved success rate, MacOS support, bugfixes, optimizations ### Features - Improved selection of wheel releases. MacOS is now supported and architectures besides x86_64 should be handled correctly. - Whenever mach-nix resolves dependencies, a visualization of the resulting dependency tree is printed on the terminal. - The dependency DB is now accessed through a caching layer which reduces the resolver's CPU time significantly for larger environments. - The python platform context is now generated from the nix build environment variable `system`. This should decrease the chance of impurities during dependency resolution. ### Fixes - The requires_python attribute of wheels was not respected. This lead to failing builds especially for older python versions. Now `requires_python` is part of the dependency graph and affects resolution. - Detecting the correct package name for python packages in nixpkgs often failed since the attribute names don't follow a fixed schema. This lead to a handful of different errors in different situations. Now the package names are extracted from the pypi `url` inside the `src` attribute which is much more reliable. For packages which are not fetched from pypi, the `pname` attribute is used as fallback. - Fixed bug which lead to the error `attribute 'sdist' missing` if a package from the nixpkgs provider was used which doesn't publish it's source on pypi. (For example `tensorflow`) ### Other Changes - Mach-nix now uses a revision of the nixpkgs-unstable branch instead of nixos-20.03 as base fo the tool and the nixpkgs provider. - Updated revision of the dependency DB
58 lines
1.9 KiB
Python
58 lines
1.9 KiB
Python
import os
|
|
import sys
|
|
|
|
from mach_nix.data.nixpkgs import NixpkgsIndex
|
|
from mach_nix.data.providers import CombinedDependencyProvider, ProviderSettings
|
|
from mach_nix.generators.overides_generator import OverridesGenerator
|
|
from mach_nix.requirements import parse_reqs, filter_reqs_by_eval_marker, context
|
|
from mach_nix.resolver.resolvelib_resolver import ResolvelibResolver
|
|
from mach_nix.versions import PyVer
|
|
|
|
|
|
def load_env(name, *args, **kwargs):
|
|
var = os.environ.get(name, *args, **kwargs)
|
|
if var is None:
|
|
print(f'Error: env variable "{name}" must not be empty', file=sys.stderr)
|
|
exit(1)
|
|
return var.strip()
|
|
|
|
|
|
def main():
|
|
disable_checks = load_env('disable_checks')
|
|
nixpkgs_json = load_env('nixpkgs_json')
|
|
out_file = load_env('out_file')
|
|
provider_settings = ProviderSettings(load_env('providers'))
|
|
py_ver_str = load_env('py_ver_str')
|
|
pypi_deps_db_src = load_env('pypi_deps_db_src')
|
|
pypi_fetcher_commit = load_env('pypi_fetcher_commit')
|
|
pypi_fetcher_sha256 = load_env('pypi_fetcher_sha256')
|
|
requirements = load_env('requirements')
|
|
|
|
platform, system = load_env('system').split('-')
|
|
|
|
py_ver = PyVer(py_ver_str)
|
|
nixpkgs = NixpkgsIndex(nixpkgs_json)
|
|
deps_provider = CombinedDependencyProvider(
|
|
nixpkgs=nixpkgs,
|
|
provider_settings=provider_settings,
|
|
pypi_deps_db_src=pypi_deps_db_src,
|
|
py_ver=py_ver,
|
|
platform=platform,
|
|
system=system
|
|
)
|
|
generator = OverridesGenerator(
|
|
py_ver,
|
|
nixpkgs,
|
|
pypi_fetcher_commit,
|
|
pypi_fetcher_sha256,
|
|
disable_checks,
|
|
ResolvelibResolver(nixpkgs, deps_provider),
|
|
)
|
|
reqs = filter_reqs_by_eval_marker(parse_reqs(requirements), context(py_ver, platform, system))
|
|
expr = generator.generate(reqs)
|
|
with open(out_file, 'w') as f:
|
|
f.write(expr)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|