1{ stdenv, fetchFromGitHub, python3Packages, glibcLocales, coreutils }:
2
3python3Packages.buildPythonApplication rec {
4 name = "xonsh-${version}";
5 version = "0.4.3";
6
7 src = fetchFromGitHub {
8 owner = "scopatz";
9 repo = "xonsh";
10 rev = version;
11 sha256= "1lx95i468px908y18fa9fmfgmjsydhkpas89dxbwfnybqxxyd3ls";
12 };
13
14 ## The logo xonsh prints during build contains unicode characters, and this
15 ## fails because locales have not been set up in the build environment.
16 ## We can fix this on Linux by setting:
17 ## export LOCALE_ARCHIVE=${pkgs.glibcLocales}/lib/locale/locale-archive
18 ## but this would not be a cross platform solution, so it's simpler to just
19 ## patch the setup.py script to not print the logo during build.
20 #prePatch = ''
21 # substituteInPlace setup.py --replace "print(logo)" ""
22 #'';
23 patchPhase = ''
24 rm xonsh/winutils.py
25 sed -i -e "s|/bin/ls|${coreutils}/bin/ls|" tests/test_execer.py
26 sed -ie 's|test_win_ipconfig|_test_win_ipconfig|g' tests/test_execer.py
27 sed -ie 's|test_ipconfig|_test_ipconfig|g' tests/test_execer.py
28 rm tests/test_main.py
29 rm tests/test_man.py
30 rm tests/test_replay.py
31 '';
32
33 checkPhase = ''
34 HOME=$TMPDIR XONSH_INTERACTIVE=0 nosetests -x
35 '';
36
37 buildInputs = with python3Packages; [ glibcLocales nose pytest ];
38 propagatedBuildInputs = with python3Packages; [ ply prompt_toolkit ];
39
40 meta = with stdenv.lib; {
41 description = "A Python-ish, BASHwards-compatible shell";
42 homepage = "http://xonsh.org";
43 license = licenses.bsd3;
44 maintainers = with maintainers; [ spwhitt garbas vrthra ];
45 platforms = platforms.all;
46 };
47
48 passthru = {
49 shellPath = "/bin/xonsh";
50 };
51}