Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / shells / xonsh / default.nix
blob67896d83632d94a04893b23e2940febcf2aef0c8
1 { lib
2 , fetchFromGitHub
3 , python3
4 , glibcLocales
5 , coreutils
6 , git
7 }:
9 python3.pkgs.buildPythonApplication rec {
10   pname = "xonsh";
11   version = "0.14.0";
12   format = "pyproject";
14   # fetch from github because the pypi package ships incomplete tests
15   src = fetchFromGitHub {
16     owner = "xonsh";
17     repo = "xonsh";
18     rev = "refs/tags/${version}";
19     hash = "sha256-ZrPKKa/vl06QAjGr16ZzKF/DAByFHr6ze2WVOCa+wf8=";
20   };
22   env.LC_ALL = "en_US.UTF-8";
24   postPatch = ''
25     sed -ie "s|/bin/ls|${coreutils}/bin/ls|" tests/test_execer.py
26     sed -ie "s|SHELL=xonsh|SHELL=$out/bin/xonsh|" tests/test_integrations.py
28     sed -ie 's|/usr/bin/env|${coreutils}/bin/env|' tests/test_integrations.py
29     sed -ie 's|/usr/bin/env|${coreutils}/bin/env|' scripts/xon.sh
30     find scripts -name 'xonsh*' -exec sed -i -e "s|env -S|env|" {} \;
31     find -name "*.xsh" | xargs sed -ie 's|/usr/bin/env|${coreutils}/bin/env|'
32     patchShebangs .
33   '';
35   nativeBuildInputs = with python3.pkgs; [
36     setuptools
37     wheel
38   ];
40   disabledTests = [
41     # fails on sandbox
42     "test_colorize_file"
43     "test_loading_correctly"
44     "test_no_command_path_completion"
45     "test_bsd_man_page_completions"
46     "test_xonsh_activator"
47     # fails on non-interactive shells
48     "test_capture_always"
49     "test_casting"
50     "test_command_pipeline_capture"
51     "test_dirty_working_directory"
52     "test_man_completion"
53     "test_vc_get_branch"
54     "test_bash_and_is_alias_is_only_functional_alias"
55   ];
57   disabledTestPaths = [
58     # fails on sandbox
59     "tests/completers/test_command_completers.py"
60     "tests/test_ptk_highlight.py"
61     "tests/test_ptk_shell.py"
62     # fails on non-interactive shells
63     "tests/prompt/test_gitstatus.py"
64     "tests/completers/test_bash_completer.py"
65   ];
67   preCheck = ''
68     HOME=$TMPDIR
69   '';
71   nativeCheckInputs = [ glibcLocales git ] ++
72     (with python3.pkgs; [ pip pyte pytestCheckHook pytest-mock pytest-subprocess ]);
74   propagatedBuildInputs = with python3.pkgs; [ ply prompt-toolkit pygments ];
76   meta = with lib; {
77     description = "A Python-ish, BASHwards-compatible shell";
78     homepage = "https://xon.sh/";
79     changelog = "https://github.com/xonsh/xonsh/raw/${version}/CHANGELOG.rst";
80     license = licenses.bsd3;
81     maintainers = with maintainers; [ vrthra ];
82   };
84   passthru = {
85     shellPath = "/bin/xonsh";
86     python = python3;
87   };