mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
Merge branch 'master' of https://github.com/xonsh/xonsh into rever_appimage
This commit is contained in:
commit
7b67548586
53 changed files with 468 additions and 400 deletions
|
@ -1,4 +1,4 @@
|
|||
version: 0.9.17.{build}
|
||||
version: 0.9.18.{build}
|
||||
os: Windows Server 2012 R2
|
||||
environment:
|
||||
|
||||
|
|
25
.authors.yml
25
.authors.yml
|
@ -32,7 +32,7 @@
|
|||
- jamie.bliss@ilq.com
|
||||
- jbliss@nextgenerationenrollment.com
|
||||
- jamie@ivyleav.es
|
||||
num_commits: 212
|
||||
num_commits: 213
|
||||
first_commit: 2016-07-20 14:05:08
|
||||
github: astronouth7303
|
||||
- name: Cody Scott
|
||||
|
@ -63,7 +63,7 @@
|
|||
- Gilbert.Forsyth@capitalone.com
|
||||
- gforsyth@gwu.edu
|
||||
- gil@forsyth.dev
|
||||
num_commits: 526
|
||||
num_commits: 529
|
||||
first_commit: 2015-10-19 16:04:32
|
||||
github: gforsyth
|
||||
- name: Morten Enemark Lund
|
||||
|
@ -434,7 +434,7 @@
|
|||
github: funkyfuture
|
||||
- name: Anthony Scopatz
|
||||
email: scopatz@gmail.com
|
||||
num_commits: 2597
|
||||
num_commits: 2600
|
||||
first_commit: 2015-01-21 17:04:13
|
||||
github: scopatz
|
||||
- name: anatoly techtonik
|
||||
|
@ -652,7 +652,9 @@
|
|||
github: anddam
|
||||
- name: Raphael Das Gupta
|
||||
email: raphael.das.gupta@hsr.ch
|
||||
num_commits: 9
|
||||
alternate_emails:
|
||||
- git@raphael.dasgupta.ch
|
||||
num_commits: 10
|
||||
first_commit: 2017-01-03 06:56:44
|
||||
- name: Andrei
|
||||
email: fizicars@gmail.com
|
||||
|
@ -950,7 +952,7 @@
|
|||
github: selepo
|
||||
- name: Bob Hyman
|
||||
email: bob.hyman@bobssoftwareworks.com
|
||||
num_commits: 68
|
||||
num_commits: 71
|
||||
first_commit: 2016-06-26 16:48:47
|
||||
github: bobhy
|
||||
alternate_emails:
|
||||
|
@ -1099,7 +1101,7 @@
|
|||
email: anki-code@users.noreply.github.com
|
||||
alternate_emails:
|
||||
- anki-code
|
||||
num_commits: 21
|
||||
num_commits: 26
|
||||
first_commit: 2019-10-15 18:20:58
|
||||
- name: Sylvain Corlay
|
||||
email: sylvain.corlay@gmail.com
|
||||
|
@ -1122,7 +1124,7 @@
|
|||
github: marciomazza
|
||||
- name: Noortheen Raja
|
||||
email: jnoortheen@gmail.com
|
||||
num_commits: 2
|
||||
num_commits: 3
|
||||
first_commit: 2020-03-15 10:13:56
|
||||
github: jnoortheen
|
||||
- name: Samuel Lotz
|
||||
|
@ -1143,3 +1145,12 @@
|
|||
email: anki@code.email
|
||||
num_commits: 2
|
||||
first_commit: 2020-03-02 04:59:17
|
||||
- name: Manor Askenazi
|
||||
email: manor@biomedical.hosting
|
||||
num_commits: 1
|
||||
first_commit: 2020-04-25 18:21:05
|
||||
github: manor
|
||||
- name: Marduk Bolaños
|
||||
email: mardukbp@mac.com
|
||||
num_commits: 1
|
||||
first_commit: 2020-04-30 20:26:48
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -67,6 +67,7 @@ xonsh/webconfig/js/app.js
|
|||
|
||||
# venv (e.g, autovox)
|
||||
venv/
|
||||
.venv/
|
||||
|
||||
# VS Code
|
||||
.vscode/
|
||||
|
|
8
.mailmap
8
.mailmap
|
@ -38,9 +38,9 @@ Matthias Bussonnier <bussonniermatthias@gmail.com>
|
|||
Konstantin Molchanov <kmolchanov@machinezone.com> Konstantin Molchanov <moigagoo@live.com>
|
||||
Guillaume Leclerc <guillaume.leclerc@epfl.ch> Guillaume Leclerc <guillaume.leclerc.work@gmail.com>
|
||||
Gordon Ball <gordon@chronitis.net>
|
||||
anki-code <anki-code@users.noreply.github.com> anki-code <anki-code>
|
||||
Travis Shirk <travis@pobox.com>
|
||||
Joel Gerber <joel@grrbrr.ca>
|
||||
anki-code <anki-code@users.noreply.github.com> anki-code <anki-code>
|
||||
vaaaaanquish <6syun9@gmail.com> @vaaaaanquish <6syun9@gmail.com>
|
||||
vaaaaanquish <6syun9@gmail.com> vaaaaanquish <6syun9@gmail.com>
|
||||
vaaaaanquish <6syun9@gmail.com> 6syun9 <6syun9@gmail.com>
|
||||
|
@ -61,7 +61,7 @@ Justin Moen <jamoen7@gmail.com>
|
|||
con-f-use <con-f-use@users.noreply.github.com>
|
||||
Caleb Hattingh <caleb.hattingh@gmail.com>
|
||||
Stephan Fitzpatrick <knowsuchagency@gmail.com>
|
||||
Raphael Das Gupta <raphael.das.gupta@hsr.ch>
|
||||
Raphael Das Gupta <raphael.das.gupta@hsr.ch> Raphael Das Gupta <git@raphael.dasgupta.ch>
|
||||
K.-Michael Aye <kmichael.aye@gmail.com> K.-Michael Aye <michaelaye@users.noreply.github.com>
|
||||
Jason R. Coombs <jaraco@jaraco.com>
|
||||
halloleo <git@halloleo.dot.hailmail.dot.net> halloleo <halloleo@users.noreply.github.com>
|
||||
|
@ -141,6 +141,7 @@ Sébastien Pierre <sebastien.pierre@gmail.com>
|
|||
shadow-light <42055707+shadow-light@users.noreply.github.com>
|
||||
Gyuri Horak <dyuri@horak.hu>
|
||||
Jan Chren <dev.rindeal@gmail.com>
|
||||
Noortheen Raja <jnoortheen@gmail.com>
|
||||
Samuel Lotz <samuel.lotz@salotz.info>
|
||||
Mark Wiebe <mwwiebe@gmail.com>
|
||||
Nathan Hoad <nathan@getoffmalawn.com>
|
||||
|
@ -170,7 +171,6 @@ Allan Crooks <allan.crooks@sixtyten.org>
|
|||
micimize <rosenthalm93@gmail.com>
|
||||
Chris Lasher <chris.lasher@gmail.com>
|
||||
Edmund Miller <edmund.a.miller@protonmail.com>
|
||||
Noortheen Raja <jnoortheen@gmail.com>
|
||||
Gabriel Vogel <gabriel.vogel@online.de>
|
||||
anki <anki@code.email>
|
||||
Dan Allan <dallan@bnl.gov>
|
||||
|
@ -238,5 +238,7 @@ David Kalliecharan <david@david.science>
|
|||
Sylvain Corlay <sylvain.corlay@gmail.com>
|
||||
Marcio Mazza <marciomazza@gmail.com>
|
||||
Jerzy Drozdz <jerzy.drozdz@gmail.com>
|
||||
Manor Askenazi <manor@biomedical.hosting>
|
||||
Marduk Bolaños <mardukbp@mac.com>
|
||||
goodboy <tgoodlet@users.noreply.github.com>
|
||||
Atsushi Morimoto <atsushi.morimoto@dena.com>
|
||||
|
|
|
@ -24,9 +24,9 @@ Authors are sorted by number of commits.
|
|||
* Konstantin Molchanov
|
||||
* Guillaume Leclerc
|
||||
* Gordon Ball
|
||||
* anki-code
|
||||
* Travis Shirk
|
||||
* Joel Gerber
|
||||
* anki-code
|
||||
* vaaaaanquish
|
||||
* Bernardas Ališauskas
|
||||
* Derek Thomas
|
||||
|
@ -125,6 +125,7 @@ Authors are sorted by number of commits.
|
|||
* shadow-light
|
||||
* Gyuri Horak
|
||||
* Jan Chren
|
||||
* Noortheen Raja
|
||||
* Samuel Lotz
|
||||
* Mark Wiebe
|
||||
* Nathan Hoad
|
||||
|
@ -154,7 +155,6 @@ Authors are sorted by number of commits.
|
|||
* micimize
|
||||
* Chris Lasher
|
||||
* Edmund Miller
|
||||
* Noortheen Raja
|
||||
* Gabriel Vogel
|
||||
* anki
|
||||
* Dan Allan
|
||||
|
@ -222,5 +222,7 @@ Authors are sorted by number of commits.
|
|||
* Sylvain Corlay
|
||||
* Marcio Mazza
|
||||
* Jerzy Drozdz
|
||||
* Manor Askenazi
|
||||
* Marduk Bolaños
|
||||
* goodboy
|
||||
* Atsushi Morimoto
|
||||
|
|
|
@ -4,6 +4,53 @@ Xonsh Change Log
|
|||
|
||||
.. current developments
|
||||
|
||||
v0.9.18
|
||||
====================
|
||||
|
||||
**Added:**
|
||||
|
||||
* external *xontrib-hist-navigator* to facilitate directory history navigation.
|
||||
* Support package prompt-toolkit V3 as well as V2 in prompt_toolkit shell.
|
||||
* New `xontrib-output-search <https://github.com/anki-code/xontrib-output-search>`_ to get identifiers, names, paths, URLs and words from the previous command output and use them for the next command.
|
||||
* New `xontrib-pipeliner <https://github.com/anki-code/xontrib-pipeliner>`_ is to easily process the lines using pipes.
|
||||
* New `xontrib-prompt-bar <https://github.com/anki-code/xontrib-prompt-bar>`_ with elegance bar style for prompt.
|
||||
|
||||
**Changed:**
|
||||
|
||||
* $SHELL_TYPE "prompt_toolkit" with any suffix creates the "prompt_toolkit" shell, requires package prompt-toolkit >= 2.0
|
||||
* Moved code from package xonsh.ptk2 to xonsh.ptk_shell (because it's the only one now); package xonsh.ptk2 redirects thence.
|
||||
* Added extremely simplified xonsh AppImage building process.
|
||||
* Added examples of usage $XONSH_TRACE_SUBPROC to the docs
|
||||
* Use UTF-8 encoding when writing .xonshrc with webconfig for Windows compatibility
|
||||
|
||||
**Deprecated:**
|
||||
|
||||
* prompt-toolkit versions before 2.0
|
||||
|
||||
**Removed:**
|
||||
|
||||
* package xonsh.ptk
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* Fixed name autosuggestion in path completer (#3519)
|
||||
* Flake8/black fixes to the whole code tree, in 3 steps.
|
||||
Devs should update their IDE to run both during file editing, to avoid a re-accumulation of arbitrary exceptions.
|
||||
* tests/test_builtins.py, fix test case test_convert_macro_arg_eval(kind).
|
||||
|
||||
**Authors:**
|
||||
|
||||
* Gil Forsyth
|
||||
* Jamie Bliss
|
||||
* Bob Hyman
|
||||
* anki-code
|
||||
* Raphael Das Gupta
|
||||
* Noortheen Raja
|
||||
* Manor Askenazi
|
||||
* Marduk Bolaños
|
||||
|
||||
|
||||
|
||||
v0.9.17
|
||||
====================
|
||||
|
||||
|
|
|
@ -5,128 +5,12 @@ Portable rootless xonsh build on AppImage
|
|||
|
||||
AppImage allows xonsh to be run on any AppImage supported Linux distributive without installation and root access.
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<p align="center"><a href="https://asciinema.org/a/9AH5AtYxbrn5nRo83nm46Z34n" target="_blank"><img src="https://asciinema.org/a/9AH5AtYxbrn5nRo83nm46Z34n.svg" /></a></p>
|
||||
|
||||
Try it now
|
||||
----------
|
||||
You can download and try `prebuilded xonsh.AppImage <https://github.com/niess/linuxdeploy-plugin-python/releases>`_:
|
||||
The best way to build xonsh AppImage in 5 minutes is to using `python-appimage <https://github.com/niess/python-appimage>`_:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
wget https://github.com/niess/linuxdeploy-plugin-python/releases/download/continuous/xonsh-x86_64.AppImage -O xonsh.AppImage
|
||||
chmod +x xonsh.AppImage
|
||||
./xonsh.AppImage -c "echo @(1+1)"
|
||||
./xonsh.AppImage
|
||||
|
||||
Build xonsh.AppImage
|
||||
--------------------
|
||||
|
||||
`Dockerfile`
|
||||
~~~~~~~~~~~~
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
FROM ubuntu:16.04
|
||||
RUN apt update -y && apt upgrade -y
|
||||
RUN apt install --no-install-recommends -y -qq \
|
||||
fuse wget mc git \
|
||||
build-essential python-dev python-setuptools python-pip python-smbus \
|
||||
libncursesw5-dev lib32ncurses5-dev libgdbm-dev libc6-dev \
|
||||
zlib1g-dev libsqlite3-dev tk-dev libssl-dev openssl libffi-dev autoconf \
|
||||
libfuse-dev libncurses5-dev libreadline-dev libdb5.3-dev libbz2-dev \
|
||||
libexpat1-dev liblzma-dev automake libfuse2
|
||||
|
||||
RUN mkdir -p /build /appimage
|
||||
WORKDIR /build
|
||||
RUN git clone --depth 1 https://github.com/niess/linuxdeploy-plugin-python && \
|
||||
cd linuxdeploy-plugin-python && \
|
||||
git checkout 85d2e6fac5969d1b381f4da384248b368522ede3
|
||||
CMD cd /build/linuxdeploy-plugin-python/appimage && ./build-python.sh xonsh && cp *.AppImage /appimage
|
||||
|
||||
|
||||
`build.sh`
|
||||
~~~~~~~~~~
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
docker build --no-cache -t local/appimage-xonsh .
|
||||
docker run --rm --privileged --device /dev/fuse -v `pwd`:/appimage -it local/appimage-xonsh
|
||||
|
||||
As result you'll find executable file ``xonsh-x86_64.AppImage`` that runs xonsh and can take command line arguments like xonsh. Enjoy!
|
||||
|
||||
Running portable python and pip
|
||||
-------------------------------
|
||||
|
||||
If you need to use python and pip from portable `xonsh.AppImage` just set up directories in `~/.xonshrc`:
|
||||
|
||||
.. code-block:: xonsh
|
||||
|
||||
# replace host python to xonsh.AppImage python
|
||||
$PATH = [$PYTHONHOME + '/bin'] + $PATH
|
||||
|
||||
# setting up pip packages directory
|
||||
$PIP_TARGET='/tmp/xonsh/pip'
|
||||
import sys
|
||||
sys.path.append('/tmp/xonsh/pip')
|
||||
|
||||
And magic is here:
|
||||
|
||||
.. code-block:: xonsh
|
||||
|
||||
xonsh$ pip3 install tqdm
|
||||
xonsh$ ls /tmp/xonsh/pip/
|
||||
tqdm
|
||||
xonsh$ python
|
||||
>>> import tqdm
|
||||
>>> tqdm
|
||||
<module 'tqdm' from '/tmp/xonsh/pip/tqdm/__init__.py'>
|
||||
>>> # nice!
|
||||
|
||||
Troubleshooting
|
||||
---------------
|
||||
|
||||
Python ImportError: No module named site
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. code-block:: xonsh
|
||||
|
||||
xonsh$ python
|
||||
ImportError: No module named site
|
||||
|
||||
The error above was appeared because host machine python try to find right path for `site-packages`. The fix is just using python from AppImage by setting right path to it across `$PYTHONHOME` which was set by AppImage:
|
||||
|
||||
.. code-block:: xonsh
|
||||
|
||||
xonsh$ $PATH = [$PYTHONHOME + '/bin'] + $PATH
|
||||
xonsh$ python
|
||||
Python 3.7.3
|
||||
>>> # success
|
||||
|
||||
GLIBs versions
|
||||
~~~~~~~~~~~~~~
|
||||
You can noticed that we build AppImage in docker with older version of Ubuntu (16.04) to avoid error with core libraries versions when binary compiled on modern version can't use older version of libraries. In this nasty case you can see the error like ``/xonsh-x86_64.AppImage: /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.25 not found (required by /ppp/xonsh-x86_64.AppImage)``. This means you should rebuild the AppImage for older version of distributive. If you know how to fix it once and forever feel free to tell us.
|
||||
|
||||
Windows Subsystem for Linux v1 (WSL1)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Need WSL support:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
wsl1# ./xonsh.AppImage
|
||||
fuse: device not found, try 'modprobe fuse' first
|
||||
|
||||
Cannot mount AppImage, please check your FUSE setup.
|
||||
You might still be able to extract the contents of this AppImage
|
||||
if you run it with the --appimage-extract option.
|
||||
See https://github.com/AppImage/AppImageKit/wiki/FUSE
|
||||
for more information
|
||||
open dir error: No such file or directory
|
||||
|
||||
Workaround is extracting appimage and run manually:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
wsl1$ ./xonsh.AppImage --appimage-extract
|
||||
wsl1$ ./squashfs-root/usr/bin/python3.7
|
||||
mkdir -p /tmp/test && cd /tmp/test
|
||||
git clone https://github.com/niess/python-appimage
|
||||
cd python-appimage
|
||||
python -m python_appimage build app applications/xonsh
|
||||
./xonsh-x86_64.AppImage
|
||||
|
|
|
@ -43,7 +43,7 @@ line is ``#!/usr/bin/env xonsh``.
|
|||
- Cause a failure after a non-zero return code. Xonsh will raise a
|
||||
``supbrocess.CalledProcessError``.
|
||||
* - ``set -x``
|
||||
- ``trace on``
|
||||
- ``trace on`` and ``$XONSH_TRACE_SUBPROC = True``
|
||||
- Turns on tracing of source code lines during execution.
|
||||
* - ``&&``
|
||||
- ``and`` or ``&&``
|
||||
|
@ -68,3 +68,17 @@ line is ``#!/usr/bin/env xonsh``.
|
|||
* - ``$@``
|
||||
- ``$ARGS``
|
||||
- List of all command line argument and parameter strings.
|
||||
* - ``exit``
|
||||
- ``sys.exit()``
|
||||
- Exiting from the current script.
|
||||
|
||||
To understand how xonsh executes the subprocess commands try
|
||||
to set :ref:`$XONSH_TRACE_SUBPROC <xonsh_trace_subproc>` to ``True``:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
>>> $XONSH_TRACE_SUBPROC = True
|
||||
>>> echo $(echo @('hello')) @('wor' + 'ld') | grep hello
|
||||
TRACE SUBPROC: (['echo', 'hello'],)
|
||||
TRACE SUBPROC: (['echo', 'hello\n', 'world'], '|', ['grep', 'hello'])
|
||||
|
||||
|
|
|
@ -604,6 +604,21 @@ With great power, and so forth...
|
|||
Python mode, it is not possible to nest other subprocess operators
|
||||
inside of them.
|
||||
|
||||
To understand how xonsh executes the subprocess commands try
|
||||
to set :ref:`$XONSH_TRACE_SUBPROC <xonsh_trace_subproc>` to ``True``:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
>>> $XONSH_TRACE_SUBPROC = True
|
||||
>>> $[@$(which @($(echo ls).strip())) @('-' + $(printf 'l'))]
|
||||
TRACE SUBPROC: (['echo', 'ls'],)
|
||||
TRACE SUBPROC: (['which', 'ls'],)
|
||||
TRACE SUBPROC: (['printf', 'l'],)
|
||||
TRACE SUBPROC: (['ls', '--color=auto', '-v', '-l'],)
|
||||
total 0
|
||||
-rw-rw-r-- 1 snail snail 0 Mar 8 15:46 xonsh
|
||||
|
||||
|
||||
Pipes
|
||||
====================
|
||||
|
||||
|
|
|
@ -329,6 +329,15 @@ For the commands, the input sequences are diff'd first, prior to the outputs
|
|||
being compared. In a terminal, this will appear in color, with the first history
|
||||
in red and the second one in green.
|
||||
|
||||
``flush`` action
|
||||
================
|
||||
Normally, the history entries are kept in memory and are only saved to disk once
|
||||
the in-memory buffer gets full. This is in order to reduce unnecessary I/O and to
|
||||
keep session history free from noise from other sessions. Sometimes, however, it
|
||||
may be useful to share entries between shell sessions. In such a case, one can use
|
||||
the ``flush`` action to immediately save the session history to disk and make it
|
||||
accessible from other shell sessions.
|
||||
|
||||
``gc`` action
|
||||
===============
|
||||
Last, but certainly not least, the ``gc`` action is a manual hook into executing
|
||||
|
|
|
@ -60,7 +60,7 @@ Here is a sample file system layout and what the xontrib names would be::
|
|||
|
||||
|
||||
You can also use `cookiecutter <https://github.com/audreyr/cookiecutter>`_ with
|
||||
the `xontrib template <https://github.com/laerus/cookiecutter-xontrib>`_ to easily
|
||||
the `xontrib template <https://github.com/xonsh/xontrib-cookiecutter>`_ to easily
|
||||
create the layout for your xontrib package.
|
||||
|
||||
|
||||
|
|
23
news/add-history-flush.rst
Normal file
23
news/add-history-flush.rst
Normal file
|
@ -0,0 +1,23 @@
|
|||
**Added:**
|
||||
|
||||
* ``history`` command now supports ``flush`` action
|
||||
|
||||
**Changed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Deprecated:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Removed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Security:**
|
||||
|
||||
* <news item>
|
|
@ -1,24 +0,0 @@
|
|||
**Added:**
|
||||
|
||||
* Support package prompt-toolkit V3 as well as V2 in prompt_toolkit shell.
|
||||
|
||||
**Changed:**
|
||||
|
||||
* $SHELL_TYPE "prompt_toolkit" with any suffix creates the "prompt_toolkit" shell, requires package prompt-toolkit >= 2.0
|
||||
* Moved code from package xonsh.ptk2 to xonsh.ptk_shell (because it's the only one now); package xonsh.ptk2 redirects thence.
|
||||
|
||||
**Deprecated:**
|
||||
|
||||
* prompt-toolkit versions before 2.0
|
||||
|
||||
**Removed:**
|
||||
|
||||
* package xonsh.ptk
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Security:**
|
||||
|
||||
* <news item>
|
23
news/exit.rst
Normal file
23
news/exit.rst
Normal file
|
@ -0,0 +1,23 @@
|
|||
**Added:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Changed:**
|
||||
|
||||
* Added exit to the "Bash to xsh" article.
|
||||
|
||||
**Deprecated:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Removed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Security:**
|
||||
|
||||
* <news item>
|
23
news/fix-unary-position.rst
Normal file
23
news/fix-unary-position.rst
Normal file
|
@ -0,0 +1,23 @@
|
|||
**Added:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Changed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Deprecated:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Removed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* Logical subprocess operators now work after long arguments (e.g. ``--version``).
|
||||
|
||||
**Security:**
|
||||
|
||||
* <news item>
|
23
news/fix_pip_completer.rst
Normal file
23
news/fix_pip_completer.rst
Normal file
|
@ -0,0 +1,23 @@
|
|||
**Added:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Changed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Deprecated:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Removed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* ``pip`` completer no longer erroneously fires for ``pipx``
|
||||
|
||||
**Security:**
|
||||
|
||||
* <news item>
|
|
@ -1,23 +0,0 @@
|
|||
**Added:**
|
||||
|
||||
* New `xontrib-output-search <https://github.com/anki-code/xontrib-output-search>`_ to get identifiers, names, paths, URLs and words from the previous command output and use them for the next command.
|
||||
|
||||
**Changed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Deprecated:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Removed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Security:**
|
||||
|
||||
* <news item>
|
|
@ -25,7 +25,6 @@ exclude = '''
|
|||
| \.github
|
||||
| \.vscode
|
||||
| \.pytest_cache
|
||||
| tests
|
||||
)/
|
||||
)
|
||||
'''
|
||||
|
|
95
setup.cfg
95
setup.cfg
|
@ -5,7 +5,7 @@ flake8-ignore =
|
|||
*.py E203 # E203 whitespace before ':'
|
||||
*.py E402
|
||||
*.py W503 # line break before binary operators is a good thing
|
||||
tests/tools.py E128
|
||||
*.py E731 # it's OK to assign lambda to variable
|
||||
xonsh/pygments_cache.py ALL
|
||||
# flake8 gives incorrect unused import errors, F401
|
||||
xonsh/ast.py F401
|
||||
|
@ -26,8 +26,6 @@ flake8-ignore =
|
|||
xonsh/ptk/shell.py E731
|
||||
xontrib/vox.py F821
|
||||
__amalgam__.py ALL
|
||||
# test files should be PEP8 but a ton of errors for now
|
||||
test_*.py ALL
|
||||
# we don't care about sphinx autogenerated files
|
||||
docs/*.py ALL
|
||||
# we don't care about ply files?
|
||||
|
@ -53,53 +51,56 @@ flake8-ignore =
|
|||
|
||||
[flake8]
|
||||
max-line-length = 180
|
||||
ignore =
|
||||
*.py E122
|
||||
*.py E203 # E203 whitespace before ':'
|
||||
*.py E402
|
||||
*.py W503 # line break before binary operators is a good thing
|
||||
tests/tools.py E128
|
||||
xonsh/pygments_cache.py ALL
|
||||
# flake8 gives incorrect unused import errors, F401
|
||||
xonsh/ast.py F401
|
||||
xonsh/platform.py F401
|
||||
xonsh/built_ins.py F821 E721
|
||||
xonsh/commands_cache.py F841
|
||||
xonsh/history.py F821
|
||||
xonsh/jupyter_kernel.py E203
|
||||
xonsh/pyghooks.py F821
|
||||
xonsh/style_tools.py F821
|
||||
xonsh/readline_shell.py F401
|
||||
xonsh/timings.py F401
|
||||
xonsh/tokenize.py F821 F841
|
||||
xonsh/tools.py E731
|
||||
xonsh/xonfig.py E731
|
||||
xonsh/proc.py E261 E265
|
||||
xonsh/ptk/key_bindings.py F841
|
||||
xonsh/ptk/shell.py E731
|
||||
xontrib/vox.py F821
|
||||
__amalgam__.py ALL
|
||||
# test files should be PEP8 but a ton of errors for now
|
||||
test_*.py ALL
|
||||
# ignore <file> ALL hangs on parser_table.py, need exclude=
|
||||
# flake8 uses os.fnmatch -- different globbing syntax.
|
||||
exclude =
|
||||
__amalgam__.py
|
||||
# we don't care about sphinx autogenerated files
|
||||
docs/*.py ALL
|
||||
docs/*.py
|
||||
# we don't care about ply files?
|
||||
ply/*.py ALL
|
||||
*/ply/*.py
|
||||
# these run VERY slowly and give tons of errors
|
||||
parser*_table.py ALL
|
||||
parser*_table.py
|
||||
# oh come on
|
||||
setup.py ALL
|
||||
setup.py
|
||||
ignore =
|
||||
E122
|
||||
, E203 # E203 whitespace before ':'
|
||||
, E402
|
||||
, W503 # line break before binary operators is a good thing
|
||||
, E741 # ambiguous variable name
|
||||
, E731 # it's OK to assign lambda to variable.
|
||||
|
||||
per-file-ignores =
|
||||
xonsh/pygments_cache.py: ALL
|
||||
# flake8 gives incorrect unused import errors, F401
|
||||
xonsh/ast.py: F401
|
||||
xonsh/platform.py: F401
|
||||
xonsh/built_ins.py: F821, E721
|
||||
xonsh/commands_cache.py: F841
|
||||
xonsh/history.py: F821
|
||||
xonsh/jupyter_kernel.py: E203
|
||||
xonsh/pyghooks.py: F821
|
||||
xonsh/style_tools.py: F821
|
||||
xonsh/readline_shell.py: F401
|
||||
xonsh/timings.py: F401
|
||||
xonsh/tokenize.py: F821, F841
|
||||
xonsh/tools.py: E731
|
||||
xonsh/xonfig.py: E731
|
||||
xonsh/proc.py: E261, E265
|
||||
xonsh/ptk/key_bindings.py: F841
|
||||
xonsh/ptk/shell.py: E731
|
||||
xontrib/vox.py: F821
|
||||
|
||||
# remove these later
|
||||
*.py E741 # ambiguous variable name
|
||||
xonsh/color_tools.py E305
|
||||
xonsh/inspectors.py E722
|
||||
xonsh/lexer.py E741
|
||||
xonsh/platform.py E305
|
||||
xonsh/style_tools.py E305
|
||||
xonsh/tools.py E305
|
||||
xonsh/winutils.py E305
|
||||
xonsh/completers/_aliases.py E305
|
||||
xonsh/completers/python.py E722
|
||||
xonsh/parsers/context_check.py E305
|
||||
xonsh/xoreutils/*.py E722 E305
|
||||
xonsh/color_tools.py: E305
|
||||
xonsh/inspectors.py: E722
|
||||
xonsh/lexer.py: E741
|
||||
xonsh/platform.py: E305
|
||||
xonsh/style_tools.py: E305
|
||||
xonsh/tools.py: E305
|
||||
xonsh/winutils.py: E305
|
||||
xonsh/completers/_aliases.py: E305
|
||||
xonsh/completers/python.py: E722
|
||||
xonsh/parsers/context_check.py: E305
|
||||
xonsh/xoreutils/*.py: E722, E305
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import os
|
||||
import inspect
|
||||
import pytest
|
||||
import sys
|
||||
|
||||
from xonsh.aliases import xexec
|
||||
|
||||
|
|
|
@ -33,7 +33,10 @@ def test_pip_list_re(line):
|
|||
"![thewholepipandpaboodle uninstall",
|
||||
"$[littlebopip show",
|
||||
"!(boxpip uninstall",
|
||||
"pipx",
|
||||
"vim pip_",
|
||||
"pip_",
|
||||
],
|
||||
)
|
||||
def test_pip_list_re(line):
|
||||
def test_pip_list_re1(line):
|
||||
assert PIP_RE.search(line) is None
|
||||
|
|
|
@ -6,7 +6,6 @@ import os
|
|||
|
||||
import pytest
|
||||
|
||||
import xonsh.built_ins as built_ins
|
||||
from xonsh.aliases import Aliases, ExecAlias
|
||||
from xonsh.environ import Env
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import ast as pyast
|
||||
|
||||
from xonsh import ast
|
||||
from xonsh.ast import Tuple, Name, Store, min_line, Call, BinOp, pdump, isexpression
|
||||
from xonsh.ast import Tuple, Name, Store, min_line, Call, BinOp, isexpression
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
|
@ -3,37 +3,35 @@ import pytest
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"history, inp, exp", [
|
||||
"history, inp, exp",
|
||||
[
|
||||
# No history:
|
||||
([], '!!', ''),
|
||||
([], '!$', ''),
|
||||
([], '!^', ''),
|
||||
([], '!*', ''),
|
||||
([], '!echo', ''),
|
||||
|
||||
([], "!!", ""),
|
||||
([], "!$", ""),
|
||||
([], "!^", ""),
|
||||
([], "!*", ""),
|
||||
([], "!echo", ""),
|
||||
# No substitution:
|
||||
(['aa 1 2', 'ab 3 4'], "ls", "ls"),
|
||||
(['aa 1 2', 'ab 3 4'], "x = 42", "x = 42"),
|
||||
(['aa 1 2', 'ab 3 4'], '!', '!'),
|
||||
|
||||
(["aa 1 2", "ab 3 4"], "ls", "ls"),
|
||||
(["aa 1 2", "ab 3 4"], "x = 42", "x = 42"),
|
||||
(["aa 1 2", "ab 3 4"], "!", "!"),
|
||||
# Bang command only:
|
||||
(['aa 1 2', 'ab 3 4'], "!!", "ab 3 4"),
|
||||
(['aa 1 2', 'ab 3 4'], "!$", "4"),
|
||||
(['aa 1 2', 'ab 3 4'], "!^", "ab"),
|
||||
(['aa 1 2', 'ab 3 4'], "!*", "3 4"),
|
||||
(['aa 1 2', 'ab 3 4'], "!a", "ab 3 4"),
|
||||
(['aa 1 2', 'ab 3 4'], "!aa", "aa 1 2"),
|
||||
(['aa 1 2', 'ab 3 4'], "!ab", "ab 3 4"),
|
||||
|
||||
(["aa 1 2", "ab 3 4"], "!!", "ab 3 4"),
|
||||
(["aa 1 2", "ab 3 4"], "!$", "4"),
|
||||
(["aa 1 2", "ab 3 4"], "!^", "ab"),
|
||||
(["aa 1 2", "ab 3 4"], "!*", "3 4"),
|
||||
(["aa 1 2", "ab 3 4"], "!a", "ab 3 4"),
|
||||
(["aa 1 2", "ab 3 4"], "!aa", "aa 1 2"),
|
||||
(["aa 1 2", "ab 3 4"], "!ab", "ab 3 4"),
|
||||
# Bang command with others:
|
||||
(['aa 1 2', 'ab 3 4'], "echo !! >log", "echo ab 3 4 >log"),
|
||||
(['aa 1 2', 'ab 3 4'], "echo !$ >log", "echo 4 >log"),
|
||||
(['aa 1 2', 'ab 3 4'], "echo !^ >log", "echo ab >log"),
|
||||
(['aa 1 2', 'ab 3 4'], "echo !* >log", "echo 3 4 >log"),
|
||||
(['aa 1 2', 'ab 3 4'], "echo !a >log", "echo ab 3 4 >log"),
|
||||
(['aa 1 2', 'ab 3 4'], "echo !aa >log", "echo aa 1 2 >log"),
|
||||
(['aa 1 2', 'ab 3 4'], "echo !ab >log", "echo ab 3 4 >log"),
|
||||
]
|
||||
(["aa 1 2", "ab 3 4"], "echo !! >log", "echo ab 3 4 >log"),
|
||||
(["aa 1 2", "ab 3 4"], "echo !$ >log", "echo 4 >log"),
|
||||
(["aa 1 2", "ab 3 4"], "echo !^ >log", "echo ab >log"),
|
||||
(["aa 1 2", "ab 3 4"], "echo !* >log", "echo 3 4 >log"),
|
||||
(["aa 1 2", "ab 3 4"], "echo !a >log", "echo ab 3 4 >log"),
|
||||
(["aa 1 2", "ab 3 4"], "echo !aa >log", "echo aa 1 2 >log"),
|
||||
(["aa 1 2", "ab 3 4"], "echo !ab >log", "echo ab 3 4 >log"),
|
||||
],
|
||||
)
|
||||
def test_preproc(history, inp, exp, xonsh_builtins):
|
||||
"""Test the bash preprocessor."""
|
||||
|
|
|
@ -3,14 +3,12 @@
|
|||
from __future__ import unicode_literals, print_function
|
||||
import os
|
||||
import re
|
||||
import builtins
|
||||
import types
|
||||
from ast import AST, Module, Interactive, Expression
|
||||
from subprocess import Popen
|
||||
|
||||
import pytest
|
||||
|
||||
from xonsh import built_ins
|
||||
from xonsh.built_ins import (
|
||||
reglob,
|
||||
pathsearch,
|
||||
|
@ -20,7 +18,6 @@ from xonsh.built_ins import (
|
|||
list_of_strs_or_callables,
|
||||
list_of_list_of_strs_outer_product,
|
||||
regexsearch,
|
||||
globsearch,
|
||||
expand_path,
|
||||
convert_macro_arg,
|
||||
in_macro_call,
|
||||
|
@ -199,7 +196,7 @@ def test_convert_macro_arg_code(kind):
|
|||
assert isinstance(arg, types.CodeType)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("kind", [eval, None, "v", "eval"])
|
||||
@pytest.mark.parametrize("kind", [eval, "v", "eval"])
|
||||
def test_convert_macro_arg_eval(kind):
|
||||
# literals
|
||||
raw_arg = "42"
|
||||
|
@ -233,7 +230,7 @@ def test_convert_macro_arg_exec(kind):
|
|||
|
||||
|
||||
@pytest.mark.parametrize("kind", [type, "t", "type"])
|
||||
def test_convert_macro_arg_eval(kind):
|
||||
def test_convert_macro_arg_type(kind):
|
||||
# literals
|
||||
raw_arg = "42"
|
||||
arg = convert_macro_arg(raw_arg, kind, {}, None)
|
||||
|
@ -358,7 +355,7 @@ def test_call_macro_ast_eval_statement():
|
|||
return x
|
||||
|
||||
try:
|
||||
rtn = call_macro(f, ["x = 5"], {}, None)
|
||||
call_macro(f, ["x = 5"], {}, None)
|
||||
assert False
|
||||
except SyntaxError:
|
||||
# It doesn't make sense to pass a statement to
|
||||
|
@ -398,21 +395,21 @@ def test_cmds_to_specs_thread_subproc(xonsh_builtins):
|
|||
env = xonsh_builtins.__xonsh__.env
|
||||
cmds = [["pwd"]]
|
||||
# First check that threadable subprocs become threadable
|
||||
env['THREAD_SUBPROCS'] = True
|
||||
specs = cmds_to_specs(cmds, captured='hiddenobject')
|
||||
env["THREAD_SUBPROCS"] = True
|
||||
specs = cmds_to_specs(cmds, captured="hiddenobject")
|
||||
assert specs[0].cls is PopenThread
|
||||
# turn off threading and check we use Popen
|
||||
env['THREAD_SUBPROCS'] = False
|
||||
specs = cmds_to_specs(cmds, captured='hiddenobject')
|
||||
env["THREAD_SUBPROCS"] = False
|
||||
specs = cmds_to_specs(cmds, captured="hiddenobject")
|
||||
assert specs[0].cls is Popen
|
||||
|
||||
# now check the threadbility of callable aliases
|
||||
cmds = [[lambda: "Keras Selyrian"]]
|
||||
# check that threadable alias become threadable
|
||||
env['THREAD_SUBPROCS'] = True
|
||||
specs = cmds_to_specs(cmds, captured='hiddenobject')
|
||||
env["THREAD_SUBPROCS"] = True
|
||||
specs = cmds_to_specs(cmds, captured="hiddenobject")
|
||||
assert specs[0].cls is ProcProxyThread
|
||||
# turn off threading and check we use ProcProxy
|
||||
env['THREAD_SUBPROCS'] = False
|
||||
specs = cmds_to_specs(cmds, captured='hiddenobject')
|
||||
env["THREAD_SUBPROCS"] = False
|
||||
specs = cmds_to_specs(cmds, captured="hiddenobject")
|
||||
assert specs[0].cls is ProcProxy
|
||||
|
|
|
@ -3,15 +3,12 @@
|
|||
from __future__ import unicode_literals, print_function
|
||||
|
||||
from contextlib import contextmanager
|
||||
from functools import wraps
|
||||
import os
|
||||
import builtins
|
||||
|
||||
import pytest
|
||||
import pytest # noqa F401
|
||||
|
||||
from xonsh import dirstack
|
||||
from xonsh.environ import Env
|
||||
from xonsh.built_ins import load_builtins
|
||||
|
||||
|
||||
HERE = os.path.abspath(os.path.dirname(__file__))
|
||||
|
@ -86,7 +83,7 @@ def test_cdpath_events(xonsh_builtins, tmpdir):
|
|||
old_dir = os.getcwd()
|
||||
try:
|
||||
dirstack.cd([target])
|
||||
except:
|
||||
except Exception:
|
||||
raise
|
||||
else:
|
||||
assert (old_dir, target) == ev
|
||||
|
@ -109,7 +106,7 @@ def test_cd_autopush(xonsh_builtins, tmpdir):
|
|||
assert target == os.getcwd()
|
||||
assert old_ds_size + 1 == len(dirstack.DIRSTACK)
|
||||
dirstack.popd([])
|
||||
except:
|
||||
except Exception:
|
||||
raise
|
||||
finally:
|
||||
while len(dirstack.DIRSTACK) > old_ds_size:
|
||||
|
|
|
@ -2,17 +2,13 @@
|
|||
"""Testing dirstack"""
|
||||
# from __future__ import unicode_literals, print_function
|
||||
|
||||
from contextlib import contextmanager
|
||||
from functools import wraps
|
||||
import os
|
||||
import os.path
|
||||
import subprocess
|
||||
|
||||
import builtins
|
||||
import pytest
|
||||
from xonsh import dirstack
|
||||
from xonsh.environ import Env
|
||||
from xonsh.built_ins import load_builtins
|
||||
from xonsh.dirstack import DIRSTACK
|
||||
from xonsh.platform import ON_WINDOWS
|
||||
from xonsh.dirstack import _unc_tempDrives
|
||||
|
@ -180,7 +176,7 @@ def test_uncpushd_push_other_push_same(xonsh_builtins, shares_setup):
|
|||
assert len(DIRSTACK) == 1
|
||||
|
||||
dirstack.pushd([r"\\localhost\uncpushd_test_PARENT"])
|
||||
wd = os.getcwd()
|
||||
os.getcwd()
|
||||
assert os.getcwd().casefold() == TEMP_DRIVE[2] + "\\"
|
||||
assert len(_unc_tempDrives) == 2
|
||||
assert len(DIRSTACK) == 2
|
||||
|
@ -235,7 +231,7 @@ def with_unc_check_enabled():
|
|||
try:
|
||||
wval, wtype = winreg.QueryValueEx(key, "DisableUNCCheck")
|
||||
old_wval = wval # if values was defined at all
|
||||
except OSError as e:
|
||||
except OSError:
|
||||
pass
|
||||
winreg.SetValueEx(key, "DisableUNCCheck", None, winreg.REG_DWORD, 0)
|
||||
winreg.CloseKey(key)
|
||||
|
@ -267,7 +263,7 @@ def with_unc_check_disabled(): # just like the above, but value is 1 to *disabl
|
|||
try:
|
||||
wval, wtype = winreg.QueryValueEx(key, "DisableUNCCheck")
|
||||
old_wval = wval # if values was defined at all
|
||||
except OSError as e:
|
||||
except OSError:
|
||||
pass
|
||||
winreg.SetValueEx(key, "DisableUNCCheck", None, winreg.REG_DWORD, 1)
|
||||
winreg.CloseKey(key)
|
||||
|
|
|
@ -2,11 +2,9 @@
|
|||
"""Tests the xonsh environment."""
|
||||
from __future__ import unicode_literals, print_function
|
||||
import os
|
||||
import tempfile
|
||||
import builtins
|
||||
import itertools
|
||||
from tempfile import TemporaryDirectory
|
||||
from xonsh.tools import ON_WINDOWS, always_true
|
||||
from xonsh.tools import always_true
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -289,7 +287,7 @@ def test_delitem():
|
|||
assert env["VAR"] == "a value"
|
||||
del env["VAR"]
|
||||
with pytest.raises(Exception):
|
||||
a = env["VAR"]
|
||||
env["VAR"]
|
||||
|
||||
|
||||
def test_delitem_default():
|
||||
|
@ -335,7 +333,7 @@ def test_lscolors_events(key_in, old_in, new_in, test, xonsh_builtins):
|
|||
xonsh_builtins.__xonsh__.env["LS_COLORS"] = lsc
|
||||
|
||||
if new_in is None:
|
||||
old = lsc.pop(key_in, "argle")
|
||||
lsc.pop(key_in, "argle")
|
||||
else:
|
||||
lsc[key_in] = new_in
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ from __future__ import unicode_literals, print_function
|
|||
import os
|
||||
import subprocess
|
||||
|
||||
import pytest
|
||||
import pytest # noqa F401
|
||||
from tools import skip_if_on_windows, skip_if_on_unix
|
||||
|
||||
from xonsh.foreign_shells import foreign_shell_data, parse_env, parse_aliases
|
||||
|
|
|
@ -112,7 +112,7 @@ def test_cmd_field(hist, xonsh_builtins):
|
|||
assert hf is None
|
||||
assert 1 == hist.rtns[0]
|
||||
assert 1 == hist.rtns[-1]
|
||||
assert None == hist.outs[-1]
|
||||
assert hist.outs[-1] is None
|
||||
# slice
|
||||
assert [1] == hist.rtns[:]
|
||||
# on disk
|
||||
|
@ -120,7 +120,7 @@ def test_cmd_field(hist, xonsh_builtins):
|
|||
assert hf is not None
|
||||
assert 1 == hist.rtns[0]
|
||||
assert 1 == hist.rtns[-1]
|
||||
assert None == hist.outs[-1]
|
||||
assert hist.outs[-1] is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
|
@ -16,7 +16,7 @@ imphooks.install_import_hooks()
|
|||
|
||||
@pytest.fixture(autouse=True)
|
||||
def imp_env(xonsh_builtins):
|
||||
execer = Execer(unload=False)
|
||||
Execer(unload=False)
|
||||
builtins.__xonsh__.env = Env({"PATH": [], "PATHEXT": []})
|
||||
yield
|
||||
unload_builtins()
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import os
|
||||
import sys
|
||||
import time
|
||||
import shutil
|
||||
import tempfile
|
||||
import subprocess as sp
|
||||
|
@ -8,13 +7,10 @@ import subprocess as sp
|
|||
import pytest
|
||||
|
||||
import xonsh
|
||||
from xonsh.platform import ON_WINDOWS
|
||||
from xonsh.lib.os import indir
|
||||
|
||||
from tools import (
|
||||
skip_if_on_windows,
|
||||
skip_if_on_darwin,
|
||||
skip_if_on_travis,
|
||||
ON_WINDOWS,
|
||||
ON_DARWIN,
|
||||
ON_TRAVIS,
|
||||
|
@ -419,6 +415,49 @@ else:
|
|||
"Var foo\n",
|
||||
0,
|
||||
),
|
||||
#
|
||||
# test logical subprocess operators
|
||||
#
|
||||
(
|
||||
"""
|
||||
def _echo(args):
|
||||
print(' '.join(args))
|
||||
aliases['echo'] = _echo
|
||||
|
||||
echo --version and echo a
|
||||
echo --version && echo a
|
||||
echo --version or echo a
|
||||
echo --version || echo a
|
||||
echo -+version and echo a
|
||||
echo -+version && echo a
|
||||
echo -+version or echo a
|
||||
echo -+version || echo a
|
||||
echo -~version and echo a
|
||||
echo -~version && echo a
|
||||
echo -~version or echo a
|
||||
echo -~version || echo a
|
||||
""",
|
||||
"""--version
|
||||
a
|
||||
--version
|
||||
a
|
||||
--version
|
||||
--version
|
||||
-+version
|
||||
a
|
||||
-+version
|
||||
a
|
||||
-+version
|
||||
-+version
|
||||
-~version
|
||||
a
|
||||
-~version
|
||||
a
|
||||
-~version
|
||||
-~version
|
||||
""",
|
||||
0,
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
|
@ -557,6 +596,7 @@ def test_redirect_out_to_file(cmd, exp, tmpdir):
|
|||
@skip_if_no_xonsh
|
||||
@skip_if_no_sleep
|
||||
@skip_if_on_windows
|
||||
@pytest.mark.xfail(strict=False) # TODO: fixme (super flaky on OSX)
|
||||
def test_xonsh_no_close_fds():
|
||||
# see issue https://github.com/xonsh/xonsh/issues/2984
|
||||
makefile = (
|
||||
|
@ -578,10 +618,7 @@ def test_xonsh_no_close_fds():
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"cmd, fmt, exp",
|
||||
[
|
||||
("ls | wc", lambda x: x > '', True),
|
||||
],
|
||||
"cmd, fmt, exp", [("ls | wc", lambda x: x > "", True),], # noqa E231 (black removes space)
|
||||
)
|
||||
def test_pipe_between_subprocs(cmd, fmt, exp):
|
||||
"verify pipe between subprocesses doesn't throw an exception"
|
||||
|
@ -593,8 +630,8 @@ def test_negative_exit_codes_fail():
|
|||
# see issue 3309
|
||||
script = 'python -c "import os; os.abort()" && echo OK\n'
|
||||
out, err, rtn = run_xonsh(script)
|
||||
assert "OK" is not out
|
||||
assert "OK" is not err
|
||||
assert "OK" != out
|
||||
assert "OK" != err
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
|
@ -11,4 +11,3 @@ def test_list():
|
|||
|
||||
def test_string():
|
||||
assert as_iterable("my string") == ("my string",)
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import sys
|
|||
|
||||
import xonsh.main
|
||||
from xonsh.main import XonshMode
|
||||
from xonsh.environ import Env
|
||||
import pytest
|
||||
from tools import TEST_DIR, skip_if_on_windows
|
||||
|
||||
|
@ -77,7 +76,7 @@ def test_no_rc_with_script(shell, tmpdir):
|
|||
|
||||
|
||||
def test_force_interactive_rc_with_script(shell, tmpdir):
|
||||
args = xonsh.main.premain(["-i", "tests/sample.xsh"])
|
||||
xonsh.main.premain(["-i", "tests/sample.xsh"])
|
||||
assert builtins.__xonsh__.env.get("XONSH_INTERACTIVE")
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
|
||||
import pytest # noqa F401
|
||||
from xonsh.completers.man import complete_from_man
|
||||
|
||||
from tools import skip_if_on_windows
|
||||
|
|
|
@ -34,7 +34,7 @@ def test_mpl_preserve_font_size():
|
|||
f = create_figure()
|
||||
width, height = f.canvas.get_width_height()
|
||||
print(width, height)
|
||||
s = mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, True)
|
||||
mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, True)
|
||||
exp = FONT_SIZE
|
||||
obs = matplotlib.rcParams["font.size"]
|
||||
plt.close(f)
|
||||
|
@ -46,7 +46,7 @@ def test_mpl_preserve_face_color():
|
|||
"""Make sure that the figure preserves face color settings"""
|
||||
f = create_figure()
|
||||
width, height = f.canvas.get_width_height()
|
||||
s = mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, True)
|
||||
mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, True)
|
||||
exp = FACE_COLOR
|
||||
obs = f.get_facecolor()
|
||||
plt.close(f)
|
||||
|
@ -58,7 +58,7 @@ def test_mpl_preserve_width():
|
|||
"""Make sure that the figure preserves width settings"""
|
||||
f = create_figure()
|
||||
width, height = f.canvas.get_width_height()
|
||||
s = mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, True)
|
||||
mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, True)
|
||||
exp = width
|
||||
newwidth, newheight = f.canvas.get_width_height()
|
||||
obs = newwidth
|
||||
|
@ -71,7 +71,7 @@ def test_mpl_preserve_height():
|
|||
"""Make sure that the figure preserves height settings"""
|
||||
f = create_figure()
|
||||
width, height = f.canvas.get_width_height()
|
||||
s = mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, True)
|
||||
mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, True)
|
||||
exp = height
|
||||
newwidth, newheight = f.canvas.get_width_height()
|
||||
obs = newheight
|
||||
|
@ -83,7 +83,7 @@ def test_mpl_preserve_dpi():
|
|||
"""Make sure that the figure preserves height settings"""
|
||||
f = create_figure()
|
||||
width, height = f.canvas.get_width_height()
|
||||
s = mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, False)
|
||||
mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, False)
|
||||
exp = DPI
|
||||
obs = f.dpi
|
||||
plt.close(f)
|
||||
|
@ -96,7 +96,7 @@ def test_mpl_preserve_image_tight():
|
|||
f = create_figure()
|
||||
exp = mplhooks.figure_to_rgb_array(f)
|
||||
width, height = f.canvas.get_width_height()
|
||||
s = mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, True)
|
||||
mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, True)
|
||||
obs = mplhooks.figure_to_rgb_array(f)
|
||||
plt.close(f)
|
||||
assert np.all(exp == obs)
|
||||
|
@ -107,7 +107,7 @@ def test_mpl_preserve_standard():
|
|||
f = create_figure()
|
||||
exp = mplhooks.figure_to_rgb_array(f)
|
||||
width, height = f.canvas.get_width_height()
|
||||
s = mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, False)
|
||||
mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, False)
|
||||
obs = mplhooks.figure_to_rgb_array(f)
|
||||
plt.close(f)
|
||||
assert np.all(exp == obs)
|
||||
|
|
|
@ -7,7 +7,7 @@ import itertools
|
|||
|
||||
import pytest
|
||||
|
||||
from xonsh.ast import AST, With, Pass, pdump, Str, Call
|
||||
from xonsh.ast import AST, With, Pass, Str, Call
|
||||
from xonsh.parser import Parser
|
||||
from xonsh.parsers.base import eval_fstr_fields
|
||||
|
||||
|
@ -2706,7 +2706,6 @@ def test_arg_single_subprocbang(opener, closer, body):
|
|||
"body", ["echo -n!x", "echo -n!x", "echo -n !x", "echo -n ! x"]
|
||||
)
|
||||
def test_arg_single_subprocbang_nested(opener, closer, ipener, iloser, body):
|
||||
code = opener + "echo " + ipener + body + iloser + closer
|
||||
tree = check_xonsh_ast({}, opener + body + closer, False, return_obs=True)
|
||||
assert isinstance(tree, AST)
|
||||
cmd = tree.body.args[0].elts
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
import builtins
|
||||
|
||||
import pytest
|
||||
from unittest.mock import patch
|
||||
|
||||
from xonsh.environ import Env
|
||||
import xonsh.completers.path as xcp
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Test XonshLexer for pygments"""
|
||||
|
||||
import os
|
||||
import gc
|
||||
import builtins
|
||||
|
||||
|
@ -21,7 +20,6 @@ from tools import skip_if_on_windows
|
|||
|
||||
from xonsh.platform import ON_WINDOWS
|
||||
from xonsh.built_ins import load_builtins, unload_builtins
|
||||
from xonsh.execer import Execer
|
||||
from xonsh.pyghooks import XonshLexer, Color, XonshStyle, on_lscolors_change
|
||||
from xonsh.environ import LsColors
|
||||
from xonsh.events import events, EventManager
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Test initialization of prompt_toolkit shell"""
|
||||
|
||||
import os
|
||||
import gc
|
||||
import builtins
|
||||
|
||||
import pytest
|
||||
|
||||
from tools import skip_if_on_windows
|
||||
|
||||
from xonsh.platform import ON_WINDOWS, minimum_required_ptk_version
|
||||
|
||||
from xonsh.ptk_shell.shell import PromptToolkitShell
|
||||
from xonsh.platform import minimum_required_ptk_version
|
||||
|
||||
# verify error if ptk not installed or below min
|
||||
|
||||
import warnings
|
||||
import xonsh.platform
|
||||
from xonsh.shell import Shell
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""Tests pygments hooks."""
|
||||
import pytest
|
||||
import os
|
||||
import builtins
|
||||
import stat
|
||||
|
||||
from tempfile import TemporaryDirectory
|
||||
|
@ -11,13 +10,12 @@ from xonsh.pyghooks import (
|
|||
Color,
|
||||
color_name_to_pygments_code,
|
||||
code_by_name,
|
||||
color_by_name,
|
||||
color_file,
|
||||
file_color_tokens,
|
||||
)
|
||||
|
||||
from xonsh.environ import LsColors
|
||||
from tools import skip_if_on_windows, skip_if_on_unix
|
||||
from tools import skip_if_on_windows
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -199,7 +197,7 @@ def colorizable_files():
|
|||
else:
|
||||
file_path = tempdir + "/" + v
|
||||
try:
|
||||
mode = os.lstat(file_path)
|
||||
os.lstat(file_path)
|
||||
except FileNotFoundError:
|
||||
if file_path.endswith("_dir"):
|
||||
os.mkdir(file_path)
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import builtins
|
||||
|
||||
import pytest
|
||||
|
||||
from xonsh.completers.python import python_signature_complete
|
||||
|
|
|
@ -76,7 +76,7 @@ from xonsh.tools import (
|
|||
)
|
||||
from xonsh.environ import Env
|
||||
|
||||
from tools import skip_if_on_windows, skip_if_on_unix
|
||||
from tools import skip_if_on_windows
|
||||
|
||||
LEXER = Lexer()
|
||||
LEXER.build()
|
||||
|
@ -938,7 +938,7 @@ def test_env_path_with_pathlib_path_objects(inp, exp, xonsh_builtins):
|
|||
|
||||
|
||||
@pytest.mark.parametrize("inp", ["42.0", [42.0]])
|
||||
def test_is_nonstring_seq_of_strings_false(inp):
|
||||
def test_is_nonstring_seq_of_strings_false1(inp):
|
||||
assert not is_nonstring_seq_of_strings(inp)
|
||||
|
||||
|
||||
|
@ -1020,12 +1020,12 @@ def test_env_path_keep_only_non_home_paths(inp, exp):
|
|||
|
||||
@pytest.mark.parametrize("inp", [True, False])
|
||||
def test_is_bool_true(inp):
|
||||
assert True == is_bool(inp)
|
||||
assert is_bool(inp)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("inp", [1, "yooo hooo!"])
|
||||
def test_is_bool_false(inp):
|
||||
assert False == is_bool(inp)
|
||||
assert not is_bool(inp)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
@ -1148,7 +1148,7 @@ def test_get_portions(inp, exp):
|
|||
)
|
||||
def test_ensure_slice_invalid(inp):
|
||||
with pytest.raises(ValueError):
|
||||
obs = ensure_slice(inp)
|
||||
ensure_slice(inp)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
|
@ -237,7 +237,6 @@ def test_autovox(xonsh_builtins, tmpdir):
|
|||
Tests that autovox works
|
||||
"""
|
||||
import importlib
|
||||
from xonsh.lib import subprocess
|
||||
import xonsh.dirstack
|
||||
|
||||
# Set up an isolated venv home
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
from __future__ import unicode_literals, print_function
|
||||
import os
|
||||
|
||||
import pytest
|
||||
import pytest # noqa F401
|
||||
|
||||
from xonsh.wizard import (
|
||||
Node,
|
||||
Wizard,
|
||||
Pass,
|
||||
PrettyFormatter,
|
||||
|
|
|
@ -77,4 +77,3 @@ hello = 'world'
|
|||
|
||||
ctx = xontrib_context("script")
|
||||
assert ctx == {"hello": "world"}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
__version__ = "0.9.17"
|
||||
__version__ = "0.9.18"
|
||||
|
||||
|
||||
# amalgamate exclude jupyter_kernel parser_table parser_test_table pyghooks
|
||||
|
|
|
@ -299,9 +299,13 @@ def complete_path(prefix, line, start, end, ctx, cdpath=True, filtfunc=None):
|
|||
# see above functions for details.
|
||||
p = _splitpath(os.path.expanduser(prefix))
|
||||
if len(p) != 0:
|
||||
if p[0] == "":
|
||||
basedir = ("",)
|
||||
p = p[1:]
|
||||
relative_char = ["", ".", ".."]
|
||||
if p[0] in relative_char:
|
||||
i = 0
|
||||
while p[i] in relative_char:
|
||||
i += 1
|
||||
basedir = p[:i]
|
||||
p = p[i:]
|
||||
else:
|
||||
basedir = None
|
||||
matches_so_far = {basedir}
|
||||
|
|
|
@ -9,12 +9,12 @@ import xonsh.lazyasd as xl
|
|||
|
||||
@xl.lazyobject
|
||||
def PIP_RE():
|
||||
return re.compile(r"\bx?pip(?:\d|\.)*")
|
||||
return re.compile(r"\bx?pip(?:\d|\.)*\b")
|
||||
|
||||
|
||||
@xl.lazyobject
|
||||
def PIP_LIST_RE():
|
||||
return re.compile(r"\bx?pip(?:\d|\.)* (?:uninstall|show)")
|
||||
return re.compile(r"\bx?pip(?:\d|\.)*\b (?:uninstall|show)")
|
||||
|
||||
|
||||
@xl.lazyobject
|
||||
|
|
|
@ -7,6 +7,7 @@ import functools
|
|||
import json
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
|
||||
from xonsh.history.base import History
|
||||
from xonsh.history.dummy import DummyHistory
|
||||
|
@ -223,7 +224,7 @@ def _XH_HISTORY_SESSIONS():
|
|||
}
|
||||
|
||||
|
||||
_XH_MAIN_ACTIONS = {"show", "id", "file", "info", "diff", "gc"}
|
||||
_XH_MAIN_ACTIONS = {"show", "id", "file", "info", "diff", "gc", "flush"}
|
||||
|
||||
|
||||
@functools.lru_cache()
|
||||
|
@ -349,6 +350,9 @@ def _xh_create_parser():
|
|||
xrp.replay_create_parser(p=replay)
|
||||
_XH_MAIN_ACTIONS.add("replay")
|
||||
|
||||
# 'flush' subcommand
|
||||
subp.add_parser("flush", help="flush the current history to disk")
|
||||
|
||||
return p
|
||||
|
||||
|
||||
|
@ -413,5 +417,9 @@ def history_main(
|
|||
import xonsh.replay as xrp
|
||||
|
||||
xrp.replay_main_action(hist, ns, stdout=stdout, stderr=stderr)
|
||||
elif ns.action == "flush":
|
||||
hf = hist.flush()
|
||||
if isinstance(hf, threading.Thread):
|
||||
hf.join()
|
||||
else:
|
||||
print("Unknown history action {}".format(ns.action), file=sys.stderr)
|
||||
|
|
|
@ -2153,12 +2153,15 @@ class BaseParser(object):
|
|||
p[0] = p[1]
|
||||
|
||||
def p_factor_unary(self, p):
|
||||
"""factor : PLUS factor
|
||||
| MINUS factor
|
||||
| TILDE factor
|
||||
"""factor : plus_tok factor
|
||||
| minus_tok factor
|
||||
| tilde_tok factor
|
||||
"""
|
||||
op = self._factor_ops[p[1]]()
|
||||
p[0] = ast.UnaryOp(op=op, operand=p[2], lineno=self.lineno, col_offset=self.col)
|
||||
p1 = p[1]
|
||||
op = self._factor_ops[p1.value]()
|
||||
p[0] = ast.UnaryOp(
|
||||
op=op, operand=p[2], lineno=self.lineno, col_offset=p1.lexpos
|
||||
)
|
||||
|
||||
def p_power_atom(self, p):
|
||||
"""power : atom_expr"""
|
||||
|
|
|
@ -71,7 +71,7 @@ def insert_into_xonshrc(
|
|||
# compute new values
|
||||
new = config_to_xonsh(config, prefix=prefix, suffix=suffix)
|
||||
# write out the file
|
||||
with open(fname, "w") as f:
|
||||
with open(fname, "w", encoding="utf-8") as f:
|
||||
f.write(before + new + after)
|
||||
return fname
|
||||
|
||||
|
|
|
@ -73,14 +73,27 @@
|
|||
"In many cases, these may have a lower performance overhead than the ",
|
||||
"posix command line utility with the same name. This is because these ",
|
||||
"tools avoid the need for a full subprocess call. Additionally, these ",
|
||||
"tools are cross-platform."]
|
||||
"tools are cross-platform."
|
||||
]
|
||||
},
|
||||
{"name": "direnv",
|
||||
{
|
||||
"name": "direnv",
|
||||
"package": "xonsh-direnv",
|
||||
"url": "https://github.com/74th/xonsh-direnv",
|
||||
"description": ["Supports direnv."]
|
||||
"description": [
|
||||
"Supports direnv."
|
||||
]
|
||||
},
|
||||
{"name": "distributed",
|
||||
{
|
||||
"name": "hist_navigator",
|
||||
"package": "xontrib-hist-navigator",
|
||||
"url": "https://github.com/jnoortheen/xontrib-hist-navigator",
|
||||
"description": [
|
||||
"Move through directory history with nextd and prevd also with keybindings."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "distributed",
|
||||
"package": "xonsh",
|
||||
"url": "http://xon.sh",
|
||||
"description": [
|
||||
|
@ -95,7 +108,8 @@
|
|||
" x = $(echo I am elsewhere)\n\n",
|
||||
" res = dsub.future.result()\n",
|
||||
" print(res)\n\n",
|
||||
"This is useful for long running or non-blocking jobs."]
|
||||
"This is useful for long running or non-blocking jobs."
|
||||
]
|
||||
},
|
||||
{"name": "docker_tabcomplete",
|
||||
"package": "xonsh-docker-tabcomplete",
|
||||
|
@ -145,7 +159,7 @@
|
|||
"that displays the current figure on the screen."]
|
||||
},
|
||||
{"name": "output_search",
|
||||
"package": "git+https://github.com/anki-code/xontrib-output-search.git",
|
||||
"package": "xontrib-output-search",
|
||||
"url": "https://github.com/anki-code/xontrib-output-search",
|
||||
"description": ["Get identifiers, names, paths, URLs and words from the previous command output ",
|
||||
"and use them for the next command."]
|
||||
|
@ -190,6 +204,16 @@
|
|||
"url": "https://github.com/dyuri/xontrib-ssh-agent",
|
||||
"description": ["ssh-agent integration"]
|
||||
},
|
||||
{"name": "prompt_bar",
|
||||
"package": "xontrib-prompt-bar",
|
||||
"url": "https://github.com/anki-code/xontrib-prompt-bar",
|
||||
"description": ["An elegance bar style for prompt."]
|
||||
},
|
||||
{"name": "pipeliner",
|
||||
"package": "xontrib-pipeliner",
|
||||
"url": "https://github.com/anki-code/xontrib-pipeliner",
|
||||
"description": ["Easily process the lines using pipes."]
|
||||
},
|
||||
{"name": "vox",
|
||||
"package": "xonsh",
|
||||
"url": "http://xon.sh",
|
||||
|
|
Loading…
Add table
Reference in a new issue