From 69828c723bd9cec386119d6d1cb1bd5d3b837b8c Mon Sep 17 00:00:00 2001 From: Daniel Salazar Date: Mon, 4 Dec 2023 16:03:55 -0500 Subject: [PATCH] feat(back): #1200 support hidden files in root - Add support for hidden files in root when using projectPath - Adapt lintPython to support new directory names --- src/args/lint-python/builder.sh | 10 +++++++++- src/args/project-path/default.nix | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/args/lint-python/builder.sh b/src/args/lint-python/builder.sh index 3bf7388a..e310b0f2 100644 --- a/src/args/lint-python/builder.sh +++ b/src/args/lint-python/builder.sh @@ -1,5 +1,13 @@ # shellcheck shell=bash +function get_package_name { + local package_path="${1}" + local package_dir + + : && package_dir="$(basename "${envSrc#*--}")" \ + && echo "${package_dir//-/_}" +} + function main { # If you do `import XXX` in your python code and the structure is like this: # /path/to/XXX @@ -12,7 +20,7 @@ function main { local python_dirs local python_dir - package_name="$(basename "${envSrc#*-}")" \ + package_name="$(get_package_name "${envSrc}")" \ && info Running mypy over: "${package_path}", package "${package_name}" \ && if ! test -e "${package_path}/py.typed"; then error This is not a mypy package, py.typed missing diff --git a/src/args/project-path/default.nix b/src/args/project-path/default.nix index c545e6b7..9f9ecc62 100644 --- a/src/args/project-path/default.nix +++ b/src/args/project-path/default.nix @@ -13,7 +13,7 @@ then name = if rel == "/" then "src" - else builtins.baseNameOf rel; + else builtins.replaceStrings ["/"] ["-"] rel; path = (builtins.unsafeDiscardStringContext projectSrc) + rel; }) else abort "projectPath arguments must start with: /, currently it is: ${rel}"