mach-nix
mach-nix copied to clipboard
mach-nix couldn't parse a requirements.txt file that has backslash in it
I tried
mach-nix env ./env -r mypy.txt
where mypy.txt is https://github.com/zulip/zulip/blob/299995bd3a348d77de770dc27a8ec4f4b1d42a8e/requirements/mypy.txt.
I got the following error from running nix-shell ./env
building '/nix/store/ljcbnw7kw3anmvzp72yp0p82ygfz145h-mach_nix_file.drv'...
Traceback (most recent call last):
File "/nix/store/jiai55v4k3fiip8cx6r4vxfx7g0mb311-h40j0cyj24lhf3faiyb942lzklrjg9rw-source/mach_nix/generate.py", line 110, in <module>
main()
File "/nix/store/jiai55v4k3fiip8cx6r4vxfx7g0mb311-h40j0cyj24lhf3faiyb942lzklrjg9rw-source/mach_nix/generate.py", line 103, in main
do()
File "/nix/store/jiai55v4k3fiip8cx6r4vxfx7g0mb311-h40j0cyj24lhf3faiyb942lzklrjg9rw-source/mach_nix/generate.py", line 64, in do
reqs = filter_reqs_by_eval_marker(parse_reqs(requirements), context(py_ver, platform, system))
File "/nix/store/jiai55v4k3fiip8cx6r4vxfx7g0mb311-h40j0cyj24lhf3faiyb942lzklrjg9rw-source/mach_nix/cache.py", line 14, in cache_wrapper
result = tuple(result)
File "/nix/store/jiai55v4k3fiip8cx6r4vxfx7g0mb311-h40j0cyj24lhf3faiyb942lzklrjg9rw-source/mach_nix/requirements.py", line 77, in parse_reqs
yield Requirement(*parse_reqs_line(line))
File "/nix/store/jiai55v4k3fiip8cx6r4vxfx7g0mb311-h40j0cyj24lhf3faiyb942lzklrjg9rw-source/mach_nix/requirements.py", line 143, in parse_reqs_line
raise Exception(f"couldn't parse: '{line}'")
Exception: couldn't parse: 'backoff-stubs==1.10.0--hash=sha256:03e995de0a70016c6fe758498e1ca811f1db517c00cbd06e3039c9e4f6ea2566'
It looks like mach-nix did not parse the \ and ended up combining the backoff-stubs==1.10.0 line and the hash line.
Note that even when I tried a single-line requirements.txt
backoff-stubs==1.10.0 --hash=sha256:03e995de0a70016c6fe758498e1ca811f1db517c00cbd06e3039c9e4f6ea2566
it still failed to parse the requirements.txt.
Also running into this. Perhaps it doesn't support https://github.com/jazzband/pip-tools style compiled requirements files?