8a85e6f
Name:           xonsh
e5159ac
Version:        0.14.1
5be6e4b
Release:        %autorelease
8a85e6f
Summary:        A general purpose, Python-ish shell
8a85e6f
ac43246
# xonsh is BSD-2-Clause.
ac43246
# xonsh/winutils.py and xonsh/xoreutils/_which.py contain MIT code.
77f5bd1
License:        BSD-2-Clause AND MIT
ac43246
URL:            https://xon.sh
f80d303
Source0:        %pypi_source
8a85e6f
BuildArch:      noarch
8a85e6f
42dd6ae
Patch1: 0001-Do-not-use-custom-xinstall.patch
42dd6ae
42dd6ae
BuildRequires:  python3-devel
e5159ac
# needed for tests:
e5159ac
BuildRequires:  %{py3_dist ply}
ac43246
BuildRequires:  %{py3_dist prompt-toolkit}
ac43246
BuildRequires:  %{py3_dist pygments}
e5159ac
BuildRequires:  %{py3_dist pyte}
ac43246
BuildRequires:  %{py3_dist pytest}
42dd6ae
BuildRequires:  %{py3_dist pytest-mock}
451415e
BuildRequires:  %{py3_dist pytest-subprocess}
bf29b95
BuildRequires:  %{py3_dist pytest-rerunfailures}
e5159ac
BuildRequires:  %{py3_dist virtualenv}
42dd6ae
BuildRequires:  bash-completion
612365a
BuildRequires:  git-core
ac43246
BuildRequires:  man-db
612365a
BuildRequires:  /usr/bin/python
612365a
612365a
# required by "ptk" extra:
ac43246
Requires:       %{py3_dist prompt-toolkit}
7c1921d
Requires:       %{py3_dist pygments}
504d395
Requires:       %{py3_dist pyperclip}
612365a
612365a
# required by "setproctitle" extra:
ac43246
Requires:       %{py3_dist setproctitle}
612365a
612365a
# required by "full" extra:
ac43246
Requires:       %{py3_dist distro}
7c1921d
Requires:       %{py3_dist ujson}
8a85e6f
ed488e3
# unbundled in prep
612365a
Requires:       %{py3_dist ply}
8a85e6f
ed488e3
# required for vox
ed488e3
Requires:       %{py3_dist virtualenv}
ed488e3
42dd6ae
Recommends:     bash-completion
42dd6ae
8a85e6f
%description
ac43246
xonsh is a Python-powered, cross-platform, Unix-gazing shell language and
7c1921d
command prompt.
7c1921d
7c1921d
The language is a superset of Python 3.6+ with additional shell primitives.
7c1921d
xonsh (pronounced conch) is meant for the daily use of experts and novices
7c1921d
alike.
8a85e6f
8a85e6f
%prep
2ba4fef
%autosetup -p1 -n %{name}-%{version}
8a85e6f
612365a
# Unbundle ply
612365a
sed --in-place '/xonsh\.ply/d' setup.py
ed488e3
sed --in-place '/xonsh\.ply/d' pyproject.toml
612365a
sed --in-place -e 's/xonsh\.ply\.ply/ply/' \
612365a
               -e 's/from xonsh\.ply //' \
612365a
               $(grep -rl --include='*.py' 'xonsh\.ply')
612365a
rm -r xonsh/ply
612365a
f80d303
# Remove shebang.
612365a
sed --in-place "s:#!\s*/usr.*::" xonsh/xoreutils/_which.py xonsh/webconfig/main.py
8a85e6f
e5159ac
%generate_buildrequires
e5159ac
%pyproject_buildrequires -r
e5159ac
612365a
%build
e5159ac
%pyproject_wheel
ac43246
%py3_build
8a85e6f
8a85e6f
%install
e5159ac
%pyproject_install
e5159ac
%pyproject_save_files xompletions xonsh xontrib
ac43246
ac43246
%check
60b1ae1
# Altering PYTHONPATH makes the tests importable.
42dd6ae
%global __pytest PYTHONPATH="$PYTHONPATH:$(pwd)" %{python3} -m xonsh run-tests.xsh test --
ed488e3
# TODO: broken tests
e5159ac
%pytest -v -k "not test_complete_dots and not test_equal_sign_arg and not test_is_tok_color_dict and not test_vox"
60b1ae1
a8d209f
%post
a8d209f
if [ "$1" -ge 1 ]; then
a8d209f
  if [ ! -f %{_sysconfdir}/shells ] ; then
a8d209f
    touch %{_sysconfdir}/shells
a8d209f
  fi
a8d209f
  for binpath in %{_bindir} /bin; do
a8d209f
    if ! grep -q "^${binpath}/xonsh$" %{_sysconfdir}/shells; then
a8d209f
       (cat %{_sysconfdir}/shells; echo "$binpath/xonsh") > %{_sysconfdir}/shells.new
a8d209f
       mv %{_sysconfdir}/shells{.new,}
a8d209f
    fi
a8d209f
  done
a8d209f
fi
a8d209f
a8d209f
%postun
a8d209f
if [ "$1" = 0 ] && [ -f %{_sysconfdir}/shells ] ; then
a8d209f
  sed -e '\!^%{_bindir}/xonsh$!d' -e '\!^/bin/xonsh$!d' < %{_sysconfdir}/shells > %{_sysconfdir}/shells.new
a8d209f
  mv %{_sysconfdir}/shells{.new,}
a8d209f
fi
a8d209f
e5159ac
%files -f %{pyproject_files}
e5159ac
%doc README.rst CHANGELOG.rst
ac43246
%license license
8a85e6f
%{_bindir}/xonsh
ac43246
%{_bindir}/xonsh-cat
ed488e3
%{_bindir}/xonsh-uname
ed488e3
%{_bindir}/xonsh-uptime
8a85e6f
8a85e6f
%changelog
5be6e4b
%autochangelog