Skip to content

Commit

Permalink
refac(back): #1200 remove prefix
Browse files Browse the repository at this point in the history
- Keep using basename in order to avoid errors
- Remove prefix dot if basename contains it
- get package_name the old way

Signed-off-by: Daniel Salazar <podany270895@gmail.com>
  • Loading branch information
dsalaza4 committed Dec 5, 2023
1 parent 946c7ae commit dda5da5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/args/lint-python/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function main {
local python_dirs
local python_dir

package_name="$(basename "${envSrc##*-}")" \
package_name="$(basename "${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
Expand Down
3 changes: 2 additions & 1 deletion src/args/project-path/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
hasPrefix,
projectSrc,
removePrefix,
...
}: rel:
if hasPrefix "/" rel
Expand All @@ -13,7 +14,7 @@ then
name =
if rel == "/"
then "src"
else builtins.replaceStrings ["/"] ["-"] rel;
else removePrefix "." (builtins.baseNameOf rel);
path = (builtins.unsafeDiscardStringContext projectSrc) + rel;
})
else abort "projectPath arguments must start with: /, currently it is: ${rel}"

0 comments on commit dda5da5

Please sign in to comment.