Skip to content

Commit

Permalink
fix(shellcheck-py): Support 0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
l0b0 authored and cpcloud committed Oct 28, 2024
1 parent 5cc8e8e commit aac6211
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 3 deletions.
7 changes: 4 additions & 3 deletions overrides/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3715,22 +3715,23 @@ lib.composeManyExtensions [
});

shellcheck-py = prev.shellcheck-py.overridePythonAttrs (old: {

# Make fetching/installing external binaries no-ops
preConfigure =
let
fakeCommand = "type('FakeCommand', (Command,), {'initialize_options': lambda self: None, 'finalize_options': lambda self: None, 'run': lambda self: None})";
in
''
# remove setup.cfg since it causes remote package access
rm -f setup.cfg
substituteInPlace setup.py \
--replace-warn "'fetch_binaries': fetch_binaries," "'fetch_binaries': ${fakeCommand}," \
--replace-warn "'install_shellcheck': install_shellcheck," "'install_shellcheck': ${fakeCommand},"
'';

propagatedUserEnvPkgs = (old.propagatedUserEnvPkgs or [ ]) ++ [
propagatedUserEnvPkgs = old.propagatedUserEnvPkgs or [ ] ++ [
pkgs.shellcheck
];

});

soundfile =
Expand Down
1 change: 1 addition & 0 deletions tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ in
argon2-cffi-bindings-python-3-12 = callTest ./argon2-cffi-bindings-python-3-12 { };
cyclonedx-and-sarif-tools = callTest ./cyclonedx-and-sarif-tools { };
propcache = callTest ./propcache { };
shellcheck-py = callTest ./shellcheck-py { };
} // lib.optionalAttrs (!stdenv.isDarwin) {
# Editable tests fails on Darwin because of sandbox paths
pep600 = callTest ./pep600 { };
Expand Down
10 changes: 10 additions & 0 deletions tests/shellcheck-py/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{ poetry2nix, runCommand }:
let
env = poetry2nix.mkPoetryEnv {
projectDir = ./.;
};
in
runCommand "shellcheck-py-test" { } ''
${env}/bin/python -c 'import os; assert os.path.isfile("${env}/bin/shellcheck")'
touch $out
''
20 changes: 20 additions & 0 deletions tests/shellcheck-py/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions tests/shellcheck-py/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[tool.poetry]
name = "test_shellcheck_py"
version = "0.1.0"
description = ""
authors = []

[tool.poetry.dependencies]
python = "^3.8" # Based on https://pypi.org/project/shellcheck-py/
shellcheck-py = "*"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

0 comments on commit aac6211

Please sign in to comment.