mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-04 20:22:14 +03:00
add discoverer for python
This commit is contained in:
parent
e840c50ec7
commit
753452e0fb
35
src/discoverers/python/default.nix
Normal file
35
src/discoverers/python/default.nix
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
dlib,
|
||||
lib,
|
||||
subsystem,
|
||||
}: let
|
||||
l = lib // builtins;
|
||||
|
||||
discover = {tree}: let
|
||||
subdirProjects =
|
||||
l.flatten
|
||||
(l.mapAttrsToList
|
||||
(dirName: dir: discover {tree = dir;})
|
||||
(tree.directories or {}));
|
||||
in
|
||||
# A directory is identified as a project only if it contains a Cargo.toml
|
||||
# and a Cargo.lock.
|
||||
if tree ? files."setup.py"
|
||||
then
|
||||
[
|
||||
(dlib.construct.discoveredProject {
|
||||
inherit subsystem;
|
||||
relPath = tree.relPath;
|
||||
name =
|
||||
l.unsafeDiscardStringContext
|
||||
(l.last
|
||||
(l.splitString "/" (l.removeSuffix "/" "${tree.fullPath}")));
|
||||
translators = ["pip-WIP"];
|
||||
subsystemInfo.pythonAttr = "python3";
|
||||
})
|
||||
]
|
||||
++ subdirProjects
|
||||
else subdirProjects;
|
||||
in {
|
||||
inherit discover;
|
||||
}
|
Loading…
Reference in New Issue
Block a user