diff -Nru xonsh-0.5.12+dfsg/amalgamate.py xonsh-0.6.0+dfsg/amalgamate.py --- xonsh-0.5.12+dfsg/amalgamate.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/amalgamate.py 2017-11-23 00:23:47.000000000 +0000 @@ -386,9 +386,9 @@ for n in a.names: p, dot, m = n.name.rpartition('.') if p == pkg and m in order: - msg = ('Cannot amalgamate almagate import of ' - 'amalgamated module:\n\n import {0}.{1}\n' - '\nin {0}/{2}.py').format(pkg, n.name, name) + msg = ('Cannot amalgamate import of amalgamated module:' + '\n\n import {0}.{1}\n\nin {0}/{2}.py').format( + pkg, n.name, name) raise RuntimeError(msg) imp = (Import, n.name, n.asname) if imp not in imps: diff -Nru xonsh-0.5.12+dfsg/.appveyor.yml xonsh-0.6.0+dfsg/.appveyor.yml --- xonsh-0.5.12+dfsg/.appveyor.yml 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/.appveyor.yml 2017-11-23 00:23:47.000000000 +0000 @@ -1,4 +1,4 @@ -version: 0.5.12.{build} +version: 0.6.0.{build} os: Windows Server 2012 R2 environment: diff -Nru xonsh-0.5.12+dfsg/appveyor.yml xonsh-0.6.0+dfsg/appveyor.yml --- xonsh-0.5.12+dfsg/appveyor.yml 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/appveyor.yml 2017-11-23 00:23:47.000000000 +0000 @@ -1,4 +1,4 @@ -version: 0.5.12.{build} +version: 0.6.0.{build} os: Windows Server 2012 R2 environment: diff -Nru xonsh-0.5.12+dfsg/CHANGELOG.rst xonsh-0.6.0+dfsg/CHANGELOG.rst --- xonsh-0.5.12+dfsg/CHANGELOG.rst 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/CHANGELOG.rst 2017-11-23 00:23:47.000000000 +0000 @@ -4,6 +4,91 @@ .. current developments +v0.6.0 +==================== + +**Added:** + +* Added an alias command, matching bash's implementation, available as part of bashisms. +* New ``$AUTO_SUGGEST_IN_COMPLETIONS`` environment variable that enables/disables + whether the auto-suggestion result appears in the tab completions. +* Added ``__add__()`` and ``__radd__()`` methods to ``EnvPath``. +* Xonsh now supports f-strings, as in Python v3.6+. +* Added ``ipython`` as unthreadable in command cache threadabilty predictors. +* Added ``whole_word_jumping`` xontrib +* Added ``$XONSH_APPEND_NEWLINE`` environment variable +* Support for PEP 515: Underscores in Numeric Literals +* ``xonsh.color_tools.make_palette()`` + + Simple rename of the pre-existing + ``xonsh.color_tools.make_pallete()`` function. + +* ``xonsh.tools.decorator()`` function/method decorator. + + This allows for an API function to be annotated with a + decorator that documents deprecation, while also tying in + functionality that will warn a user that the function has + been deprecated, and, raise an ``AssertionError`` if the + function has passed its expiry date. +* New xontrib ``schedule`` (Xonsh Task Scheduler) + + +**Changed:** + +* ``on_pre_prompt`` is now fired before prompt calculations are made, allowing modifications to the prompt. +* ``emacsclient`` will now return false in the threadable predictors. +* Improved the autopair behavior to match that of popular code editors. +* Moved the lazy ``pkg_resources`` package back to its original + place. The will hopefully address some of the slowdown issues + experiances on some platforms. +* When xonsh is used to run an ``xsh`` script, the ``xonshrc`` is not loaded +* Change in the behavior of the default predictor with binary analysis. The pattern ``libgpm`` is use, assuming when ``gpm`` is used the program is not threadable. This change solves issues with programs as ``links``. +* Error messages added to the ``source`` command if it is used with a language + that is not xonsh or Python. + + +**Deprecated:** + +* ``xonsh.color_tools.make_pallette()`` + + Deprecated in release 0.5.10 and will be removed in release 0.6.0. + + +**Fixed:** + +* Now f-strings can be used inside @() without explicit enclosing command in ![] +* Fix for ``x, y, *z = ...`` unpacking. +* Git branch detection now correctly passes the environment down to the subprocess + call. This allows for branch detection when git is installed into a non-standard + location. +* Escape regex characters in ``path_complete`` to avoid regex parsing errors for + certain combinations of characters in path completer +* gistatus: Fixed hash not being shown when in detaced HEAD and there are no tags +* Fix branch colorization when ``git`` or ``hg`` are aliases. +* Fixed leftover ``.git/index.lock`` in ``gitstatus`` +* Made JSON history loading more robust to corrupt files. +* Starting a new command with an open parentheses will no longer + throw a traceback when ``$UPDATE_COMPLETIONS_ON_KEYPRESS`` is + ``True``. +* Automatically wrapping subprocess calls would sometimes include + semincolons and other line-ending tokens, rather than stopping at them. + This has been fixed. +* Numerous spelling errors in documentation, docstrings/comments, text + strings and local variable names. + +* Spelling error in the ``xonsh.color_tools.make_pallete()`` public + function declaration. This was fixed by renaming the function to + ``xonsh.color_tools.make_palette()`` while maintaining a binding + of ``make_pallete()`` to the new ``make_palette()`` in case users + are already used to this API. +* Fixed issue with starting triple quote strings being run as a command. +* Fixed a problem with escaping charet (^) character for cmd.exe in the source-cmd function. +* ``EOF in multi-line statement`` errors were misreported as being on line 0. + Now they are correctly reported as being on the last line of the file. + + + + v0.5.12 ==================== @@ -39,9 +124,9 @@ * Pretty printing of the $PATH variable * Add "fzf-widgets" xontrib which provides fuzzy search productivity widgets with on custom keybindings to xontrib list. -* New ``free_cwd`` xontrib for Windows, which prevent the current directory from beeing locked when the prompt is shown. +* New ``free_cwd`` xontrib for Windows, which prevent the current directory from being locked when the prompt is shown. This allows the other programs or Windows explorer to delete the current or parent directory. This is accomplished by - reseting the CWD to the users home directory temporarily while the prompt is displayed. The directory is still locked + resetting the CWD to the users home directory temporarily while the prompt is displayed. The directory is still locked while any commands are processed so xonsh still can't remove it own working directory. @@ -63,8 +148,8 @@ in the ``xonshrc`` file. * Fixed a regression in the Windows ``sudo`` command, that allows users to run elevated commands in xonsh. * Fix echo command from xoreutils. -* Fixed a bug on Windows which meant xonsh wasn't using PATH enrivonment variable but instead relying on a default - value from the widnows registry. +* Fixed a bug on Windows which meant xonsh wasn't using PATH environment variable but instead relying on a default + value from the windows registry. @@ -100,7 +185,7 @@ **Changed:** -* The ``xonsh.platform.os_environ`` wrapper is now case-insesitive and +* The ``xonsh.platform.os_environ`` wrapper is now case-insensitive and case-preserving on Windows. * The private ``_TeeStd`` class will no longer attempt to write to a standard buffer after the tee has been 'closed' and the standard @@ -115,7 +200,7 @@ * Fixed a bug if foreign_shell name was not written in lower case in the static configuration file ``config.json`` * Fixed a regression on Windows where caused ``which`` reported that the - ``PATH`` envrionment variable could not be found. + ``PATH`` environment variable could not be found. * Fixed issue with foregrounding jobs that were started in the background. * Fixed that ``Ctrl-C`` crashes xonsh after running an invalid command. * Fixed an potential ``ProcessLookupError`` issue, see #2288. @@ -129,7 +214,7 @@ **Added:** * New ``color_tools`` module provides basic color tools for converting - to and from various formats as well as creating pallettes from color + to and from various formats as well as creating palettes from color strings. * Redirections may now be used in string and list-of-strings aliases. @@ -155,7 +240,7 @@ prior to running the next command. * Line continuation backslashes are respected on Windows in the PTK shell if the backspace is is preceded by a space. -* Added ``ponysay`` as a command which will ususally not run in a +* Added ``ponysay`` as a command which will usually not run in a threaded mode in the commands cache. * New ``jsonutils`` module available for serializing special xonsh objects to JSON. @@ -165,7 +250,7 @@ * The literal tokens ``and`` and ``or`` must be surrounded by whitespace to delimit subprocess mode. If they do not have - whitespace on both sides in subproc mode, they are condisered + whitespace on both sides in subproc mode, they are considered to be part of a command argument. * The ``xontrib`` command is now flagged as unthreadable and will be run on the main Python thread. This allows xontribs to set signal @@ -206,8 +291,8 @@ able to be used in xonsh. These styles are dynamically created upon first use, rather than being lazily loaded by xonsh. * On Windows, ``os.environ`` is case insensitive. This would potentially - change the case of envrionment variables set into the environment. - Xonsh now uses ``nt.envrion``, the case sensitive counterpart, to avoid + change the case of environment variables set into the environment. + Xonsh now uses ``nt.environ``, the case sensitive counterpart, to avoid these issues on Windows. * Fix how ``$PWD`` is managed in order to work with symlinks gracefully * ``history replay`` no longer barfs on ``style_name`` when setting up the @@ -218,7 +303,7 @@ * Certain vim commands issue commands involving subshells, and this is now supported. * Null bytes handed to Popen are now automatically escaped prior - to running a subprocess. This preevents Popen from issuing + to running a subprocess. This prevents Popen from issuing embedded null byte exceptions. * Xonsh will no longer crash is the current working directory is removed out from under it. @@ -230,9 +315,9 @@ preceded by a space on Windows. This only applies to xonsh in interactive mode to ensure scripts are portable. * Importing ``*.xsh`` files will now respect the encoding listed in - that file and properly fallback to UTF-8. This beahviour follows + that file and properly fallback to UTF-8. This behaviour follows the rules described in PEP 263. -* Wizard is now able to properly serialize envrionment paths. +* Wizard is now able to properly serialize environment paths. v0.5.6 @@ -248,7 +333,7 @@ * The ``trace`` will automatically disable color printing when stdout is not a TTY or stdout is captured. * New ``jedi`` xontrib enables jedi-based tab completions when it is loaded. - This supercedes xonsh's default Python-mode completer. + This supersedes xonsh's default Python-mode completer. * The lexer has a new ``split()`` method which splits strings according to xonsh's rules for whitespace and quotes. * New events for hooking into the Python import process are now available. @@ -265,31 +350,31 @@ **Changed:** * The prompt toolkit shell's first completion will now be the - current token from the auto-suggetion, if available. + current token from the auto-suggestion, if available. * Sourcing foreign shells will now safely skip applying aliases with the same name as existing xonsh aliases by default. - This prevents accitidentally overwriting important xonsh standard + This prevents accidentally overwriting important xonsh standard aliases, such as ``cd``. **Fixed:** -* Threadable predicition for subprocesses will now consult both the command +* Threadable prediction for subprocesses will now consult both the command as it was typed in and any resolved aliases. * The first prompt will no longer print in the middle of the line if the user has already started typing. * Windows consoles will now automatically enable virtual terminal processing with the readline shell, if available. This allows the full use of ANSI escape sequences. -* On the Windows readline shell, the teb-completion supression prompt will no +* On the Windows readline shell, the tab-completion suppression prompt will no longer error out depending on what you press. -* Fixed issue with subprocess mode wrapping not repecting line continuation +* Fixed issue with subprocess mode wrapping not respecting line continuation backslashes. * Handle a bug where Bash On Windows causes platform.windows_bash_command() to raise CalledProcessError. * Fixed issues pertaining to completing from raw string paths. This is particularly relevant to Windows, where raw strings - are instered in path completion. + are inserted in path completion. * Replace deprecated calls to ``time.clock()`` by calls to ``time.perf_counter()``. * Use ``clock()`` to set the start time of ``_timings`` in non-windows instead @@ -300,10 +385,10 @@ xonsh semantics, rather than just on whitespace using ``str.split()``. * The ``mpl`` xontrib has been updated to improve matplotlib handling. If ``xontrib load mpl`` is run before matplotlib - is imported and xonsh is in ineteractive mode, matplotlib + is imported and xonsh is in interactive mode, matplotlib will automatically enter interactive mode as well. Additionally, ``pyplot.show()`` is patched in interactive mode to be non-blocking. - If a non-blocking show fails to draw the figre for some reason, + If a non-blocking show fails to draw the figure for some reason, a regular blocking version is called. * Fixed issues like ``timeit ls`` causing OSError - "Inappropriate ioctl for device". @@ -336,7 +421,7 @@ of run control to a single entry point and loading system. * The ``xonsh.shell.Shell()`` class now requires that an Execer instance be explicitly provided to its init method. This class is no longer - responsible for creating an execer an its deprendencies. + responsible for creating an execer an its dependencies. * Moved decorators ``unthreadable``, ``uncapturable`` from ``xonsh.proc`` to ``xonsh.tools``. * Some refactorings on jobs control. @@ -358,15 +443,15 @@ **Fixed:** * Command pipelines that end in a callable alias are now interruptable with - ``^C`` and the processes that are piped into the alais have their file handles + ``^C`` and the processes that are piped into the alias have their file handles closed. This should ensure that the entire pipeline is closed. * Fixed issue where unthreadable subprocs were not allowed to be captured with the ``$(cmd)`` operator. * The ``ProcProxy`` class (unthreadable aliases) was not being executed and would - hange if the alias was capturable. This has been fixed. + hang if the alias was capturable. This has been fixed. * Fixed a ``tcsetattr: Interrupted system call`` issue when run xonsh scripts. * Fixed issue with ``ValueError`` being thrown from ``inspect.signature()`` - when called on C-extention callables in tab completer. + when called on C-extension callables in tab completer. * Fixed issue that ``ls | less`` crashes on Mac. * Threadable prediction was incorrectly based on the user input command, rather than the version where aliases have been resolved. This has been corrected. @@ -462,7 +547,7 @@ **Fixed:** * ``PopenThread`` will now re-issue SIGINT to the main thread when it is - recieved. + received. * Fixed an issue that using sqlite history backend does not kill unfinished jobs when quitting xonsh with a second "exit". * Fixed an issue that xonsh would fail over to external shells when @@ -472,7 +557,7 @@ server. See https://mail.python.org/pipermail/python-list/2013-June/650460.html for more details. * Restored the ability to ^Z and ``fg`` processes on posix platforms. -* CommandPipelines were not gauranteeded to have been ended when the return code +* CommandPipelines were not guaranteed to have been ended when the return code was requested. This has been fixed. * Introduce path expansion in ``is_writable_file`` to fix ``$XONSH_TRACEBACK_LOGFILE=~/xonsh.log``. @@ -541,11 +626,11 @@ * Added entry to customization faq re: tab completion selection (#1725) * Added entry to customization faq re: libgcc core dump (#1160) * Section about quoting in the tutorial. -* The ``$VC_HG_SHOW_BRANCH`` environement variable to control whether to hide the hg branch in the prompt. +* The ``$VC_HG_SHOW_BRANCH`` environment variable to control whether to hide the hg branch in the prompt. * xonfig now contains the latest git commit date if xonsh installed from source. * Alt+Enter will execute a multiline code block irrespective of cursor position -* Windows now has the ability to read output asyncronously from +* Windows now has the ability to read output asynchronously from the console. * Use `doctr `_ to deploy dev docs to github pages * New ``xonsh.proc.uncapturable()`` decorator for declaring that function @@ -553,12 +638,12 @@ * New history backend sqlite. * Prompt user to install xontrib package if they try to load an uninstalled xontrib -* Callable aliases may now take a final ``spec`` arguemnt, which is the - cooresponding ``SubprocSpec`` instance. +* Callable aliases may now take a final ``spec`` argument, which is the + corresponding ``SubprocSpec`` instance. * New ``bashisms`` xontrib provides additional Bash-like syntax, such as ``!!``. This xontrib only affects the command line, and not xonsh scripts. * Tests that create testing repos (git, hg) -* New subprocess specification class ``SubprocSpec`` is used for specifiying +* New subprocess specification class ``SubprocSpec`` is used for specifying and manipulating subprocess classes prior to execution. * New ``PopenThread`` class runs subprocesses on a a separate thread. * New ``CommandPipeline`` and ``HiddenCommandPipeline`` classes manage the @@ -574,11 +659,11 @@ ``f()``, ``f(args)``, ``f(args, stdin=None)``, ``f(args, stdin=None, stdout=None)``, and ` ``f(args, stdin=None, stdout=None, stderr=None)``. -* Uncaptured subprocesses now recieve a PTY file handle for stdout and +* Uncaptured subprocesses now receive a PTY file handle for stdout and stderr. * New ``$XONSH_PROC_FREQUENCY`` environment variable that specifies how long - loops in the subprocess framwork should sleep. This may be adjusted from - its default value to improved perfromance and mitigate "leaky" pipes on + loops in the subprocess framework should sleep. This may be adjusted from + its default value to improved performance and mitigate "leaky" pipes on slower machines. * ``Shift+Tab`` moves backwards in completion dropdown in prompt_toolkit * PromptFormatter class that holds all the related prompt methods @@ -674,7 +759,7 @@ * readline/ptk shells use PromptFormatter * Updated the bundled version of ``ply`` to current master available * vended ``ply`` is now a git subtree to help with any future updates -* ``WHITE`` color keyword now means lightgray and ``INTENSE_WHITE`` commpletely white +* ``WHITE`` color keyword now means lightgray and ``INTENSE_WHITE`` completely white * Removed ``add_to_shell`` doc section from ``*nix`` install pages and instead relocated it to the general customization page * Moved a few ``*nix`` customization tips from the linux install page to the general @@ -706,7 +791,7 @@ * Jupyter kernel installation now respects the setuptools ``root`` parameter. * Fix ``__repr__`` and ``__str__`` methods of ``SubprocSpec`` so they report correctly -* Fixed the meassage printed when which is unable to find the command. +* Fixed the message printed when which is unable to find the command. * Fixed a handful of sphinx errors and warnings in the docs * Fixed many PEP8 violations that had gone unnoticed * Fix failure to detect an Anaconda python distribution if the python was install from the conda-forge channel. @@ -720,7 +805,7 @@ * Added a minimum time buffer time for command pipelines to check for if previous commands have executed successfully. This is helpful for pipelines where the last command takes a long time to start up, - such as GNU Parallel. This also checks to make sure that output has occured. + such as GNU Parallel. This also checks to make sure that output has occurred. This includes piping 2+ commands together and pipelines that end in unthreadable commands. * ``curr_branch`` reports correctly when ``git config status.short true`` is used @@ -730,23 +815,23 @@ * Aliases that begin with a comma now complete correctly (no spurious comma) * Use ``python3`` in shebang lines for compatibility with distros that still use Python 2 as the default Python * STDOUT is only stored when ``$XONSH_STORE_STDOUT=True`` -* Fixed issue with alais redirections to files throwing an OSError because +* Fixed issue with alias redirections to files throwing an OSError because the function ProcProxies were not being waited upon. -* Fixed issue with callablable aliases that happen to call sys.exit() or +* Fixed issue with callable aliases that happen to call sys.exit() or raise SystemExit taking out the whole xonsh process. * Safely flushes file handles on threaded buffers. * Proper default value and documentation for ``$BASH_COMPLETIONS`` * Fixed readline completer issues on paths with spaces * Fix bug in ``argvquote()`` functions used when sourcing batch files on Windows. The bug meant an extra backslash was added to UNC paths. Thanks to @bytesemantics for spotting it, and @janschulz for fixing the issue. -* pep8, lint and refator in pytest style of ``test_ptk_multiline.py``, ``test_replay.py`` +* pep8, lint and refactor in pytest style of ``test_ptk_multiline.py``, ``test_replay.py`` * Tab completion of aliases returned a upper cased alias on Windows. * History show all action now also include current session items. * ``proc.stream_stderr`` now handles stderr that doesn't have buffer attribute * Made ``history show`` result sorted. * Fixed issue that ``history gc`` does not delete empty history files. * Standard stream tees have been fixed to accept the possibility that - they may not be backed by a binary buffer. This inludes the pipeline + they may not be backed by a binary buffer. This includes the pipeline stdout tee as well as the shell tees. * Fixed a bug when the pygments plugin was used by third party editors etc. * CPU usage of ``PopenThread`` and ``CommandPipeline`` has been brought @@ -794,12 +879,12 @@ * moved prompt formatting specific functions from ``xonsh.environ`` to ``xonsh.prompt.base`` * All prompt formatter functions moved to ``xonsh.prompt`` subpackage -* Printing the message about foreign aliases being ingored happens only +* Printing the message about foreign aliases being ignored happens only if XONSH_DEBUG is set. * Use ``SetConsoleTitleW()`` on Windows instead of a process call. * Tutorial to reflect the current history command argument functionality * Macro function arguments now default to ``str``, rather than ``eval``, - for consistentcy with other parts of the macro system. + for consistency with other parts of the macro system. **Removed:** @@ -820,13 +905,13 @@ * ``xonsh.prompt.vc_branch.git_dirty_working_directory`` uses ``porcelain`` option instead of using the bytestring ``nothing to commit`` to find out if a git directory is dirty -* Fix bug where know commands where not highlighed on windows. +* Fix bug where know commands where not highlighted on windows. * Fixed completer showing executable in upper case on windows. -* Fixed issue where tilde expansion was occuring more than once before an +* Fixed issue where tilde expansion was occurring more than once before an equals sign. * test_dirstack test_cdpath_expansion leaving stray testing dirs * Better completer display for long completions in prompt-toolkit -* Automatucally append newine to target of ``source`` alias, so that it may +* Automatically append newline to target of ``source`` alias, so that it may be exec'd. * test_news fails when single graves around word * Slashes in virtual environment names work in vox @@ -856,7 +941,7 @@ * NetBSD is now supported. * Macro function calls are now available. These use a Rust-like ``f!(arg)`` syntax. -* Macro subprocess call now avalaible with the ``echo! x y z`` +* Macro subprocess call now available with the ``echo! x y z`` syntax. * A new `event subsystem `_ has been added. * howto install sections for Debian/Ubuntu and Fedora. @@ -913,12 +998,12 @@ **Fixed:** * xonsh modules imported now have the __file__ attribute -* Context senstitive AST transformer was not adding argument names to the +* Context sensitive AST transformer was not adding argument names to the local scope. This would then enable extraneous subprocess mode wrapping for expressions whose leftmost name was function argument. This has been fixed by properly adding the argument names to the scope. * Foreign shell functions that are mapped to empty filenames no longer - receive alaises since they can't be found to source later. + receive aliases since they can't be found to source later. * Correctly preserve arguments given to xon.sh, in case there are quoted ones. * Environment variables in subprocess mode were not being expanded unless they were in a sting. They are now expanded properly. @@ -1048,7 +1133,7 @@ * ``vox remove`` command can remove multiple environments at once. * Added FreeBSD support. * Tab completion for pip python package manager. -* Regular expressions for enviroment variable matching +* Regular expressions for environment variable matching. * __contains__ method on Env * Added news tests to enforce changelog conformity. @@ -1071,7 +1156,7 @@ * xonsh_builtins, xonsh_execer fixtures in conftest.py * Docs on how to tweak the Windows ConHost for a better color scheme. * Docs: how to fix Thunar's "Open Terminal Here" action. -* A new API class was added to Vox: ``xontrib.voxapi.Vox``. This allows programtic access to the virtual environment machinery for other xontribs. See the API documentation for details. +* A new API class was added to Vox: ``xontrib.voxapi.Vox``. This allows programmatic access to the virtual environment machinery for other xontribs. See the API documentation for details. * History now accepts multiple slices arguments separated by spaces @@ -1079,7 +1164,7 @@ * amalgamate now works on Python 2 and allows relative imports. * Top-level xonsh package now more lazy. -* Show conda environement name in prompt in parentheses similiar what conda does. +* Show conda environment name in prompt in parentheses similar what conda does. * Implementation of expandvars now uses regex * Because of the addition of "optional items" to the prompt format string, the functions ``xonsh.environ.current_branch``, ``xonsh.environ.env_name`` and @@ -1131,7 +1216,7 @@ * Fix bug that prevented disabling $INTENSIFY_COLORS_ON_WIN in ``xonshrc`` * ``LazyJSON`` will now hide failures to close, and instead rely on reference counting if something goes wrong. -* Fixed maximum recurssion error with color styles. +* Fixed maximum recursion error with color styles. * Parser tables will no longer be generated in the current directory by accident. * Error messages when zsh or bash history file is not found @@ -1173,7 +1258,7 @@ * Minor amalgamate bug with ``import pkg.mod`` amalgamated imports. * No longer raises an error if a directory in ``$PATH`` does not exist on Python v3.4. -* Fixed a readline shell completion issue that caused by inconsistence between +* Fixed a readline shell completion issue that caused by inconsistency between ``$CASE_SENSITIVE_COMPLETIONS`` and readline's inputrc setting. @@ -1238,7 +1323,7 @@ - A ``LazyBool`` will only be created when ``__bool__()`` is called. Additionally, when fully loaded, the above objects will replace themselves - by name in the context that they were handed, thus derefenceing themselves. + by name in the context that they were handed, thus dereferencing themselves. This is useful for global variables that may be expensive to create, should only be created once, and may not be used in any particular session. * New ``xon.sh`` script added for launching xonsh from a sh environment. @@ -1254,7 +1339,7 @@ * New ``Block`` and ``Functor`` context managers are now available as part of the ``xonsh.contexts`` module. * ``Block`` provides support for turning a context body into a non-executing - list of string lines. This is implmement via a syntax tree transformation. + list of string lines. This is implement via a syntax tree transformation. This is useful for creating remote execution tools that seek to prevent local execution. * ``Functor`` is a subclass of the ``Block`` context manager that turns the @@ -1303,10 +1388,10 @@ can be resolved properly. * In ``VI_MODE``, the ``v`` key will enter character selection mode, not open the editor. ``Ctrl-X Ctrl-E`` will still open an editor in any mode -* ``$XONSH_DEBUG`` will now supress amalgamted imports. This usually needs to be +* ``$XONSH_DEBUG`` will now suppress amalgamated imports. This usually needs to be set in the calling environment or prior to *any* xonsh imports. -* Restuctured ``xonsh.platform`` to be fully lazy. -* Restuctured ``xonsh.ansi_colors`` to be fully lazy. +* Restructured ``xonsh.platform`` to be fully lazy. +* Restructured ``xonsh.ansi_colors`` to be fully lazy. * Ensured the ``pygments`` and ``xonsh.pyghooks`` are not imported until actually needed. * Yacc parser is now loaded in a background thread. @@ -1318,7 +1403,7 @@ * On Windows the ``PROMPT`` environment variable is reset to `$P$G` before sourcing ``*.bat`` files. * On Windows the ``PROMPT`` environment variable is reset to `$P$G` before starting - subprocesses. This prevents the unformatted xonsh ``PROMPT`` tempalte from showing up + subprocesses. This prevents the unformatted xonsh ``PROMPT`` template from showing up when running batch files with ``ECHO ON``` * ``@()`` now passes through functions as well as strings, which allows for the use of anonymous aliases and aliases not explicitly added to the ``aliases`` @@ -1356,7 +1441,7 @@ * Issue where ``xonsh`` did not expand user and environment variables in ``$PATH``, forcing the user to add absolute paths. -* Fixed a problem with aliases not always beeing found. +* Fixed a problem with aliases not always being found. * Fixed issue where input was directed to the last process in a pipeline, rather than the first. * Bug where xonfig wizard can't find ENV docs @@ -1391,7 +1476,7 @@ attempted to load. * Only show the prompt for the wizard if we did not attempt to load any run control files (as opposed to if none were successfully loaded). -* Git and mercurial branch and dirty function refactor to imporve run times. +* Git and mercurial branch and dirty function refactor to improve run times. **Fixed:** @@ -1405,7 +1490,7 @@ * Fixed crash resulting from malformed ``$PROMPT``. * Fixed regression on Windows with the locate_binary() function. The bug prevented `source-cmd` from working correctly and broke the - ``activate``/``deactivate`` aliases for the conda environements. + ``activate``/``deactivate`` aliases for the conda environments. * Fixed crash resulting from errors other than syntax errors in run control file. * On Windows if bash is not on the path look in the registry for the defaults @@ -1449,7 +1534,7 @@ **Fixed:** -* Fixed crashed bash-completer when bash is not avaiable on Windows +* Fixed crashed bash-completer when bash is not available on Windows * Fixed bug on Windows where tab-completion for executables would return all files. * Fixed bug on Windows which caused the bash $PROMPT variable to be used when no no $PROMPT variable was set in .xonshrc @@ -1458,7 +1543,7 @@ * The --shell-type CLI flag now takes precedence over $SHELL_TYPE specified in .xonshrc * Fixed an issue about ``os.killpg()`` on OS X which caused xonsh crash with - occasionality + occasionally. @@ -1485,7 +1570,7 @@ commands and arguments. * Added ``$DYNAMIC_CWD_WIDTH`` to allow the adjusting of the current working directory width in the prompt. -* Added ``$XONSH_DEBUG`` environment variable to help with debuging. +* Added ``$XONSH_DEBUG`` environment variable to help with debugging. * The ``${...}`` shortcut for ``__xonsh_env__`` now returns appropriate completion options @@ -1515,7 +1600,7 @@ triggered by libedit. * ``$MULTILINE_PROMPT`` now allows colors, as originally intended. * Rectified install issue with Jupyter hook when installing with pyenv, - Jupyter install hook now repects ``--prefix`` argument. + Jupyter install hook now respects ``--prefix`` argument. * Fixed issue with the xonsh.ply subpackage not being installed. * Fixed a parsing bug whereby a trailing ``&`` on a line was being ignored (processes were unable to be started in the background) @@ -1529,7 +1614,7 @@ * ``and``, ``or``, ``&&``, ``||`` have been added as subprocess logical operators, by popular demand! * Subprocesses may be negated with ``not`` and grouped together with parentheses. -* New framework for writing xonsh extentions, called ``xontribs``. +* New framework for writing xonsh extensions, called ``xontribs``. * Added a new shell type ``'none'``, used to avoid importing ``readline`` or ``prompt_toolkit`` when running scripts or running a single command. * New: `sudo` functionality on Windows through an alias @@ -1592,14 +1677,14 @@ * Fixed bug with loading prompt-toolkit shell < v0.57. * Fixed bug with prompt-toolkit completion when the cursor is not at the end of the line. -* Aliases will now evaluate enviornment variables and other expansions +* Aliases will now evaluate environment variables and other expansions at execution time rather than passing through a literal string. -* Fixed environment variables from os.environ not beeing loaded when a running +* Fixed environment variables from os.environ not being loaded when a running a script * The readline shell will now load the inputrc files. * Fixed bug that prevented `source-alias` from working. * Now able to ``^C`` the xonfig wizard on start up. -* Fixed deadlock on Windows when runing subprocess that generates enough output +* Fixed deadlock on Windows when running subprocess that generates enough output to fill the OS pipe buffer. * Sourcing foreign shells will now return a non-zero exit code if the source operation failed for some reason. @@ -1620,7 +1705,7 @@ for the concrete shell type based on the availability on the user's machine. * New environment variable ``$XONSH_COLOR_STYLE`` will set the color mapping for all of xonsh. -* New ``XonshStyle`` pygments style will determine the approriate color +* New ``XonshStyle`` pygments style will determine the appropriate color mapping based on ``$XONSH_COLOR_STYLE``. The associated ``xonsh_style_proxy()`` is intended for wrapping ``XonshStyle`` when actually being used by pygments. @@ -1629,7 +1714,7 @@ anywhere. * ``xonsh.tools.HAVE_PYGMENTS`` flag now denotes if pygments is installed and available on the users system. -* The ``ansi_colors`` module is now availble for handling ANSI color codes. +* The ``ansi_colors`` module is now available for handling ANSI color codes. * ``?`` and ``??`` operator output now has colored titles, like in IPython. * ``??`` will syntax highlight source code if pygments is available. * Python mode output is now syntax highlighted if pygments is available. diff -Nru xonsh-0.5.12+dfsg/CONTRIBUTING.rst xonsh-0.6.0+dfsg/CONTRIBUTING.rst --- xonsh-0.5.12+dfsg/CONTRIBUTING.rst 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/CONTRIBUTING.rst 2017-11-23 00:23:47.000000000 +0000 @@ -143,13 +143,13 @@ Alternatively, for modules outside of the current package (or modules that are not amalgamated) the import statement should be either ``import pkg.x`` or ``import pkg.x as name``. This is because these are the only cases where the -amalgamater is able to automatically insert lazy imports in way that is guarantted +amalgamater is able to automatically insert lazy imports in way that is guaranteed to be safe. This is due to the ambiguity that ``from pkg.x import name`` may import a variable that cannot be lazily constructed or may import a module. So the simple rules to follow are that: 1. Import objects from modules in the same package directly in using from-import, -2. Import objects from moudules outside of the package via a direct import +2. Import objects from modules outside of the package via a direct import or import-as statement. How to Test @@ -167,7 +167,7 @@ This will build and run the current state of the repository in an isolated container (it may take a while the first time you run it). There are two -additionals arguments you can pass this script. +additional arguments you can pass this script. * The version of python * the version of ``prompt_toolkit`` @@ -233,7 +233,7 @@ $ py.test --fixtures -when writting tests it's best to use pytest features i.e parametrization:: +when writing tests it's best to use pytest features i.e parametrization:: @pytest.mark.parametrize('env', [test_env1, test_env2]) def test_one(env, xonsh_builtins): diff -Nru xonsh-0.5.12+dfsg/debian/changelog xonsh-0.6.0+dfsg/debian/changelog --- xonsh-0.5.12+dfsg/debian/changelog 2017-06-23 09:05:48.000000000 +0000 +++ xonsh-0.6.0+dfsg/debian/changelog 2017-11-25 15:20:53.000000000 +0000 @@ -1,3 +1,11 @@ +xonsh (0.6.0+dfsg-1) unstable; urgency=medium + + * New upstream release + * Update to standards-version 4.1.1 + * Retire manpage-spelling.patch; fixed upstream + + -- Gordon Ball Sat, 25 Nov 2017 15:20:53 +0000 + xonsh (0.5.12+dfsg-1) unstable; urgency=medium * New upstream release diff -Nru xonsh-0.5.12+dfsg/debian/control xonsh-0.6.0+dfsg/debian/control --- xonsh-0.5.12+dfsg/debian/control 2017-06-23 09:05:48.000000000 +0000 +++ xonsh-0.6.0+dfsg/debian/control 2017-11-25 15:20:53.000000000 +0000 @@ -1,7 +1,7 @@ Source: xonsh Section: shells Priority: optional -Standards-Version: 4.0.0 +Standards-Version: 4.1.1 Maintainer: Gordon Ball Uploaders: Barry Warsaw , Build-Depends: debhelper (>= 10), diff -Nru xonsh-0.5.12+dfsg/debian/patches/manpage-spelling.patch xonsh-0.6.0+dfsg/debian/patches/manpage-spelling.patch --- xonsh-0.5.12+dfsg/debian/patches/manpage-spelling.patch 2017-06-23 09:05:48.000000000 +0000 +++ xonsh-0.6.0+dfsg/debian/patches/manpage-spelling.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -Description: fix help typos which end up in the manpage via help2man -Author: Gordon Ball - ---- a/xonsh/main.py -+++ b/xonsh/main.py -@@ -170,8 +170,8 @@ - choices=('readline', 'prompt_toolkit', 'best', 'random'), - default=None) - p.add_argument('--timings', -- help='Prints timing infomation before the prompt is shown. ' -- 'This is usefull to track down perfomance issues ' -+ help='Prints timing information before the prompt is shown. ' -+ 'This is useful to track down performance issues ' - 'and investigate startup times.', - dest='timings', - action='store_true', diff -Nru xonsh-0.5.12+dfsg/debian/patches/series xonsh-0.6.0+dfsg/debian/patches/series --- xonsh-0.5.12+dfsg/debian/patches/series 2017-06-23 09:05:48.000000000 +0000 +++ xonsh-0.6.0+dfsg/debian/patches/series 2017-11-25 15:20:53.000000000 +0000 @@ -1,3 +1,2 @@ -manpage-spelling.patch unvendor-ply.patch documentation-fixes.patch diff -Nru xonsh-0.5.12+dfsg/debian/tests/pytest xonsh-0.6.0+dfsg/debian/tests/pytest --- xonsh-0.5.12+dfsg/debian/tests/pytest 2017-06-23 09:05:48.000000000 +0000 +++ xonsh-0.6.0+dfsg/debian/tests/pytest 2017-11-25 15:20:53.000000000 +0000 @@ -10,12 +10,12 @@ cp -r tests $AUTOPKGTEST_TMP cd $AUTOPKGTEST_TMP -TESTARGS="--ignore tests/test_man.py --ignore tests/test_news.py" +TESTARGS="--ignore tests/test_man.py --ignore tests/test_news.py --ignore tests/test_integrations.py" if python3 -c "import pty; pty.openpty()" > /dev/null 2>&1; then echo PTY available else echo PTY unavailable, disabling tests involving subshells - TESTARGS="$TESTARGS --ignore tests/test_integrations.py --ignore tests/test_xonsh.xsh" + TESTARGS="$TESTARGS --ignore tests/test_xonsh.xsh" fi py.test-3 $TESTARGS diff -Nru xonsh-0.5.12+dfsg/docs/advanced_events.rst xonsh-0.6.0+dfsg/docs/advanced_events.rst --- xonsh-0.5.12+dfsg/docs/advanced_events.rst 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/advanced_events.rst 2017-11-23 00:23:47.000000000 +0000 @@ -4,19 +4,19 @@ Advanced Events ******************** -If you havent, go read the `events tutorial `_ first. This documents the messy +If you haven't, go read the `events tutorial `_ first. This documents the messy details of the event system. You may also find the `events API reference `_ useful. Why Unordered? ============== -Yes, handler call order is not guarenteed. Please don't file bugs about this. +Yes, handler call order is not guaranteed. Please don't file bugs about this. This was chosen because the order of handler registration is dependant on load order, which is stable in a release but not something generally reasoned about. In addition, xontribs mean that we don't know what handlers could be registered. So even an "ordered" event system would be unable to -make guarentees about ordering because of the larger system. +make guarantees about ordering because of the larger system. Because of this, the event system is not ordered; this is a form of abstraction. Order-dependant semantics are not encouraged by the built-in methods. diff -Nru xonsh-0.5.12+dfsg/docs/aliases.rst xonsh-0.6.0+dfsg/docs/aliases.rst --- xonsh-0.5.12+dfsg/docs/aliases.rst 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/aliases.rst 2017-11-23 00:23:47.000000000 +0000 @@ -72,7 +72,7 @@ ``source-bash`` ==================== Like the ``source`` command but for Bash files. This is a thin wrapper around -the ``source-foreign`` alias where the ``shell`` argument is autoamtically set +the ``source-foreign`` alias where the ``shell`` argument is automatically set to ``bash``. @@ -111,7 +111,7 @@ ``showcmd`` ============ -Displays how comands and arguments are evaluated. +Displays how commands and arguments are evaluated. ``ipynb`` @@ -126,10 +126,13 @@ .. command-help:: xonsh.tracer.tracermain -``xip`` +``xpip`` ================= Runs the ``pip`` package manager for xonsh itself. Useful for installations where xonsh is in an -isolated environment (eg homebrew). Pronounced "kip". +isolated environment (eg conda, homebrew). + +In general, use ``xpip`` if you're configuring or adding features to xonsh, and use ``pip`` if +you're doing Python development. ``xonfig`` diff -Nru xonsh-0.5.12+dfsg/docs/api/completers/index.rst xonsh-0.6.0+dfsg/docs/api/completers/index.rst --- xonsh-0.5.12+dfsg/docs/api/completers/index.rst 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/api/completers/index.rst 2017-11-23 00:23:47.000000000 +0000 @@ -8,7 +8,7 @@ **Stock Xonsh COmpleters:** .. toctree:: - :maxdepth: 1 + :maxdepth: 2 base bash diff -Nru xonsh-0.5.12+dfsg/docs/api/history/index.rst xonsh-0.6.0+dfsg/docs/api/history/index.rst --- xonsh-0.5.12+dfsg/docs/api/history/index.rst 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/api/history/index.rst 2017-11-23 00:23:47.000000000 +0000 @@ -6,7 +6,7 @@ **History Modules:** .. toctree:: - :maxdepth: 1 + :maxdepth: 2 base main diff -Nru xonsh-0.5.12+dfsg/docs/bash_to_xsh.rst xonsh-0.6.0+dfsg/docs/bash_to_xsh.rst --- xonsh-0.5.12+dfsg/docs/bash_to_xsh.rst 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/bash_to_xsh.rst 2017-11-23 00:23:47.000000000 +0000 @@ -2,7 +2,7 @@ ================================ As you have probably figured out by now, xonsh is not ``sh``-lang compliant. If your muscles have memorized all of the Bash prestidigitations, this page -will help you put a finger on how to do the equivelent task in xonsh. +will help you put a finger on how to do the equivalent task in xonsh. .. list-table:: :widths: 30 30 40 @@ -52,4 +52,10 @@ * - ``!$`` - ``__xonsh_history__[-1, -1]`` - Get the last argument of the last command - + * - ``$`` + - ``$ARG`` + - Command line argument at index ``n``, + so ``$ARG1`` is the equivalent of ``$1``. + * - ``$@`` + - ``$ARGS`` + - List of all command line argument and parameter strings. diff -Nru xonsh-0.5.12+dfsg/docs/comparison.rst xonsh-0.6.0+dfsg/docs/comparison.rst --- xonsh-0.5.12+dfsg/docs/comparison.rst 1970-01-01 00:00:00.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/comparison.rst 2017-11-23 00:23:47.000000000 +0000 @@ -0,0 +1,97 @@ + +Comparison +========== +Xonsh is significantly different from most other shells or shell tools. The following +table lists features and capabilities that various tools may or may not share. + +.. list-table:: + :widths: 3 1 1 1 1 1 1 + :header-rows: 1 + :stub-columns: 1 + + * - + - Bash + - zsh + - plumbum + - fish + - IPython + - xonsh + * - Sane language + - + - + - ✓ + - ✓ + - ✓ + - ✓ + * - Easily scriptable + - ✓ + - ✓ + - ✓ + - ✓ + - + - ✓ + * - Native cross-platform support + - + - + - ✓ + - ✓ + - ✓ + - ✓ + * - Meant as a shell + - ✓ + - ✓ + - + - ✓ + - + - ✓ + * - Tab completion + - ✓ + - ✓ + - + - ✓ + - ✓ + - ✓ + * - Man-page completion + - + - + - + - ✓ + - + - ✓ + * - Large standard library + - + - ✓ + - + - + - ✓ + - ✓ + * - Typed variables + - + - + - ✓ + - ✓ + - ✓ + - ✓ + * - Syntax highlighting + - + - + - + - ✓ + - in notebook + - w/ prompt-toolkit + * - Pun in name + - ✓ + - + - ✓ + - + - + - ✓ + * - Rich history + - + - + - + - + - + - ✓ + + diff -Nru xonsh-0.5.12+dfsg/docs/conf.py xonsh-0.6.0+dfsg/docs/conf.py --- xonsh-0.5.12+dfsg/docs/conf.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/conf.py 2017-11-23 00:23:47.000000000 +0000 @@ -60,7 +60,7 @@ #source_encoding = 'utf-8' # The master toctree document. -master_doc = 'index' +master_doc = 'sidebar' # General information about the project. project = u'xonsh' @@ -132,6 +132,7 @@ # further. For a list of options available for each theme, see the # documentation. if not on_rtd: + import cloud_sptheme as csp html_theme = 'cloud' @@ -164,7 +165,7 @@ # The name of an image file (relative to this directory) to place at the top # of the sidebar. -html_logo = '_static/ascii_conch_part_color_tight.png' +html_logo = '_static/ascii_conch_part_transparent_tight.png' # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 diff -Nru xonsh-0.5.12+dfsg/docs/contact.rst xonsh-0.6.0+dfsg/docs/contact.rst --- xonsh-0.5.12+dfsg/docs/contact.rst 1970-01-01 00:00:00.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/contact.rst 2017-11-23 00:23:47.000000000 +0000 @@ -0,0 +1,8 @@ + + +Contact Us +========== +If you have questions or comments, please send them to the mailing list +xonsh@googlegroups.com, page us on IRC, contact the author directly, or +open an issue on GitHub. +`Join the mailing list here! `_ diff -Nru xonsh-0.5.12+dfsg/docs/contributing.rst xonsh-0.6.0+dfsg/docs/contributing.rst --- xonsh-0.5.12+dfsg/docs/contributing.rst 1970-01-01 00:00:00.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/contributing.rst 2017-11-23 00:23:47.000000000 +0000 @@ -0,0 +1,10 @@ + + +Contributing +============ +We highly encourage contributions to xonsh! If you would like to contribute, +it is as easy as forking the repository on GitHub, making your changes, and +issuing a pull request. If you have any questions about this process don't +hesitate to ask the mailing list (xonsh@googlegroups.com) or the `Gitter `_ channel. + +See the `Developer's Guide `_ for more information about contributing. diff -Nru xonsh-0.5.12+dfsg/docs/development.rst xonsh-0.6.0+dfsg/docs/development.rst --- xonsh-0.5.12+dfsg/docs/development.rst 1970-01-01 00:00:00.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/development.rst 2017-11-23 00:23:47.000000000 +0000 @@ -0,0 +1,14 @@ + +Development Spiral +================== + +.. toctree:: + :titlesonly: + :maxdepth: 2 + + api/index + advanced_events + devguide + changelog + faq + todo \ No newline at end of file diff -Nru xonsh-0.5.12+dfsg/docs/devguide.rst xonsh-0.6.0+dfsg/docs/devguide.rst --- xonsh-0.5.12+dfsg/docs/devguide.rst 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/devguide.rst 2017-11-23 00:23:47.000000000 +0000 @@ -143,13 +143,13 @@ Alternatively, for modules outside of the current package (or modules that are not amalgamated) the import statement should be either ``import pkg.x`` or ``import pkg.x as name``. This is because these are the only cases where the -amalgamater is able to automatically insert lazy imports in way that is guarantted +amalgamater is able to automatically insert lazy imports in way that is guaranteed to be safe. This is due to the ambiguity that ``from pkg.x import name`` may import a variable that cannot be lazily constructed or may import a module. So the simple rules to follow are that: 1. Import objects from modules in the same package directly in using from-import, -2. Import objects from moudules outside of the package via a direct import +2. Import objects from modules outside of the package via a direct import or import-as statement. How to Test @@ -167,7 +167,7 @@ This will build and run the current state of the repository in an isolated container (it may take a while the first time you run it). There are two -additionals arguments you can pass this script. +additional arguments you can pass this script. * The version of python * the version of ``prompt_toolkit`` @@ -233,7 +233,7 @@ $ py.test --fixtures -when writting tests it's best to use pytest features i.e parametrization:: +when writing tests it's best to use pytest features i.e parametrization:: @pytest.mark.parametrize('env', [test_env1, test_env2]) def test_one(env, xonsh_builtins): diff -Nru xonsh-0.5.12+dfsg/docs/faq.rst xonsh-0.6.0+dfsg/docs/faq.rst --- xonsh-0.5.12+dfsg/docs/faq.rst 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/faq.rst 2017-11-23 00:23:47.000000000 +0000 @@ -1,4 +1,4 @@ -========================== + Frequently Asked Questions ========================== Ok, so, maybe no one actually asked them. diff -Nru xonsh-0.5.12+dfsg/docs/guides.rst xonsh-0.6.0+dfsg/docs/guides.rst --- xonsh-0.5.12+dfsg/docs/guides.rst 1970-01-01 00:00:00.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/guides.rst 2017-11-23 00:23:47.000000000 +0000 @@ -0,0 +1,18 @@ + +Guides +====== + +.. toctree:: + :titlesonly: + :maxdepth: 2 + + tutorial + tutorial_hist + tutorial_macros + tutorial_xontrib + tutorial_events + tutorial_completers + tutorial_history_backend + tutorial_ptk + bash_to_xsh + python_virtual_environments \ No newline at end of file diff -Nru xonsh-0.5.12+dfsg/docs/index.rst xonsh-0.6.0+dfsg/docs/index.rst --- xonsh-0.5.12+dfsg/docs/index.rst 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/index.rst 2017-11-23 00:23:47.000000000 +0000 @@ -1,367 +1,22 @@ -the xonsh shell -=============== -.. raw:: html - -

- - ~ - - ~ -
-
-
-

- -Xonsh is a Python-powered, cross-platform, Unix-gazing shell language and -command prompt. The language is a superset of Python 3.4+ with additional -shell primitives that you are used to from Bash and IPython. It works on -all major systems including Linux, Mac OSX, and Windows. Xonsh is meant -for the daily use of experts and novices alike. - -**Try it out!** - -.. raw:: html - - -

- - - -

-
- - -.. - -========= -Contents -========= -**Installation:** - -.. toctree:: - :titlesonly: - :maxdepth: 1 - - dependencies - linux - osx - windows - customization - -**Guides:** - -.. toctree:: - :titlesonly: - :maxdepth: 1 - - tutorial - tutorial_hist - tutorial_macros - tutorial_xontrib - tutorial_events - tutorial_completers - tutorial_history_backend - tutorial_ptk - bash_to_xsh - python_virtual_environments - -**Configuration & Setup:** - -.. toctree:: - :titlesonly: - :maxdepth: 1 - - xonshrc - xonshconfig - envvars - aliases - xontribs - events - -**News & Media:** - -.. toctree:: - :titlesonly: - :maxdepth: 1 - - talks_and_articles - quotes - - -**Development Spiral:** - -.. toctree:: - :titlesonly: - :maxdepth: 1 - - api/index - advanced_events - devguide/ - changelog - faq - todo - -========== -Comparison -========== -Xonsh is significantly different from most other shells or shell tools. The following -table lists features and capabilities that various tools may or may not share. - -.. list-table:: - :widths: 3 1 1 1 1 1 1 - :header-rows: 1 - :stub-columns: 1 - - * - - - Bash - - zsh - - plumbum - - fish - - IPython - - xonsh - * - Sane language - - - - - - ✓ - - ✓ - - ✓ - - ✓ - * - Easily scriptable - - ✓ - - ✓ - - ✓ - - ✓ - - - - ✓ - * - Native cross-platform support - - - - - - ✓ - - ✓ - - ✓ - - ✓ - * - Meant as a shell - - ✓ - - ✓ - - - - ✓ - - - - ✓ - * - Tab completion - - ✓ - - ✓ - - - - ✓ - - ✓ - - ✓ - * - Man-page completion - - - - - - - - ✓ - - - - ✓ - * - Large standard library - - - - ✓ - - - - - - ✓ - - ✓ - * - Typed variables - - - - - - ✓ - - ✓ - - ✓ - - ✓ - * - Syntax highlighting - - - - - - - - ✓ - - in notebook - - w/ prompt-toolkit - * - Pun in name - - ✓ - - - - ✓ - - - - - - ✓ - * - Rich history - - - - - - - - - - - - ✓ +.. include:: intro.rst +.. include:: comparison.rst +.. include:: installation.rst .. include:: dependencies.rst +.. include:: news.rst + +.. include:: guides.rst + +.. include:: setup.rst + +.. include:: contributing.rst + +.. include:: contact.rst -============ -Contributing -============ -We highly encourage contributions to xonsh! If you would like to contribute, -it is as easy as forking the repository on GitHub, making your changes, and -issuing a pull request. If you have any questions about this process don't -hesitate to ask the mailing list (xonsh@googlegroups.com) or the `Gitter `_ channel. - -See the `Developer's Guide `_ for more information about contributing. - -========== -Contact Us -========== -If you have questions or comments, please send them to the mailing list -xonsh@googlegroups.com, page us on IRC, contact the author directly, or -open an issue on GitHub. -`Join the mailing list here! `_ - -============= -Helpful Links -============= - -* `Documentation `_ -* `Gitter `_ -* `Mailing list `_ -* `IRC: channel #xonsh on OFTC `_ -* `GitHub Repository `_ -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - -.. raw:: html - - Fork me on GitHub - - +.. include:: development.rst diff -Nru xonsh-0.5.12+dfsg/docs/installation.rst xonsh-0.6.0+dfsg/docs/installation.rst --- xonsh-0.5.12+dfsg/docs/installation.rst 1970-01-01 00:00:00.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/installation.rst 2017-11-23 00:23:47.000000000 +0000 @@ -0,0 +1,13 @@ + +Installation +============ + +.. toctree:: + :titlesonly: + :maxdepth: 2 + + dependencies + linux + osx + windows + customization \ No newline at end of file diff -Nru xonsh-0.5.12+dfsg/docs/intro.rst xonsh-0.6.0+dfsg/docs/intro.rst --- xonsh-0.5.12+dfsg/docs/intro.rst 1970-01-01 00:00:00.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/intro.rst 2017-11-23 00:23:47.000000000 +0000 @@ -0,0 +1,104 @@ +the xonsh shell +=============== + +.. raw:: html + +

+ + ~ + + ~ +
+
+
+

+ +Xonsh is a Python-powered, cross-platform, Unix-gazing shell language and +command prompt. The language is a superset of Python 3.4+ with additional +shell primitives that you are used to from Bash and IPython. It works on +all major systems including Linux, Mac OSX, and Windows. Xonsh is meant +for the daily use of experts and novices alike. + +**Try it out!** + +.. raw:: html + + +

+ + + +

+
+ + +.. diff -Nru xonsh-0.5.12+dfsg/docs/links.rst xonsh-0.6.0+dfsg/docs/links.rst --- xonsh-0.5.12+dfsg/docs/links.rst 1970-01-01 00:00:00.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/links.rst 2017-11-23 00:23:47.000000000 +0000 @@ -0,0 +1,76 @@ + + +Helpful Links +============= + +* `Documentation `_ +* `Gitter `_ +* `Mailing list `_ +* `IRC: channel #xonsh on OFTC `_ +* `GitHub Repository `_ +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + +.. raw:: html + + Fork me on GitHub + + diff -Nru xonsh-0.5.12+dfsg/docs/news.rst xonsh-0.6.0+dfsg/docs/news.rst --- xonsh-0.5.12+dfsg/docs/news.rst 1970-01-01 00:00:00.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/news.rst 2017-11-23 00:23:47.000000000 +0000 @@ -0,0 +1,10 @@ + +News & Media +============ + +.. toctree:: + :titlesonly: + :maxdepth: 2 + + talks_and_articles + quotes \ No newline at end of file diff -Nru xonsh-0.5.12+dfsg/docs/setup.rst xonsh-0.6.0+dfsg/docs/setup.rst --- xonsh-0.5.12+dfsg/docs/setup.rst 1970-01-01 00:00:00.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/setup.rst 2017-11-23 00:23:47.000000000 +0000 @@ -0,0 +1,14 @@ + +Config Files and Settings +========================= + +.. toctree:: + :titlesonly: + :maxdepth: 2 + + xonshrc + xonshconfig + envvars + aliases + xontribs + events \ No newline at end of file diff -Nru xonsh-0.5.12+dfsg/docs/sidebar.rst xonsh-0.6.0+dfsg/docs/sidebar.rst --- xonsh-0.5.12+dfsg/docs/sidebar.rst 1970-01-01 00:00:00.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/sidebar.rst 2017-11-23 00:23:47.000000000 +0000 @@ -0,0 +1,20 @@ +:orphan: + +.. title:: Documentation Index + +.. toctree:: + :maxdepth: 3 + + the xonsh shell + intro + comparison + installation + dependencies + news + guides + setup + contributing + development + API + contact + links \ No newline at end of file diff -Nru xonsh-0.5.12+dfsg/docs/tutorial_history_backend.rst xonsh-0.6.0+dfsg/docs/tutorial_history_backend.rst --- xonsh-0.5.12+dfsg/docs/tutorial_history_backend.rst 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/tutorial_history_backend.rst 2017-11-23 00:23:47.000000000 +0000 @@ -288,7 +288,7 @@ Parameters ---------- size: None or tuple of a int and a string - Detemines the size and units of what would be allowed to remain. + Determines the size and units of what would be allowed to remain. blocking: bool If set blocking, then wait until gc action finished. """ diff -Nru xonsh-0.5.12+dfsg/docs/tutorial_ptk.rst xonsh-0.6.0+dfsg/docs/tutorial_ptk.rst --- xonsh-0.5.12+dfsg/docs/tutorial_ptk.rst 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/tutorial_ptk.rst 2017-11-23 00:23:47.000000000 +0000 @@ -40,7 +40,7 @@ * - Keystroke - ASCII control representation - - Default commmand + - Default command * - ``Control J`` - ```` - Run command diff -Nru xonsh-0.5.12+dfsg/docs/tutorial.rst xonsh-0.6.0+dfsg/docs/tutorial.rst --- xonsh-0.5.12+dfsg/docs/tutorial.rst 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/tutorial.rst 2017-11-23 00:23:47.000000000 +0000 @@ -150,7 +150,7 @@ >>> 'HOME' in ${...} True -To get information about a specific enviroment variable you can use the +To get information about a specific environment variable you can use the :func:`~xonsh.environ.Env.help` method. .. code-block:: xonshcon @@ -297,7 +297,7 @@ >>> l = 2 >>> ls -l 42 - >>> # deleting ls will return us to supbroc-mode + >>> # deleting ls will return us to subproc-mode >>> del ls >>> ls -l total 0 @@ -913,7 +913,7 @@ 3 This same kind of search is performed if the backticks are prefaced with ``r``. -So the following expresions are equivalent: ```test``` and ``r`test```. +So the following expressions are equivalent: ```test``` and ``r`test```. Other than the regex matching, this functions in the same way as normal globbing. For more information, please see the documentation for the ``re`` @@ -1203,7 +1203,7 @@ def mycmd5(args, stdin=None, stdout=None, stderr=None, spec=None): """Lastly, the final form of subprocess callables takes all of the - arguments shown above as well as a subpcrocess specification + arguments shown above as well as a subprocess specification SubprocSpec object. This holds many attributes that dictate how the command is being run. For instance this can be useful for knowing if the process is captured by $() or !(). @@ -1316,9 +1316,9 @@ Aliasing is a powerful way that xonsh allows you to seamlessly interact to with Python and subprocess. -.. warning:: If ``FOREIGN_ALIASES_OVERRIDE`` enviroment variable is False +.. warning:: If ``FOREIGN_ALIASES_OVERRIDE`` environment variable is False (the default) then foreign shell aliases that try to override - xonsh aliases will be ignored. Setting of this enviroment variable + xonsh aliases will be ignored. Setting of this environment variable must happen in the static configuration file ``$XONSH_CONFIG_DIR/config.json`` in the 'env' section. @@ -1408,7 +1408,7 @@ hex color, or the nearest approximation that that is supported by the shell and terminal. For example, ``#fff`` and ``#fafad2`` are both valid. -* ``BACKGROUND_`` may be added to the begining of a color name or hex +* ``BACKGROUND_`` may be added to the beginning of a color name or hex color to set a background color. For example, ``BACKGROUND_INTENSE_RED`` and ``BACKGROUND_#123456`` can both be used. * ``bg#HEX`` or ``BG#HEX`` are shortcuts for setting a background hex color. @@ -1534,8 +1534,8 @@ adding files file0.txt file1.txt file2.txt file3.txt file4.txt test_script.sh -xonsh scripts can also accept arguments. These arguments are made available to -the script in two different ways: +xonsh scripts can also accept command line arguments and parameters. +These arguments are made available to the script in two different ways: #. In either mode, as individual variables ``$ARG`` (e.g., ``$ARG1``) #. In Python mode only, as a list ``$ARGS`` @@ -1586,7 +1586,7 @@ is roughly equivalent to Bash's ``set -e``. Furthermore, you can also toggle the ability to print source code lines with the -``trace on`` and ``trace off`` commands. This is roughly equivelent to +``trace on`` and ``trace off`` commands. This is roughly equivalent to Bash's ``set -x`` or Python's ``python -m trace``, but you know, better. Importing Xonsh (``*.xsh``) diff -Nru xonsh-0.5.12+dfsg/docs/tutorial_xontrib.rst xonsh-0.6.0+dfsg/docs/tutorial_xontrib.rst --- xonsh-0.5.12+dfsg/docs/tutorial_xontrib.rst 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/tutorial_xontrib.rst 2017-11-23 00:23:47.000000000 +0000 @@ -218,7 +218,7 @@ "url": "http://example", "install": { "conda": "conda install package-name", - "pip": "pip install package-name"} + "pip": "xpip install package-name"} } } } diff -Nru xonsh-0.5.12+dfsg/docs/xonshconfig.rst xonsh-0.6.0+dfsg/docs/xonshconfig.rst --- xonsh-0.5.12+dfsg/docs/xonshconfig.rst 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/docs/xonshconfig.rst 2017-11-23 00:23:47.000000000 +0000 @@ -112,7 +112,7 @@ Putting it all together ----------------------- -The following ecample shows a fully fleshed out config file. +The following example shows a fully fleshed out config file. :download:`Download config.json ` diff -Nru xonsh-0.5.12+dfsg/.landscape.yaml xonsh-0.6.0+dfsg/.landscape.yaml --- xonsh-0.5.12+dfsg/.landscape.yaml 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/.landscape.yaml 2017-11-23 00:23:47.000000000 +0000 @@ -31,5 +31,5 @@ mccabe: disable: - - MC0000 # not Py3k compatabile + - MC0000 # not Py3k compatible - MC0001 # silly cyclomatic complexity diff -Nru xonsh-0.5.12+dfsg/rever.xsh xonsh-0.6.0+dfsg/rever.xsh --- xonsh-0.5.12+dfsg/rever.xsh 1970-01-01 00:00:00.000000000 +0000 +++ xonsh-0.6.0+dfsg/rever.xsh 2017-11-23 00:23:47.000000000 +0000 @@ -0,0 +1,33 @@ +$PROJECT = $GITHUB_ORG = $GITHUB_REPO = 'xonsh' +$WEBSITE_URL = 'http://xon.sh' +$ACTIVITIES = ['version_bump', 'changelog', 'pytest', + 'sphinx', #'tag', 'pypi', 'conda_forge', 'ghpages', 'ghrelease' + ] + +$VERSION_BUMP_PATTERNS = [ + ('.appveyor.yml', 'version:.*', 'version: $VERSION.{build}'), + ('xonsh/__init__.py', '__version__\s*=.*', "__version__ = '$VERSION'"), + ] +$CHANGELOG_FILENAME = 'CHANGELOG.rst' +$CHANGELOG_TEMPLATE = 'TEMPLATE.rst' + +#$PYTEST_COMMAND = "rm -r .cache/ __pycache__/ */__pycache__ */*/__pycache__ && pytest" + +$TAG_REMOTE = 'git@github.com:xonsh/xonsh.git' +$TAG_TARGET = 'master' + +$GHPAGES_REPO = 'git@github.com:scopatz/xonsh-docs.git' + +$DOCKER_APT_DEPS = ['man'] +with open('requirements-tests.txt') as f: + conda_deps = f.read().split() +with open('requirements-docs.txt') as f: + conda_deps += f.read().split() +conda_deps = {d.lower().split('=')[0] for d in set(conda_deps)} +conda_deps.discard('prompt-toolkit') +conda_deps |= {'prompt_toolkit', 'pip', 'psutil', 'numpy', 'matplotlib'} +$DOCKER_CONDA_DEPS = sorted(conda_deps) +$DOCKER_INSTALL_COMMAND = ('rm -rf .cache/ __pycache__/ */__pycache__ */*/__pycache__ build/ && ' + './setup.py install') +$DOCKER_GIT_NAME = 'xonsh' +$DOCKER_GIT_EMAIL = 'xonsh@googlegroups.com' diff -Nru xonsh-0.5.12+dfsg/setup.py xonsh-0.6.0+dfsg/setup.py --- xonsh-0.5.12+dfsg/setup.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/setup.py 2017-11-23 00:23:47.000000000 +0000 @@ -314,7 +314,7 @@ ) if HAVE_SETUPTOOLS: # WARNING!!! Do not use setuptools 'console_scripts' - # It validates the depenendcies (of which we have none) everytime the + # It validates the dependencies (of which we have none) every time the # 'xonsh' command is run. This validation adds ~0.2 sec. to the startup # time of xonsh - for every single xonsh run. This prevents us from # reaching the goal of a startup time of < 0.1 sec. So never ever write diff -Nru xonsh-0.5.12+dfsg/tests/test_commands_cache.py xonsh-0.6.0+dfsg/tests/test_commands_cache.py --- xonsh-0.5.12+dfsg/tests/test_commands_cache.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/tests/test_commands_cache.py 2017-11-23 00:23:47.000000000 +0000 @@ -49,10 +49,12 @@ PATTERN_BIN_USING_TTY_OR_NOT = [ (False, {10: b'isnotatty'}), (False, {12: b'isatty'}), + (False, {151: b'gpm'}), (False, {10: b'isatty', 100: b'tcgetattr', }), (False, {10: b'isatty', 100: b'tcsetattr'}), (True, {10: b'isatty', 100: b'tcsetattr', 1000: b'tcgetattr'}), (True, {1000: b'libncurses'}), + (True, {4094: b'libgpm'}), (True, {2045: b'tcgetattr', 4095: b'tcgetattr', 6140: b'tcsetattr', 8190: b'isatty'}), ] diff -Nru xonsh-0.5.12+dfsg/tests/test_dirstack_unc.py xonsh-0.6.0+dfsg/tests/test_dirstack_unc.py --- xonsh-0.5.12+dfsg/tests/test_dirstack_unc.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/tests/test_dirstack_unc.py 2017-11-23 00:23:47.000000000 +0000 @@ -140,7 +140,7 @@ assert len(DIRSTACK) == 2 dirstack.popd([]) - assert os.path.isdir(TEMP_DRIVE[0] + '\\'), "Temp drived not unmapped till last reference removed" + assert os.path.isdir(TEMP_DRIVE[0] + '\\'), "Temp drive not unmapped till last reference removed" dirstack.popd([]) assert owd.casefold() == os.getcwd().casefold(), "popd returned cwd to expected dir" assert len(_unc_tempDrives) == 0 diff -Nru xonsh-0.5.12+dfsg/tests/test_execer.py xonsh-0.6.0+dfsg/tests/test_execer.py --- xonsh-0.5.12+dfsg/tests/test_execer.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/tests/test_execer.py 2017-11-23 00:23:47.000000000 +0000 @@ -34,6 +34,11 @@ def test_echo_hello(): assert check_parse('echo hello') + +def test_echo_star_with_semi(): + assert check_parse('echo * spam ; ![echo eggs]\n') + + def test_simple_func(): code = ('def prompt():\n' " return '{user}'.format(user='me')\n") @@ -63,12 +68,12 @@ check_parse(code) def test_good_rhs_subproc(): - # nonsense but parsebale + # nonsense but parsable code = 'str().split() | ![grep exit]\n' assert(code) def test_bad_rhs_subproc(): - # nonsense but unparsebale + # nonsense but unparsable code = 'str().split() | grep exit\n' with pytest.raises(SyntaxError): check_parse(code) diff -Nru xonsh-0.5.12+dfsg/tests/test_integrations.py xonsh-0.6.0+dfsg/tests/test_integrations.py --- xonsh-0.5.12+dfsg/tests/test_integrations.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/tests/test_integrations.py 2017-11-23 00:23:47.000000000 +0000 @@ -248,7 +248,7 @@ ] @pytest.mark.parametrize('case', ALL_PLATFORMS_STDERR) -def test_script_stder(case): +def test_script_stderr(case): script, exp_err, exp_rtn = case out, err, rtn = run_xonsh(script, stderr=sp.PIPE) assert exp_err == err @@ -264,6 +264,14 @@ check_run_xonsh(cmd, fmt, exp) +def test_eof_syntax_error(): + """Ensures syntax errors for EOF appear on last line.""" + script = 'x = 1\na = (1, 0\n' + out, err, rtn = run_xonsh(script, stderr=sp.PIPE) + assert ':0:0: EOF in multi-line statement' not in err + assert ':2:0: EOF in multi-line statement' in err + + _bad_case = pytest.mark.skipif(ON_DARWIN or ON_WINDOWS or ON_TRAVIS, reason="bad platforms") diff -Nru xonsh-0.5.12+dfsg/tests/test_lexer.py xonsh-0.6.0+dfsg/tests/test_lexer.py --- xonsh-0.5.12+dfsg/tests/test_lexer.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/tests/test_lexer.py 2017-11-23 00:23:47.000000000 +0000 @@ -91,18 +91,22 @@ def test_int_literal(): assert check_token('42', ['NUMBER', '42', 0]) + assert check_token('4_2', ['NUMBER', '4_2', 0]) def test_hex_literal(): assert check_token('0x42', ['NUMBER', '0x42', 0]) + assert check_token('0x4_2', ['NUMBER', '0x4_2', 0]) def test_oct_o_literal(): assert check_token('0o42', ['NUMBER', '0o42', 0]) + assert check_token('0o4_2', ['NUMBER', '0o4_2', 0]) def test_bin_literal(): assert check_token('0b101010', ['NUMBER', '0b101010', 0]) + assert check_token('0b10_10_10', ['NUMBER', '0b10_10_10', 0]) def test_indent(): @@ -345,6 +349,14 @@ assert check_token('r"yo"', ['STRING', 'r"yo"', 0]) +def test_single_f_string_literal(): + assert check_token("f'{yo}'", ['STRING', "f'{yo}'", 0]) + + +def test_double_f_string_literal(): + assert check_token('f"{yo}"', ['STRING', 'f"{yo}"', 0]) + + def test_single_unicode_literal(): assert check_token("u'yo'", ['STRING', "u'yo'", 0]) @@ -374,7 +386,7 @@ @pytest.mark.parametrize('case', [ - '0.0', '.0', '0.', '1e10', '1.e42', '0.1e42', '0.5e-42', '5E10', '5e+42']) + '0.0', '.0', '0.', '1e10', '1.e42', '0.1e42', '0.5e-42', '5E10', '5e+42', '1_0e1_0']) def test_float_literals(case): assert check_token(case, ['NUMBER', case, 0]) diff -Nru xonsh-0.5.12+dfsg/tests/test_main.py xonsh-0.6.0+dfsg/tests/test_main.py --- xonsh-0.5.12+dfsg/tests/test_main.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/tests/test_main.py 2017-11-23 00:23:47.000000000 +0000 @@ -8,6 +8,7 @@ import sys import xonsh.main +from xonsh.main import XonshMode from xonsh.environ import Env import pytest from tools import TEST_DIR @@ -50,14 +51,48 @@ assert (builtins.__xonsh_env__.get('TEST2') == 'LOL') -def test_premain_custom_rc(shell, tmpdir): +def test_premain_custom_rc(shell, tmpdir, monkeypatch): + monkeypatch.setattr(sys.stdin, 'isatty', lambda: True) builtins.__xonsh_env__ = Env(XONSH_CACHE_SCRIPTS=False) f = tmpdir.join('wakkawakka') f.write("print('hi')") - xonsh.main.premain(['--rc', f.strpath]) + args = xonsh.main.premain(['--rc', f.strpath]) + assert args.mode == XonshMode.interactive assert f.strpath in builtins.__xonsh_env__.get('XONSHRC') +def test_no_rc_with_script(shell, tmpdir): + args = xonsh.main.premain(['tests/sample.xsh']) + assert not (args.mode == XonshMode.interactive) + + +def test_force_interactive_rc_with_script(shell, tmpdir): + args = xonsh.main.premain(['-i', 'tests/sample.xsh']) + assert builtins.__xonsh_env__.get('XONSH_INTERACTIVE') + + +def test_force_interactive_custom_rc_with_script(shell, tmpdir): + """Calling a custom RC file on a script-call with the interactive flag + should run interactively + """ + builtins.__xonsh_env__ = Env(XONSH_CACHE_SCRIPTS=False) + f = tmpdir.join('wakkawakka') + f.write("print('hi')") + args = xonsh.main.premain(['-i', '--rc', f.strpath, 'tests/sample.xsh']) + assert args.mode == XonshMode.interactive + assert f.strpath in builtins.__xonsh_env__.get('XONSHRC') + + +def test_custom_rc_with_script(shell, tmpdir): + """Calling a custom RC file on a script-call without the interactive flag + should not run interactively + """ + f = tmpdir.join('wakkawakka') + f.write("print('hi')") + args = xonsh.main.premain(['--rc', f.strpath, 'tests/sample.xsh']) + assert not (args.mode == XonshMode.interactive) + + def test_premain_no_rc(shell, tmpdir): xonsh.main.premain(['--no-rc']) assert not builtins.__xonsh_env__.get('XONSHRC') diff -Nru xonsh-0.5.12+dfsg/tests/test_parser.py xonsh-0.6.0+dfsg/tests/test_parser.py --- xonsh-0.5.12+dfsg/tests/test_parser.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/tests/test_parser.py 2017-11-23 00:23:47.000000000 +0000 @@ -7,10 +7,10 @@ import pytest -from xonsh.ast import AST, With, Pass +from xonsh.ast import AST, With, Pass, pdump from xonsh.parser import Parser -from tools import VER_FULL, skip_if_py34, nodes_equal +from tools import VER_FULL, skip_if_py34, skip_if_lt_py36, nodes_equal # a lot of col_offset data changed from Py v3.5.0 -> v3.5.1 INC_ATTRS = (3, 5, 1) <= VER_FULL @@ -22,23 +22,23 @@ PARSER = Parser(lexer_optimize=False, yacc_optimize=False, yacc_debug=True) -def check_ast(inp, run=True, mode='eval'): +def check_ast(inp, run=True, mode='eval', debug_level=0): __tracebackhide__ = True # expect a Python AST exp = ast.parse(inp, mode=mode) # observe something from xonsh - obs = PARSER.parse(inp, debug_level=0) + obs = PARSER.parse(inp, debug_level=debug_level) # Check that they are equal assert nodes_equal(exp, obs) # round trip by running xonsh AST via Python if run: exec(compile(obs, '', mode)) -def check_stmts(inp, run=True, mode='exec'): +def check_stmts(inp, run=True, mode='exec', debug_level=0): __tracebackhide__ = True if not inp.endswith('\n'): inp += '\n' - check_ast(inp, run=run, mode=mode) + check_ast(inp, run=run, mode=mode, debug_level=debug_level) def check_xonsh_ast(xenv, inp, run=True, mode='eval', debug_level=0, return_obs=False): @@ -69,9 +69,17 @@ def test_int_literal(): check_ast('42') +@skip_if_lt_py36 +def test_int_literal_underscore(): + check_ast('4_2') + def test_float_literal(): check_ast('42.0') +@skip_if_lt_py36 +def test_float_literal_underscore(): + check_ast('4_2.4_2') + def test_imag_literal(): check_ast('42j') @@ -92,6 +100,11 @@ check_ast('r"hell\o"') check_ast('R"hell\o"') +@skip_if_lt_py36 +def test_f_literal(): + check_ast('f"wakka{yo}yakka{42}"', run=False) + check_ast('F"{yo}"', run=False) + def test_raw_bytes_literal(): check_ast('br"hell\o"') check_ast('RB"hell\o"') diff -Nru xonsh-0.5.12+dfsg/tests/test_path_completers.py xonsh-0.6.0+dfsg/tests/test_path_completers.py --- xonsh-0.5.12+dfsg/tests/test_path_completers.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/tests/test_path_completers.py 2017-11-23 00:23:47.000000000 +0000 @@ -1,5 +1,20 @@ +import pytest + +from xonsh.environ import Env import xonsh.completers.path as xcp + def test_pattern_need_quotes(): # just make sure the regex compiles xcp.PATTERN_NEED_QUOTES.match('') + + +def test_complete_path(xonsh_builtins): + xonsh_builtins.__xonsh_env__ = {'CASE_SENSITIVE_COMPLETIONS': False, + 'GLOB_SORTED': True, + 'SUBSEQUENCE_PATH_COMPLETION': False, + 'FUZZY_PATH_COMPLETION': False, + 'SUGGEST_THRESHOLD': 3, + 'CDPATH': set(), + } + xcp.complete_path('[1-0.1]', '[1-0.1]', 0, 7, dict()) diff -Nru xonsh-0.5.12+dfsg/tests/test_ptk_history.py xonsh-0.6.0+dfsg/tests/test_ptk_history.py --- xonsh-0.5.12+dfsg/tests/test_ptk_history.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/tests/test_ptk_history.py 2017-11-23 00:23:47.000000000 +0000 @@ -10,7 +10,7 @@ @pytest.fixture def history_obj(): - """Instatiate `PromptToolkitHistory` and append a line string""" + """Instantiate `PromptToolkitHistory` and append a line string""" hist = PromptToolkitHistory(load_prev=False) hist.append('line10') return hist diff -Nru xonsh-0.5.12+dfsg/tests/test_tools.py xonsh-0.6.0+dfsg/tests/test_tools.py --- xonsh-0.5.12+dfsg/tests/test_tools.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/tests/test_tools.py 2017-11-23 00:23:47.000000000 +0000 @@ -5,9 +5,11 @@ import pathlib import stat from tempfile import TemporaryDirectory +import warnings import pytest +from xonsh import __version__ from xonsh.platform import ON_WINDOWS from xonsh.lexer import Lexer @@ -24,8 +26,8 @@ is_string_seq, pathsep_to_seq, seq_to_pathsep, is_nonstring_seq_of_strings, pathsep_to_upper_seq, seq_to_upper_pathsep, expandvars, is_int_as_str, is_slice_as_str, ensure_timestamp, get_portions, is_balanced, subexpr_before_unbalanced, - swap_values, get_logical_line, replace_logical_line, check_quotes, - ) + swap_values, get_logical_line, replace_logical_line, check_quotes, deprecated, + is_writable_file, balanced_parens) from xonsh.environ import Env from tools import skip_if_on_windows, skip_if_on_unix @@ -401,6 +403,7 @@ " --option2 value2 \\\n" " --optionZ valueZ", 1, "echo --option1 value1 --option2 value2 --optionZ valueZ", 3), +('"""\n', 0, '"""', 1), ] @pytest.mark.parametrize('src, idx, exp_line, exp_n', LOGICAL_LINE_CASES) @@ -429,6 +432,7 @@ ("'y'", True), ('b"x"', True), ("r'y'", True), + ("f'z'", True), ('"""hello\nmom"""', True), ]) def test_check_quotes(inp, exp): @@ -478,6 +482,26 @@ assert exp == obs +@pytest.mark.parametrize('line, exp', [ + ('', True), + ('wakka jawaka', True), + ('rm *; echo hello world', True), + ('()', True), + ('f()', True), + ('echo * yo ; echo eggs', True), + ('(', False), + (')', False), + ('(cmd;', False), + ('cmd;)', False), +]) +def test_balanced_parens(line, exp): + obs = balanced_parens(line, lexer=LEXER) + if exp: + assert obs + else: + assert not obs + + @pytest.mark.parametrize('line, mincol, exp', [ ('ls && echo a', 0, 4), ('ls && echo a', 6, None), @@ -487,6 +511,7 @@ ('not (ls) && echo a', 0, 8), ('bash -c ! export var=42; echo $var', 0, 35), ('python -c ! import os; print(os.path.abspath("/"))', 0, 51), + ('echo * yo ; echo eggs', 0, 11), ]) def test_find_next_break(line, mincol, exp): obs = find_next_break(line, mincol=mincol, lexer=LEXER) @@ -681,6 +706,19 @@ assert exp == obs +@pytest.mark.parametrize('left, right, exp', [ + (EnvPath(['/home/wakka']), ['/home/jawaka'], EnvPath(['/home/wakka', '/home/jawaka'])), + (['a'], EnvPath(['b']), EnvPath(['a', 'b'])), + (EnvPath(['c']), EnvPath(['d']), EnvPath(['c', 'd'])), +]) +def test_env_path_add(left, right, exp): + obs = left + right + assert is_env_path(obs) + assert exp == obs + + + + # helper def expand(path): return os.path.expanduser(os.path.expandvars(path)) @@ -1006,7 +1044,8 @@ (None, None), ('throwback.log', 'throwback.log'), skip_if_on_windows(('/dev/null', '/dev/null')), - skip_if_on_windows(('/dev/nonexistent_dev', None)) + skip_if_on_windows(('/dev/nonexistent_dev', + '/dev/nonexistent_dev' if is_writable_file('/dev/nonexistent_dev') else None)) ]) def test_to_logfile_opt(inp, exp): obs = to_logfile_opt(inp) @@ -1054,7 +1093,7 @@ ('foo&bar', 'foo^&bar'), ('foo$?-/_"\\', 'foo$?-/_^"\\'), ('^&<>|', '^^^&^<^>^|'), - ('this /?', 'this /.') + ('()<>','^(^)^<^>'), ]) def test_escape_windows_cmd_string(st, esc): obs = escape_windows_cmd_string(st) @@ -1247,3 +1286,77 @@ assert orig['y'] == 43 assert orig['x'] == 1 assert 'y' not in orig + + +@pytest.mark.parametrize('arguments, expected_docstring', [ + ({'deprecated_in': '0.5.10', 'removed_in': '0.6.0'}, + 'my_function has been deprecated in version 0.5.10 and will be removed ' + 'in version 0.6.0'), + ({'deprecated_in': '0.5.10'}, + 'my_function has been deprecated in version 0.5.10'), + ({'removed_in': '0.6.0'}, + 'my_function has been deprecated and will be removed in version 0.6.0'), + ({}, + 'my_function has been deprecated') +]) +def test_deprecated_docstrings_with_empty_docstring( + arguments, expected_docstring): + @deprecated(**arguments) + def my_function(): pass + + assert my_function.__doc__ == expected_docstring + + +@pytest.mark.parametrize('arguments, expected_docstring', [ + ({'deprecated_in': '0.5.10', 'removed_in': '0.6.0'}, + 'Does nothing.\n\nmy_function has been deprecated in version 0.5.10 and ' + 'will be removed in version 0.6.0'), + ({'deprecated_in': '0.5.10'}, + 'Does nothing.\n\nmy_function has been deprecated in version 0.5.10'), + ({'removed_in': '0.6.0'}, + 'Does nothing.\n\nmy_function has been deprecated and will be removed ' + 'in version 0.6.0'), + ({}, + 'Does nothing.\n\nmy_function has been deprecated') +]) +def test_deprecated_docstrings_with_nonempty_docstring( + arguments, expected_docstring): + @deprecated(**arguments) + def my_function(): + """Does nothing.""" + pass + + assert my_function.__doc__ == expected_docstring + + +def test_deprecated_warning_raised(): + @deprecated() + def my_function(): pass + + with warnings.catch_warnings(record=True) as warning: + warnings.simplefilter('always') + + my_function() + + assert issubclass(warning.pop().category, DeprecationWarning) + + +def test_deprecated_warning_contains_message(): + @deprecated() + def my_function(): pass + + with warnings.catch_warnings(record=True) as warning: + warnings.simplefilter('always') + + my_function() + + assert str(warning.pop().message) == 'my_function has been deprecated' + + +@pytest.mark.parametrize('expired_version', ['0.1.0', __version__]) +def test_deprecated_past_expiry_raises_assertion_error(expired_version): + @deprecated(removed_in=expired_version) + def my_function(): pass + + with pytest.raises(AssertionError): + my_function() diff -Nru xonsh-0.5.12+dfsg/tests/tools.py xonsh-0.6.0+dfsg/tests/tools.py --- xonsh-0.5.12+dfsg/tests/tools.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/tests/tools.py 2017-11-23 00:23:47.000000000 +0000 @@ -19,17 +19,19 @@ VER_3_4 = (3, 4) VER_3_5 = (3, 5) +VER_3_6 = (3, 6) VER_MAJOR_MINOR = sys.version_info[:2] VER_FULL = sys.version_info[:3] ON_DARWIN = (platform.system() == 'Darwin') ON_WINDOWS = (platform.system() == 'Windows') ON_CONDA = True in [conda in pytest.__file__.lower() for conda - in ['anaconda', 'miniconda']] + in ['conda', 'anaconda', 'miniconda']] ON_TRAVIS = 'TRAVIS' in os.environ and 'CI' in os.environ TEST_DIR = os.path.dirname(__file__) # pytest skip decorators skip_if_py34 = pytest.mark.skipif(VER_MAJOR_MINOR < VER_3_5, reason="Py3.5+ only test") +skip_if_lt_py36 = pytest.mark.skipif(VER_MAJOR_MINOR < VER_3_6, reason="Py3.6+ only test") skip_if_on_conda = pytest.mark.skipif(ON_CONDA, reason="Conda and virtualenv _really_ hate each other") diff -Nru xonsh-0.5.12+dfsg/xonsh/aliases.py xonsh-0.6.0+dfsg/xonsh/aliases.py --- xonsh-0.5.12+dfsg/xonsh/aliases.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/aliases.py 2017-11-23 00:23:47.000000000 +0000 @@ -15,7 +15,7 @@ from xonsh.jobs import jobs, fg, bg, clean_jobs from xonsh.platform import (ON_ANACONDA, ON_DARWIN, ON_WINDOWS, ON_FREEBSD, ON_NETBSD) -from xonsh.tools import unthreadable +from xonsh.tools import unthreadable, print_color from xonsh.replay import replay_main from xonsh.timings import timeit_alias from xonsh.tools import argvquote, escape_windows_cmd_string, to_bool, swap_values @@ -285,6 +285,12 @@ raise RuntimeError('must source at least one file, ' + fname + 'does not exist.') break + _, fext = os.path.splitext(fpath) + if fext and fext != '.xsh' and fext != '.py': + raise RuntimeError('attempting to source non-xonsh file! If you are ' + 'trying to source a file in another language, ' + 'then please use the appropriate source command. ' + 'For example, source-bash script.sh') with open(fpath, 'r', encoding=encoding, errors=errors) as fp: src = fp.read() if not src.endswith('\n'): @@ -292,7 +298,15 @@ ctx = builtins.__xonsh_ctx__ updates = {'__file__': fpath, '__name__': os.path.abspath(fpath)} with env.swap(ARGS=args[i+1:]), swap_values(ctx, updates): - builtins.execx(src, 'exec', ctx, filename=fpath) + try: + builtins.execx(src, 'exec', ctx, filename=fpath) + except Exception: + print_color('{RED}You may be attempting to source non-xonsh file! ' + '{NO_COLOR}If you are trying to source a file in ' + 'another language, then please use the appropriate ' + 'source command. For example, {GREEN}source-bash ' + 'script.sh{NO_COLOR}', file=sys.stderr) + raise def source_cmd(args, stdin=None): @@ -402,9 +416,9 @@ sys.displayhook(args) -def detect_xip_alias(): +def detect_xpip_alias(): """ - Determines the correct invokation to get xonsh's pip + Determines the correct invocation to get xonsh's pip """ if not getattr(sys, 'executable', None): return lambda args, stdin=None: ("", "Sorry, unable to run pip on your system (missing sys.executable)", 1) @@ -454,7 +468,7 @@ 'which': xxw.which, 'xontrib': xontribs_main, 'completer': xca.completer_alias, - 'xip': detect_xip_alias(), + 'xpip': detect_xpip_alias(), } if ON_WINDOWS: # Borrow builtin commands from cmd.exe. diff -Nru xonsh-0.5.12+dfsg/xonsh/ansi_colors.py xonsh-0.6.0+dfsg/xonsh/ansi_colors.py --- xonsh-0.5.12+dfsg/xonsh/ansi_colors.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/ansi_colors.py 2017-11-23 00:23:47.000000000 +0000 @@ -6,7 +6,7 @@ from xonsh.platform import HAS_PYGMENTS from xonsh.lazyasd import LazyDict -from xonsh.color_tools import (RE_BACKGROUND, BASE_XONSH_COLORS, make_pallete, +from xonsh.color_tools import (RE_BACKGROUND, BASE_XONSH_COLORS, make_palette, find_closest_color, rgb2short, rgb_to_256) @@ -19,7 +19,7 @@ template : str The template string, potentially with color names. style : str, optional - Sytle name to look up color map from. + Style name to look up color map from. cmap : dict, optional A color map to use, this will prevent the color map from being looked up via the style name. @@ -866,11 +866,11 @@ # # Dynamically generated styles # -def make_ansi_style(pallette): - """Makes an ANSI color style from a color pallette""" +def make_ansi_style(palette): + """Makes an ANSI color style from a color palette""" style = {'NO_COLOR': '0'} for name, t in BASE_XONSH_COLORS.items(): - closest = find_closest_color(t, pallette) + closest = find_closest_color(t, palette) if len(closest) == 3: closest = ''.join([a*2 for a in closest]) short = rgb2short(closest)[0] @@ -892,7 +892,7 @@ raise KeyError('could not find style {0!r}'.format(name)) from pygments.styles import get_style_by_name pstyle = get_style_by_name(name) - pallette = make_pallete(pstyle.styles.values()) - astyle = make_ansi_style(pallette) + palette = make_palette(pstyle.styles.values()) + astyle = make_ansi_style(palette) ANSI_STYLES[name] = astyle return astyle diff -Nru xonsh-0.5.12+dfsg/xonsh/ast.py xonsh-0.6.0+dfsg/xonsh/ast.py --- xonsh-0.5.12+dfsg/xonsh/ast.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/ast.py 2017-11-23 00:23:47.000000000 +0000 @@ -31,6 +31,13 @@ else: MatMult = AsyncFunctionDef = AsyncWith = AsyncFor = Await = None +if PYTHON_VERSION_INFO >= (3, 6, 0): + # pylint: disable=unused-import + # pylint: disable=no-name-in-module + from ast import JoinedStr, FormattedValue +else: + JoinedStr = FormattedValue = None + STATEMENTS = (FunctionDef, ClassDef, Return, Delete, Assign, AugAssign, For, While, If, With, Raise, Try, Assert, Import, ImportFrom, Global, Nonlocal, Expr, Pass, Break, Continue) @@ -52,7 +59,7 @@ rtn = leftmostname(node.values[0]) elif isinstance(node, Assign): rtn = leftmostname(node.targets[0]) - elif isinstance(node, (Str, Bytes)): + elif isinstance(node, (Str, Bytes, JoinedStr)): # handles case of "./my executable" rtn = leftmostname(node.s) elif isinstance(node, Tuple) and len(node.elts) > 0: @@ -160,7 +167,7 @@ def isdescendable(node): - """Deteremines whether or not a node is worth visiting. Currently only + """Determines whether or not a node is worth visiting. Currently only UnaryOp and BoolOp nodes are visited. """ return isinstance(node, (UnaryOp, BoolOp)) @@ -177,7 +184,7 @@ """Parameters ---------- parser : xonsh.Parser - A parse instance to try to parse suprocess statements with. + A parse instance to try to parse subprocess statements with. """ super(CtxAwareTransformer, self).__init__() self.parser = parser @@ -250,6 +257,8 @@ lexer=self.parser.lexer) elif nlogical > 1: maxcol = None + elif maxcol < len(line) and line[maxcol] == ';': + pass else: maxcol += 1 spline = subproc_toks(line, mincol=mincol, maxcol=maxcol, diff -Nru xonsh-0.5.12+dfsg/xonsh/base_shell.py xonsh-0.6.0+dfsg/xonsh/base_shell.py --- xonsh-0.5.12+dfsg/xonsh/base_shell.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/base_shell.py 2017-11-23 00:23:47.000000000 +0000 @@ -213,10 +213,10 @@ class Tee: - """Class that merges tee'd stdout and stderr into a single strea,. + """Class that merges tee'd stdout and stderr into a single stream. This represents what a user would actually see on the command line. - This class as the same interface as io.TextIOWrapper, except that + This class has the same interface as io.TextIOWrapper, except that the buffer is optional. """ # pylint is a stupid about counting public methods when using inheritance. @@ -339,8 +339,12 @@ hist.last_cmd_rtn = 1 # return code for failure finally: ts1 = ts1 or time.time() - self._append_history(inp=src, ts=[ts0, ts1], tee_out=tee.getvalue()) + tee_out = tee.getvalue() + self._append_history(inp=src, ts=[ts0, ts1], tee_out=tee_out) self.accumulated_inputs += src + append_newline = env.get('XONSH_APPEND_NEWLINE') + if append_newline and not tee_out.endswith(os.linesep): + print(os.linesep, end='') tee.close() self._fix_cwd() if builtins.__xonsh_exit__: # pylint: disable=no-member @@ -480,7 +484,7 @@ kernel32.SetConsoleTitleW(t) else: with open(1, 'wb', closefd=False) as f: - # prevent xonsh from answering interative questions + # prevent xonsh from answering interactive questions # on the next command by writing the title f.write("\x1b]0;{0}\x07".format(t).encode()) f.flush() @@ -506,15 +510,15 @@ return p def format_color(self, string, hide=False, force_string=False, **kwargs): - """Formats the colors in a string. This base implmentation colors based - on ANSI color codes + """Formats the colors in a string. ``BaseShell``'s default implementation + of this method uses colors based on ANSI color codes. """ style = builtins.__xonsh_env__.get('XONSH_COLOR_STYLE') return ansi_partial_color_format(string, hide=hide, style=style) def print_color(self, string, hide=False, **kwargs): - """Prints a string in color. This base implmentation will color based - ANSI color codes if a string was given as input. If a list of token + """Prints a string in color. This base implementation's colors are based + on ANSI color codes if a string was given as input. If a list of token pairs is given, it will color based on pygments, if available. If pygments is not available, it will print a colorless string. """ diff -Nru xonsh-0.5.12+dfsg/xonsh/built_ins.py xonsh-0.6.0+dfsg/xonsh/built_ins.py --- xonsh-0.5.12+dfsg/xonsh/built_ins.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/built_ins.py 2017-11-23 00:23:47.000000000 +0000 @@ -191,8 +191,8 @@ if not os.access(fname, os.X_OK): raise PermissionError if ON_POSIX and not os.access(fname, os.R_OK): - # on some systems, some importnat programs (e.g. sudo) will have - # execute permissions but not read/write permisions. This enables + # on some systems, some important programs (e.g. sudo) will have + # execute permissions but not read/write permissions. This enables # things with the SUID set to be run. Needs to come before _is_binary() # is called, because that function tries to read the file. return [fname] + args @@ -348,7 +348,7 @@ class SubprocSpec: - """A container for specifiying how a subprocess command should be + """A container for specifying how a subprocess command should be executed. """ @@ -381,7 +381,7 @@ args : list of str Arguments as originally supplied. alias : list of str, callable, or None - The alias that was reolved for this command, if any. + The alias that was resolved for this command, if any. binary_loc : str or None Path to binary to execute. is_proxy : bool @@ -549,7 +549,7 @@ def _fix_null_cmd_bytes(self): # Popen does not accept null bytes in its input commands. - # that doesn;t stop some subproces from using them. Here we + # That doesn't stop some subprocesses from using them. Here we # escape them just in case. cmd = self.cmd for i in range(len(cmd)): @@ -562,8 +562,8 @@ @classmethod def build(kls, cmd, *, cls=subprocess.Popen, **kwargs): """Creates an instance of the subprocess command, with any - modifcations and adjustments based on the actual cmd that - was recieved. + modifications and adjustments based on the actual cmd that + was received. """ # modifications that do not alter cmds may come before creating instance spec = kls(cmd, cls=cls, **kwargs) @@ -662,7 +662,7 @@ cls = ProcProxyThread if thable else ProcProxy self.cls = cls self.threadable = thable - # also check capturablity, while we are here + # also check capturability, while we are here cpable = getattr(alias, '__xonsh_capturable__', self.captured) self.captured = cpable @@ -781,7 +781,7 @@ specs[-1].background = True else: raise XonshError('unrecognized redirect {0!r}'.format(redirect)) - # Apply boundry conditions + # Apply boundary conditions _update_last_spec(specs[-1]) return specs @@ -942,7 +942,7 @@ Parameters ---------- raw_arg : str - The str reprensetaion of the macro argument. + The str representation of the macro argument. kind : object A flag or type representing how to convert the argument. glbs : Mapping @@ -966,7 +966,7 @@ if isinstance(kind, str): kind = _convert_kind_flag(kind) if kind is str or kind is None: - return raw_arg # short circut since there is nothing else to do + return raw_arg # short circuit since there is nothing else to do # select from kind and convert execer = builtins.__xonsh_execer__ filename = macroname + '(' + name + ')' @@ -992,7 +992,7 @@ arg = type(execer.eval(raw_arg, glbs=glbs, locs=locs, filename=filename)) else: - msg = ('kind={0!r} and mode={1!r} was not recongnized for macro ' + msg = ('kind={0!r} and mode={1!r} was not recognized for macro ' 'argument {2!r}') raise TypeError(msg.format(kind, mode, name)) return arg @@ -1035,9 +1035,9 @@ f : callable object The function that is called as ``f(*args)``. raw_args : tuple of str - The str reprensetaion of arguments of that were passed into the + The str representation of arguments of that were passed into the macro. These strings will be parsed, compiled, evaled, or left as - a string dependending on the annotations of f. + a string depending on the annotations of f. glbs : Mapping The globals from the call site. locs : Mapping or None @@ -1110,7 +1110,7 @@ raw_block : str The str of the block that is the context body. This string will be parsed, compiled, evaled, or left as - a string dependending on the return annotation of obj.__enter__. + a string depending on the return annotation of obj.__enter__. glbs : Mapping The globals from the context site. locs : Mapping or None diff -Nru xonsh-0.5.12+dfsg/xonsh/color_tools.py xonsh-0.6.0+dfsg/xonsh/color_tools.py --- xonsh-0.5.12+dfsg/xonsh/color_tools.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/color_tools.py 2017-11-23 00:23:47.000000000 +0000 @@ -9,6 +9,7 @@ import math from xonsh.lazyasd import lazyobject, LazyObject +from xonsh.tools import deprecated RE_BACKGROUND = LazyObject(lambda: re.compile('(BG#|BGHEX|BACKGROUND)'), @@ -397,17 +398,22 @@ return math.sqrt((x[0]-y[0])**2 + (x[1]-y[1])**2 + (x[2]-y[2])**2) -def find_closest_color(x, pallette): - return min(sorted(pallette.keys())[::-1], - key=lambda k: color_dist(x, pallette[k])) +def find_closest_color(x, palette): + return min(sorted(palette.keys())[::-1], + key=lambda k: color_dist(x, palette[k])) -def make_pallete(strings): - """Makes a color pallete from a colection of strings.""" - pallette = {} +def make_palette(strings): + """Makes a color palette from a collection of strings.""" + palette = {} for s in strings: while '#' in s: _, t = s.split('#', 1) t, _, s = t.partition(' ') - pallette[t] = rgb_to_ints(t) - return pallette + palette[t] = rgb_to_ints(t) + return palette + + +@deprecated(deprecated_in='0.5.10', removed_in='0.6.0') +def make_pallete(*args, **kwargs): + make_palette(*args, **kwargs) diff -Nru xonsh-0.5.12+dfsg/xonsh/commands_cache.py xonsh-0.6.0+dfsg/xonsh/commands_cache.py --- xonsh-0.5.12+dfsg/xonsh/commands_cache.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/commands_cache.py 2017-11-23 00:23:47.000000000 +0000 @@ -3,7 +3,7 @@ a command will be able to be run in the background. A background predictor is a function that accepts a single argument list -and returns whethere or not the process can be run in the background (returns +and returns whether or not the process can be run in the background (returns True) or must be run the foreground (returns False). """ import os @@ -39,7 +39,7 @@ def __iter__(self): for cmd, (path, is_alias) in self.all_commands.items(): if ON_WINDOWS and path is not None: - # All comand keys are stored in uppercase on Windows. + # All command keys are stored in uppercase on Windows. # This ensures the original command name is returned. cmd = pathbasename(path) yield cmd @@ -223,7 +223,7 @@ return predict_true def default_predictor_readbin(self, name, cmd0, timeout, failure): - """Make a defautt predictor by + """Make a default predictor by analyzing the content of the binary. Should only works on POSIX. Return failure if the analysis fails. """ @@ -243,6 +243,7 @@ search_for = { (b'ncurses',): [False, ], + (b'libgpm',): [False, ], (b'isatty', b'tcgetattr', b'tcsetattr'): [False, False, False], } tstart = time.time() @@ -297,7 +298,7 @@ def predict_shell(args): - """Precict the backgroundability of the normal shell interface, which + """Predict the backgroundability of the normal shell interface, which comes down to whether it is being run in subproc mode. """ ns, _ = SHELL_PREDICTOR_PARSER.parse_known_args(args) @@ -319,7 +320,7 @@ def predict_help_ver(args): - """Precict the backgroundability of commands that have help & version + """Predict the backgroundability of commands that have help & version switches: -h, --help, -v, -V, --version. If either of these options is present, the command is assumed to print to stdout normally and is therefore threadable. Otherwise, the command is assumed to not be threadable. @@ -343,9 +344,11 @@ 'cls': predict_false, 'cmd': predict_shell, 'ex': predict_false, + 'emacsclient': predict_false, 'fish': predict_shell, 'gvim': predict_help_ver, 'htop': predict_help_ver, + 'ipython': predict_shell, 'ksh': predict_shell, 'less': predict_help_ver, 'man': predict_help_ver, diff -Nru xonsh-0.5.12+dfsg/xonsh/completers/bash_completion.py xonsh-0.6.0+dfsg/xonsh/completers/bash_completion.py --- xonsh-0.5.12+dfsg/xonsh/completers/bash_completion.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/completers/bash_completion.py 2017-11-23 00:23:47.000000000 +0000 @@ -256,7 +256,7 @@ endidx : int The index in line that prefix ends on. env : Mapping, optional - The environment dict to execute the Bash suprocess in. + The environment dict to execute the Bash subprocess in. paths : list or tuple of str or None, optional This is a list (or tuple) of strings that specifies where the ``bash_completion`` script may be found. The first valid path will diff -Nru xonsh-0.5.12+dfsg/xonsh/completers/init.py xonsh-0.6.0+dfsg/xonsh/completers/init.py --- xonsh-0.5.12+dfsg/xonsh/completers/init.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/completers/init.py 2017-11-23 00:23:47.000000000 +0000 @@ -22,6 +22,7 @@ ('completer', complete_completer), ('skip', complete_skipper), ('pip', complete_pip), + ('xpip', complete_pip), ('cd', complete_cd), ('rmdir', complete_rmdir), ('xonfig', complete_xonfig), diff -Nru xonsh-0.5.12+dfsg/xonsh/completers/path.py xonsh-0.6.0+dfsg/xonsh/completers/path.py --- xonsh-0.5.12+dfsg/xonsh/completers/path.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/completers/path.py 2017-11-23 00:23:47.000000000 +0000 @@ -1,6 +1,7 @@ import os import re import ast +import glob import builtins import xonsh.tools as xt @@ -264,6 +265,7 @@ env = builtins.__xonsh_env__ csc = env.get('CASE_SENSITIVE_COMPLETIONS') glob_sorted = env.get('GLOB_SORTED') + prefix = glob.escape(prefix) for s in xt.iglobpath(prefix + '*', ignore_case=(not csc), sort_result=glob_sorted): paths.add(s) diff -Nru xonsh-0.5.12+dfsg/xonsh/completers/python.py xonsh-0.6.0+dfsg/xonsh/completers/python.py --- xonsh-0.5.12+dfsg/xonsh/completers/python.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/completers/python.py 2017-11-23 00:23:47.000000000 +0000 @@ -169,7 +169,7 @@ return set() funcname = xt.subexpr_before_unbalanced(front, '(', ')') val, _ctx = _safe_eval(funcname, ctx) - if val is None and _ctx is None: + if val is None: return set() try: sig = inspect.signature(val) diff -Nru xonsh-0.5.12+dfsg/xonsh/diff_history.py xonsh-0.6.0+dfsg/xonsh/diff_history.py --- xonsh-0.5.12+dfsg/xonsh/diff_history.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/diff_history.py 2017-11-23 00:23:47.000000000 +0000 @@ -52,7 +52,7 @@ def highlighted_ndiff(a, b): - """Returns a highlited string, with bold charaters where different.""" + """Returns a highlighted string, with bold characters where different.""" s = '' sm = difflib.SequenceMatcher() sm.set_seqs(a, b) diff -Nru xonsh-0.5.12+dfsg/xonsh/dirstack.py xonsh-0.6.0+dfsg/xonsh/dirstack.py --- xonsh-0.5.12+dfsg/xonsh/dirstack.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/dirstack.py 2017-11-23 00:23:47.000000000 +0000 @@ -107,7 +107,7 @@ if left_drive not in _unc_tempDrives: # if not one we've mapped, don't unmap it return - for p in DIRSTACK + [cwd]: # if still in use , don't aunmap it. + for p in DIRSTACK + [cwd]: # if still in use , don't unmap it. if p.casefold().startswith(left_drive): return @@ -161,10 +161,10 @@ # In bash if a CDPATH is set, an unqualified local folder # is considered after all CDPATHs, example: # CDPATH=$HOME/src (with src/xonsh/ inside) - # $ cd xonsh -> src/xonsh (whith xonsh/xonsh) + # $ cd xonsh -> src/xonsh (with xonsh/xonsh) # a second $ cd xonsh has no effects, to move in the nested xonsh # in bash a full $ cd ./xonsh is needed. - # In xonsh a relative folder is allways preferred. + # In xonsh a relative folder is always preferred. env = builtins.__xonsh_env__ cdpaths = env.get('CDPATH') for cdp in cdpaths: diff -Nru xonsh-0.5.12+dfsg/xonsh/environ.py xonsh-0.6.0+dfsg/xonsh/environ.py --- xonsh-0.5.12+dfsg/xonsh/environ.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/environ.py 2017-11-23 00:23:47.000000000 +0000 @@ -47,7 +47,7 @@ events.doc('on_envvar_new', """ on_envvar_new(name: str, value: Any) -> None -Fires after a new enviroment variable is created. +Fires after a new environment variable is created. Note: Setting envvars inside the handler might cause a recursion until the limit. """) @@ -56,7 +56,7 @@ events.doc('on_envvar_change', """ on_envvar_change(name: str, oldvalue: Any, newvalue: Any) -> None -Fires after an enviroment variable is changed. +Fires after an environment variable is changed. Note: Setting envvars inside the handler might cause a recursion until the limit. """) @@ -120,6 +120,7 @@ 'AUTO_CD': (is_bool, to_bool, bool_to_str), 'AUTO_PUSHD': (is_bool, to_bool, bool_to_str), 'AUTO_SUGGEST': (is_bool, to_bool, bool_to_str), + 'AUTO_SUGGEST_IN_COMPLETIONS': (is_bool, to_bool, bool_to_str), 'BASH_COMPLETIONS': (is_env_path, str_to_env_path, env_path_to_str), 'CASE_SENSITIVE_COMPLETIONS': (is_bool, to_bool, bool_to_str), re.compile('\w*DIRS$'): (is_env_path, str_to_env_path, env_path_to_str), @@ -179,6 +180,7 @@ 'VIRTUAL_ENV': (is_string, ensure_string, ensure_string), 'WIN_UNICODE_CONSOLE': (always_false, setup_win_unicode_console, bool_to_str), 'XONSHRC': (is_env_path, str_to_env_path, env_path_to_str), + 'XONSH_APPEND_NEWLINE': (is_bool, to_bool, bool_to_str), 'XONSH_AUTOPAIR': (is_bool, to_bool, bool_to_str), 'XONSH_CACHE_SCRIPTS': (is_bool, to_bool, bool_to_str), 'XONSH_CACHE_EVERYTHING': (is_bool, to_bool, bool_to_str), @@ -264,6 +266,7 @@ 'AUTO_CD': False, 'AUTO_PUSHD': False, 'AUTO_SUGGEST': True, + 'AUTO_SUGGEST_IN_COMPLETIONS': True, 'BASH_COMPLETIONS': BASH_COMPLETIONS_DEFAULT, 'CASE_SENSITIVE_COMPLETIONS': ON_LINUX, 'CDPATH': (), @@ -325,6 +328,7 @@ 'share')), 'XONSHCONFIG': xonshconfig, 'XONSHRC': default_xonshrc, + 'XONSH_APPEND_NEWLINE': False, 'XONSH_AUTOPAIR': False, 'XONSH_CACHE_SCRIPTS': True, 'XONSH_CACHE_EVERYTHING': False, @@ -392,6 +396,10 @@ 'Enable automatic command suggestions based on history, like in the fish ' 'shell.\n\nPressing the right arrow key inserts the currently ' 'displayed suggestion. Only usable with ``$SHELL_TYPE=prompt_toolkit.``'), + 'AUTO_SUGGEST_IN_COMPLETIONS': VarDocs( + 'Places the auto-suggest result as the first option in the completions. ' + 'This enables you to tab complete the auto-suggestion.' + ), 'BASH_COMPLETIONS': VarDocs( 'This is a list (or tuple) of strings that specifies where the ' '``bash_completion`` script may be found. ' @@ -521,7 +529,7 @@ configurable=False), 'PATH': VarDocs( 'List of strings representing where to look for executables.'), - 'PATHEXT': VarDocs('Sequence of extention strings (eg, ``.EXE``) for ' + 'PATHEXT': VarDocs('Sequence of extension strings (eg, ``.EXE``) for ' 'filtering valid executables by. Each element must be ' 'uppercase.'), 'PRETTY_PRINT_RESULTS': VarDocs( @@ -545,12 +553,12 @@ 'The error that is raised is a ``subprocess.CalledProcessError``.'), 'RIGHT_PROMPT': VarDocs( 'Template string for right-aligned text ' - 'at the prompt. This may be parameterized in the same way as ' + 'at the prompt. This may be parametrized in the same way as ' 'the ``$PROMPT`` variable. Currently, this is only available in the ' 'prompt-toolkit shell.'), 'BOTTOM_TOOLBAR': VarDocs( 'Template string for the bottom toolbar. ' - 'This may be parameterized in the same way as ' + 'This may be parametrized in the same way as ' 'the ``$PROMPT`` variable. Currently, this is only available in the ' 'prompt-toolkit shell.'), 'SHELL_TYPE': VarDocs( @@ -580,7 +588,7 @@ 'command will be offered as a suggestion. Also used for "fuzzy" ' 'tab completion of paths.'), 'SUPPRESS_BRANCH_TIMEOUT_MESSAGE': VarDocs( - 'Whether or not to supress branch timeout warning messages.'), + 'Whether or not to suppress branch timeout warning messages.'), 'TERM': VarDocs( 'TERM is sometimes set by the terminal emulator. This is used (when ' "valid) to determine whether or not to set the title. Users shouldn't " @@ -645,6 +653,9 @@ "On Linux & Mac OSX: ``['/etc/xonshrc', '~/.xonshrc']``\n" "\nOn Windows: " "``['%ALLUSERSPROFILE%\\\\xonsh\\\\xonshrc', '~/.xonshrc']``")), + 'XONSH_APPEND_NEWLINE': VarDocs( + 'Append new line when a partial line is preserved in output.' + ), 'XONSH_AUTOPAIR': VarDocs( 'Whether Xonsh will auto-insert matching parentheses, brackets, and ' 'quotes. Only available under the prompt-toolkit shell.' @@ -664,7 +675,7 @@ 'XONSH_DEBUG': VarDocs( 'Sets the xonsh debugging level. This may be an integer or a boolean. ' 'Setting this variable prior to stating xonsh to ``1`` or ``True`` ' - 'will supress amalgamated imports. Setting it to ``2`` will get some ' + 'will suppress amalgamated imports. Setting it to ``2`` will get some ' 'basic information like input transformation, command replacement. ' 'With ``3`` or a higher number will make more debugging information ' 'presented, like PLY parsing messages.', @@ -720,7 +731,7 @@ '``True`` if xonsh is running as a login shell, and ``False`` otherwise.', configurable=False), 'XONSH_PROC_FREQUENCY': VarDocs( - 'The process frquency is the time that ' + 'The process frequency is the time that ' 'xonsh process threads sleep for while running command pipelines. ' 'The value has units of seconds [s].'), 'XONSH_SHOW_TRACEBACK': VarDocs( @@ -772,7 +783,7 @@ * PATH: any variable whose name ends in PATH is a list of strings. * XONSH_HISTORY_SIZE: this variable is an (int | float, str) tuple. - * LC_* (locale categories): locale catergory names get/set the Python + * LC_* (locale categories): locale category names get/set the Python locale via locale.getlocale() and locale.setlocale() functions. An Env instance may be converted to an untyped version suitable for @@ -831,7 +842,7 @@ def replace_env(self): """Replaces the contents of os_environ with a detyped version - of the xonsh environement. + of the xonsh environment. """ if self._orig_env is None: self._orig_env = dict(os_environ) @@ -840,7 +851,7 @@ def undo_replace_env(self): """Replaces the contents of os_environ with a detyped version - of the xonsh environement. + of the xonsh environment. """ if self._orig_env is not None: os_environ.clear() @@ -874,7 +885,7 @@ return vd def help(self, key): - """Get information about a specific enviroment variable.""" + """Get information about a specific environment variable.""" vardocs = self.get_docs(key) width = min(79, os.get_terminal_size()[0]) docstr = '\n'.join(textwrap.wrap(vardocs.docstr, width=width)) diff -Nru xonsh-0.5.12+dfsg/xonsh/events.py xonsh-0.6.0+dfsg/xonsh/events.py --- xonsh-0.5.12+dfsg/xonsh/events.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/events.py 2017-11-23 00:23:47.000000000 +0000 @@ -24,7 +24,7 @@ return builtins.__xonsh_env__.get('XONSH_DEBUG') # FIXME: Under py.test, return 1(?) else: - return 0 # Optimize for speed, not guarenteed correctness + return 0 # Optimize for speed, not guaranteed correctness class AbstractEvent(collections.abc.MutableSet, abc.ABC): @@ -267,7 +267,7 @@ ---------- name : str The name of the event, eg "on_precommand" - species : sublcass of AbstractEvent + species : subclass of AbstractEvent The type to turn the event in to. """ if isinstance(species, str): diff -Nru xonsh-0.5.12+dfsg/xonsh/execer.py xonsh-0.6.0+dfsg/xonsh/execer.py --- xonsh-0.5.12+dfsg/xonsh/execer.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/execer.py 2017-11-23 00:23:47.000000000 +0000 @@ -9,7 +9,7 @@ from xonsh.ast import CtxAwareTransformer from xonsh.parser import Parser from xonsh.tools import (subproc_toks, find_next_break, get_logical_line, - replace_logical_line) + replace_logical_line, balanced_parens) from xonsh.built_ins import load_builtins, unload_builtins @@ -65,7 +65,7 @@ # Parsing actually happens in a couple of phases. The first is a # shortcut for a context-free parser. Normally, all subprocess # lines should be wrapped in $(), to indicate that they are a - # subproc. But that would be super annoying. Unfortnately, Python + # subproc. But that would be super annoying. Unfortunately, Python # mode - after indentation - is whitespace agnostic while, using # the Python token, subproc mode is whitespace aware. That is to say, # in Python mode "ls -l", "ls-l", and "ls - l" all parse to the @@ -187,7 +187,7 @@ if len(line.strip()) == 0: # whitespace only lines are not valid syntax in Python's # interactive mode='single', who knew?! Just ignore them. - # this might cause actual sytax errors to have bad line + # this might cause actual syntax errors to have bad line # numbers reported, but should only affect interactive mode del lines[idx] last_error_line = last_error_col = -1 @@ -208,8 +208,9 @@ # go greedy the first time if the syntax error was because # we hit an end token out of place. This usually indicates # a subshell or maybe a macro. - greedy = True - maxcol = None + if not balanced_parens(line, maxcol=maxcol): + greedy = True + maxcol = None sbpline = subproc_toks(line, returnline=True, greedy=greedy, maxcol=maxcol, lexer=lexer) if sbpline is None: diff -Nru xonsh-0.5.12+dfsg/xonsh/foreign_shells.py xonsh-0.6.0+dfsg/xonsh/foreign_shells.py --- xonsh-0.5.12+dfsg/xonsh/foreign_shells.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/foreign_shells.py 2017-11-23 00:23:47.000000000 +0000 @@ -88,7 +88,7 @@ echo ${namefile}""" -# mapping of shell name alises to keys in other lookup dictionaries. +# mapping of shell name aliases to keys in other lookup dictionaries. @lazyobject def CANON_SHELL_NAMES(): return { @@ -197,7 +197,7 @@ aliascmd : str or None, optional The command to generate alias output with. extra_args : tuple of str, optional - Addtional command line options to pass into the shell. + Additional command line options to pass into the shell. currenv : tuple of items or None, optional Manual override for the current environment. safe : bool, optional @@ -248,7 +248,7 @@ env : dict Dictionary of shell's environment. (None if the subproc command fails) aliases : dict - Dictionary of shell's alaiases, this includes foreign function + Dictionary of shell's aliases, this includes foreign function wrappers.(None if the subproc command fails) """ cmd = [shell] @@ -425,9 +425,9 @@ filename : str Where the function is defined, path to source. sourcer : str or None, optional - Command to source foreing files with. + Command to source foreign files with. extra_args : tuple of str, optional - Addtional command line options to pass into the shell. + Additional command line options to pass into the shell. """ sourcer = DEFAULT_SOURCERS.get(shell, 'source') if sourcer is None \ else sourcer diff -Nru xonsh-0.5.12+dfsg/xonsh/history/base.py xonsh-0.6.0+dfsg/xonsh/history/base.py --- xonsh-0.5.12+dfsg/xonsh/history/base.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/history/base.py 2017-11-23 00:23:47.000000000 +0000 @@ -103,8 +103,10 @@ Parameters ---------- cmd: dict - A dict contains informations of a command. It should contains - the following keys like ``inp``, ``rtn``, ``ts`` etc. + This dict contains information about the command that is to be + added to the history list. It should contain the keys ``inp``, + ``rtn`` and ``ts``. These key names mirror the same names defined + as instance variables in the ``HistoryEntry`` class. """ pass @@ -136,7 +138,7 @@ Parameters ---------- size: None or tuple of a int and a string - Detemines the size and units of what would be allowed to remain. + Determines the size and units of what would be allowed to remain. blocking: bool If set blocking, then wait until gc action finished. """ diff -Nru xonsh-0.5.12+dfsg/xonsh/history/json.py xonsh-0.6.0+dfsg/xonsh/history/json.py --- xonsh-0.5.12+dfsg/xonsh/history/json.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/history/json.py 2017-11-23 00:23:47.000000000 +0000 @@ -1,7 +1,9 @@ # -*- coding: utf-8 -*- """Implements JSON version of xonsh history backend.""" import os +import sys import time +import json import builtins import collections import threading @@ -338,7 +340,10 @@ Parameters ---------- cmd : dict - Command dictionary that should be added to the ordered history. + This dict contains information about the command that is to be + added to the history list. It should contain the keys ``inp``, + ``rtn`` and ``ts``. These key names mirror the same names defined + as instance variables in the ``HistoryEntry`` class. Returns ------- @@ -360,7 +365,7 @@ ---------- at_exit : bool, optional Whether the JsonHistoryFlusher should act as a thread in the - background, or execute immeadiately and block. + background, or execute immediately and block. Returns ------- @@ -383,7 +388,7 @@ """ Returns all history as found in XONSH_DATA_DIR. - yeild format: {'inp': cmd, 'rtn': 0, ...} + yield format: {'inp': cmd, 'rtn': 0, ...} """ while self.gc and self.gc.is_alive(): time.sleep(0.011) # gc sleeps for 0.01 secs, sleep a beat longer @@ -393,7 +398,14 @@ except ValueError: # Invalid json file continue - commands = json_file.load()['cmds'] + try: + commands = json_file.load()['cmds'] + except json.decoder.JSONDecodeError: + # file is corrupted somehow + if builtins.__xonsh_env__.get('XONSH_DEBUG') > 0: + msg = 'xonsh history file {0!r} is not valid JSON' + print(msg.format(f), file=sys.stderr) + continue for c in commands: yield {'inp': c['inp'].rstrip(), 'ts': c['ts'][0]} # all items should also include session items diff -Nru xonsh-0.5.12+dfsg/xonsh/history/sqlite.py xonsh-0.6.0+dfsg/xonsh/history/sqlite.py --- xonsh-0.5.12+dfsg/xonsh/history/sqlite.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/history/sqlite.py 2017-11-23 00:23:47.000000000 +0000 @@ -32,7 +32,7 @@ """Create Table for history items. Columns: - info - JSON formated, reserved for future extension. + info - JSON formatted, reserved for future extension. """ cursor.execute(""" CREATE TABLE IF NOT EXISTS xonsh_history diff -Nru xonsh-0.5.12+dfsg/xonsh/imphooks.py xonsh-0.6.0+dfsg/xonsh/imphooks.py --- xonsh-0.5.12+dfsg/xonsh/imphooks.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/imphooks.py 2017-11-23 00:23:47.000000000 +0000 @@ -236,7 +236,7 @@ class XonshImportEventLoader(Loader): - """A class that dispatches loader calls to another loader and fires relevent + """A class that dispatches loader calls to another loader and fires relevant xonsh events. """ @@ -261,11 +261,11 @@ return rtn def load_module(self, fullname): - """Legacy module loading, provided for backwards compatability.""" + """Legacy module loading, provided for backwards compatibility.""" return self.loader.load_module(fullname) def module_repr(self, module): - """Legacy module repr, provided for backwards compatability.""" + """Legacy module repr, provided for backwards compatibility.""" return self.loader.module_repr(module) diff -Nru xonsh-0.5.12+dfsg/xonsh/__init__.py xonsh-0.6.0+dfsg/xonsh/__init__.py --- xonsh-0.5.12+dfsg/xonsh/__init__.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/__init__.py 2017-11-23 00:23:47.000000000 +0000 @@ -1,4 +1,4 @@ -__version__ = '0.5.12' +__version__ = '0.6.0' # amalgamate exclude jupyter_kernel parser_table parser_test_table pyghooks @@ -18,28 +18,24 @@ _sys.modules['xonsh.lazyasd'] = __amalgam__ lazyjson = __amalgam__ _sys.modules['xonsh.lazyjson'] = __amalgam__ - color_tools = __amalgam__ - _sys.modules['xonsh.color_tools'] = __amalgam__ platform = __amalgam__ _sys.modules['xonsh.platform'] = __amalgam__ pretty = __amalgam__ _sys.modules['xonsh.pretty'] = __amalgam__ - ansi_colors = __amalgam__ - _sys.modules['xonsh.ansi_colors'] = __amalgam__ codecache = __amalgam__ _sys.modules['xonsh.codecache'] = __amalgam__ lazyimps = __amalgam__ _sys.modules['xonsh.lazyimps'] = __amalgam__ parser = __amalgam__ _sys.modules['xonsh.parser'] = __amalgam__ - style_tools = __amalgam__ - _sys.modules['xonsh.style_tools'] = __amalgam__ tokenize = __amalgam__ _sys.modules['xonsh.tokenize'] = __amalgam__ tools = __amalgam__ _sys.modules['xonsh.tools'] = __amalgam__ ast = __amalgam__ _sys.modules['xonsh.ast'] = __amalgam__ + color_tools = __amalgam__ + _sys.modules['xonsh.color_tools'] = __amalgam__ commands_cache = __amalgam__ _sys.modules['xonsh.commands_cache'] = __amalgam__ diff_history = __amalgam__ @@ -58,14 +54,16 @@ _sys.modules['xonsh.openpy'] = __amalgam__ xontribs = __amalgam__ _sys.modules['xonsh.xontribs'] = __amalgam__ + ansi_colors = __amalgam__ + _sys.modules['xonsh.ansi_colors'] = __amalgam__ dirstack = __amalgam__ _sys.modules['xonsh.dirstack'] = __amalgam__ - inspectors = __amalgam__ - _sys.modules['xonsh.inspectors'] = __amalgam__ proc = __amalgam__ _sys.modules['xonsh.proc'] = __amalgam__ shell = __amalgam__ _sys.modules['xonsh.shell'] = __amalgam__ + style_tools = __amalgam__ + _sys.modules['xonsh.style_tools'] = __amalgam__ timings = __amalgam__ _sys.modules['xonsh.timings'] = __amalgam__ xonfig = __amalgam__ @@ -74,12 +72,14 @@ _sys.modules['xonsh.base_shell'] = __amalgam__ environ = __amalgam__ _sys.modules['xonsh.environ'] = __amalgam__ - tracer = __amalgam__ - _sys.modules['xonsh.tracer'] = __amalgam__ + inspectors = __amalgam__ + _sys.modules['xonsh.inspectors'] = __amalgam__ readline_shell = __amalgam__ _sys.modules['xonsh.readline_shell'] = __amalgam__ replay = __amalgam__ _sys.modules['xonsh.replay'] = __amalgam__ + tracer = __amalgam__ + _sys.modules['xonsh.tracer'] = __amalgam__ aliases = __amalgam__ _sys.modules['xonsh.aliases'] = __amalgam__ built_ins = __amalgam__ diff -Nru xonsh-0.5.12+dfsg/xonsh/inspectors.py xonsh-0.6.0+dfsg/xonsh/inspectors.py --- xonsh-0.5.12+dfsg/xonsh/inspectors.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/inspectors.py 2017-11-23 00:23:47.000000000 +0000 @@ -188,7 +188,7 @@ Returns ------- call_info : None, str or (str, dict) tuple. - When format_call is True, the whole call information is formattted as a + When format_call is True, the whole call information is formatted as a single string. Otherwise, the object's name and its argspec dict are returned. If no call information is available, None is returned. diff -Nru xonsh-0.5.12+dfsg/xonsh/lazyasd.py xonsh-0.6.0+dfsg/xonsh/lazyasd.py --- xonsh-0.5.12+dfsg/xonsh/lazyasd.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/lazyasd.py 2017-11-23 00:23:47.000000000 +0000 @@ -21,7 +21,7 @@ provided context (typically the globals of the call site) with the given name. - For example, you can prevent the compilation of a regular expreession + For example, you can prevent the compilation of a regular expression until it is actually used:: DOT = LazyObject((lambda: re.compile('.')), globals(), 'DOT') @@ -150,7 +150,7 @@ ---------- loaders : Mapping of keys to functions with no arguments A mapping of loader function that performs the actual value - construction upon acces. + construction upon access. ctx : Mapping Context to replace the LazyDict instance in with the the fully loaded mapping. @@ -335,7 +335,7 @@ os.environ otherwise. replacements : Mapping or None, optional Dictionary mapping fully qualified module names (eg foo.bar.baz) that - import the lazily loaded moudle, with the variable name in that + import the lazily loaded module, with the variable name in that module. For example, suppose that foo.bar imports module a as b, this dict is then {'foo.bar': 'b'}. diff -Nru xonsh-0.5.12+dfsg/xonsh/lexer.py xonsh-0.6.0+dfsg/xonsh/lexer.py --- xonsh-0.5.12+dfsg/xonsh/lexer.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/lexer.py 2017-11-23 00:23:47.000000000 +0000 @@ -379,7 +379,7 @@ t = self.token() def split(self, s): - """Splits a string into a list of strings which are whitepace-separated + """Splits a string into a list of strings which are whitespace-separated tokens. """ vals = [] diff -Nru xonsh-0.5.12+dfsg/xonsh/macutils.py xonsh-0.6.0+dfsg/xonsh/macutils.py --- xonsh-0.5.12+dfsg/xonsh/macutils.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/macutils.py 2017-11-23 00:23:47.000000000 +0000 @@ -5,7 +5,7 @@ def sysctlbyname(name, return_str=True): - """Gets a sysctrl value by name. If return_str is true, this will return + """Gets a sysctl value by name. If return_str is true, this will return a string representation, else it will return the raw value. """ # forked from https://gist.github.com/pudquick/581a71425439f2cf8f09 diff -Nru xonsh-0.5.12+dfsg/xonsh/main.py xonsh-0.6.0+dfsg/xonsh/main.py --- xonsh-0.5.12+dfsg/xonsh/main.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/main.py 2017-11-23 00:23:47.000000000 +0000 @@ -170,9 +170,9 @@ choices=('readline', 'prompt_toolkit', 'best', 'random'), default=None) p.add_argument('--timings', - help='Prints timing infomation before the prompt is shown. ' - 'This is usefull to track down perfomance issues ' - 'and investigate startup times.', + help='Prints timing information before the prompt is shown. ' + 'This is useful while tracking down performance issues ' + 'and investigating startup times.', dest='timings', action='store_true', default=None) @@ -218,9 +218,9 @@ interactive = 3 -def start_services(shell_kwargs): +def start_services(shell_kwargs, args): """Starts up the essential services in the proper order. - This returns the envrionment instance as a convenience. + This returns the environment instance as a convenience. """ install_import_hooks() # create execer, which loads builtins @@ -236,6 +236,9 @@ env = builtins.__xonsh_env__ rc = shell_kwargs.get('rc', None) rc = env.get('XONSHRC') if rc is None else rc + if args.mode != XonshMode.interactive and not args.force_interactive: + # Don't load xonshrc if not interactive shell + rc = None events.on_pre_rc.fire() xonshrc_context(rcfiles=rc, execer=execer, ctx=ctx, env=env, login=login) events.on_post_rc.fire() @@ -246,7 +249,7 @@ def premain(argv=None): - """Setup for main xonsh entry point, returns parsed arguments.""" + """Setup for main xonsh entry point. Returns parsed arguments.""" if argv is None: argv = sys.argv[1:] setup_timings() @@ -288,11 +291,11 @@ args.mode = XonshMode.interactive shell_kwargs['completer'] = True shell_kwargs['login'] = True - env = start_services(shell_kwargs) + env = start_services(shell_kwargs, args) env['XONSH_LOGIN'] = shell_kwargs['login'] if args.defines is not None: env.update([x.split('=', 1) for x in args.defines]) - env['XONSH_INTERACTIVE'] = args.force_interactive + env['XONSH_INTERACTIVE'] = args.force_interactive or (args.mode == XonshMode.interactive) if ON_WINDOWS: setup_win_unicode_console(env.get('WIN_UNICODE_CONSOLE', True)) return args diff -Nru xonsh-0.5.12+dfsg/xonsh/parsers/base.py xonsh-0.6.0+dfsg/xonsh/parsers/base.py --- xonsh-0.5.12+dfsg/xonsh/parsers/base.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/parsers/base.py 2017-11-23 00:23:47.000000000 +0000 @@ -5,6 +5,7 @@ import time import textwrap from threading import Thread +from ast import parse as pyparse from collections import Iterable, Sequence, Mapping try: @@ -189,8 +190,8 @@ def lopen_loc(x): - """Extracts the line and column number for a node that may have anb opening - parenthesis, brace, or braket. + """Extracts the line and column number for a node that may have an opening + parenthesis, brace, or bracket. """ lineno = x._lopen_lineno if hasattr(x, '_lopen_lineno') else x.lineno col = x._lopen_col if hasattr(x, '_lopen_col') else x.col_offset @@ -390,7 +391,7 @@ setattr(self.__class__, listfunc.__name__, listfunc) def _tok_rule(self, rulename): - """For a rule name, creates a rule that retuns the corresponding token. + """For a rule name, creates a rule that returns the corresponding token. '_tok' is appended to the rule name. """ @@ -468,6 +469,8 @@ else: col = loc.column + 1 lines = self.lines + if loc.lineno == 0: + loc.lineno = len(lines) i = loc.lineno - 1 if 0 <= i < len(lines): err_line = lines[i].rstrip() @@ -1437,7 +1440,7 @@ self.p_nodedent_base.__func__.__doc__ = doc def p_nodedent_base(self, p): - # see above attachament function + # see above attachment function pass def p_nodedent_any(self, p): @@ -1471,7 +1474,7 @@ self.p_nonewline_base.__func__.__doc__ = doc def p_nonewline_base(self, p): - # see above attachament function + # see above attachment function pass def p_nonewline_any(self, p): @@ -1979,7 +1982,7 @@ self.p_nocloser_base.__func__.__doc__ = doc def p_nocloser_base(self, p): - # see above attachament function + # see above attachment function pass def p_nocloser_any(self, p): @@ -2000,6 +2003,10 @@ col_offset=p1.lexpos) p[0] = xonsh_call('__xonsh_path_literal__', [s], lineno=p1.lineno, col=p1.lexpos) + elif 'f' in prefix or 'F' in prefix: + s = pyparse(p1.value).body[0].value + s = ast.increment_lineno(s, p1.lineno - 1) + p[0] = s else: s = ast.literal_eval(p1.value) is_bytes = 'b' in prefix or 'B' in prefix @@ -2017,7 +2024,7 @@ def p_number(self, p): """number : number_tok""" p1 = p[1] - p[0] = ast.Num(n=ast.literal_eval(p1.value), lineno=p1.lineno, + p[0] = ast.Num(n=ast.literal_eval(p1.value.replace('_', '')), lineno=p1.lineno, col_offset=p1.lexpos) def p_testlist_comp_comp(self, p): @@ -2097,14 +2104,14 @@ # The following grammar rules are no-ops because we don't need to glue the # source code back together piece-by-piece. Instead, we simply look for - # top-level commas and record their positions. With these positions and - # the bounding parantheses !() positions we can use the source_slice() - # method. This does a much better job of capturing exactly the source code - # that was provided. The tokenizer & lexer can be a little lossy, especially - # with respect to whitespace. + # top-level commas and record their positions. With these positions and the + # respective positions of the bounding parentheses, we can use the + # source_slice() method. This does a much better job of capturing exactly + # the source code that was provided. The tokenizer & lexer can be a little + # lossy, especially with respect to whitespace. def p_nocomma_tok(self, p): - # see attachement function above for docstring + # see attachment function above for docstring pass def p_any_raw_tok(self, p): @@ -2705,6 +2712,14 @@ # Helpers # + def p_test_comma_combine(self, p): + """test_comma_list : test comma_test_list + | test comma_test_list COMMA + """ + p2 = p[2] + p2.insert(0, p[1]) + p[0] = p2 + def p_empty(self, p): 'empty : ' p[0] = None diff -Nru xonsh-0.5.12+dfsg/xonsh/parsers/v34.py xonsh-0.6.0+dfsg/xonsh/parsers/v34.py --- xonsh-0.5.12+dfsg/xonsh/parsers/v34.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/parsers/v34.py 2017-11-23 00:23:47.000000000 +0000 @@ -25,7 +25,7 @@ outputdir : str or None, optional The directory to place generated tables within. """ - # Rule creation and modifiation *must* take place before super() + # Rule creation and modification *must* take place before super() opt_rules = ['argument_comma_list', 'comma_argument_list'] for rule in opt_rules: self._opt_rule(rule) diff -Nru xonsh-0.5.12+dfsg/xonsh/parsers/v35.py xonsh-0.6.0+dfsg/xonsh/parsers/v35.py --- xonsh-0.5.12+dfsg/xonsh/parsers/v35.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/parsers/v35.py 2017-11-23 00:23:47.000000000 +0000 @@ -25,7 +25,7 @@ outputdir : str or None, optional The directory to place generated tables within. """ - # Rule creation and modifiation *must* take place before super() + # Rule creation and modification *must* take place before super() tok_rules = ['await', 'async'] for rule in tok_rules: self._tok_rule(rule) @@ -113,7 +113,7 @@ # to our LL(1) parser. Even though 'test' includes '*expr' in star_expr, # we explicitly match '*' here, too, to give it proper precedence. # Illegal combinations and orderings are blocked in ast.c: - # multiple (test comp_for) arguements are blocked; keyword unpackings + # multiple (test comp_for) arguments are blocked; keyword unpackings # that precede iterable unpackings are blocked; etc. def p_argument_test_or_star(self, p): """argument : test_or_star_expr""" diff -Nru xonsh-0.5.12+dfsg/xonsh/platform.py xonsh-0.6.0+dfsg/xonsh/platform.py --- xonsh-0.5.12+dfsg/xonsh/platform.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/platform.py 2017-11-23 00:23:47.000000000 +0000 @@ -200,7 +200,7 @@ def windows_expanduser(path): """A Windows-specific expanduser() function for xonsh. This is needed since os.path.expanduser() does not check on Windows if the user actually - exists. This restircts expanding the '~' if it is not followed by a + exists. This restricts expanding the '~' if it is not followed by a separator. That is only '~/' and '~\' are expanded. """ if not path.startswith('~'): @@ -361,7 +361,7 @@ if ON_WINDOWS: class OSEnvironCasePreserving(collections.MutableMapping): - """ Case-preseving wrapper for os.environ on Windows. + """ Case-preserving wrapper for os.environ on Windows. It uses nt.environ to get the correct cased keys on initialization. It also preserves the case of any variables add after initialization. @@ -414,7 +414,7 @@ @lazyobject def os_environ(): - """This dispatches to the correct, case-senstive version of os.envrion. + """This dispatches to the correct, case-sensitive version of os.environ. This is mainly a problem for Windows. See #2024 for more details. This can probably go away once support for Python v3.5 or v3.6 is dropped. @@ -427,7 +427,7 @@ @functools.lru_cache(1) def bash_command(): - """Determines the command for Bash on the current plaform.""" + """Determines the command for Bash on the current platform.""" if ON_WINDOWS: bc = windows_bash_command() else: diff -Nru xonsh-0.5.12+dfsg/xonsh/pretty.py xonsh-0.6.0+dfsg/xonsh/pretty.py --- xonsh-0.5.12+dfsg/xonsh/pretty.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/pretty.py 2017-11-23 00:23:47.000000000 +0000 @@ -310,7 +310,7 @@ printer for a python object. This class stores processing data on `self` so you must *never* use - this class in a threaded environment. Always lock it or reinstanciate + this class in a threaded environment. Always lock it or reinstantiate it. Instances also have a verbose flag callbacks can access to control their diff -Nru xonsh-0.5.12+dfsg/xonsh/proc.py xonsh-0.6.0+dfsg/xonsh/proc.py --- xonsh-0.5.12+dfsg/xonsh/proc.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/proc.py 2017-11-23 00:23:47.000000000 +0000 @@ -220,8 +220,9 @@ def populate_buffer(reader, fd, buffer, chunksize): """Reads bytes from the file descriptor and copies them into a buffer. - The reads happend in parallel, using pread(), and is thus only - availabe on posix. If the read fails for any reason, the reader is + + The reads happen in parallel using the pread() syscall; which is only + available on POSIX systems. If the read fails for any reason, the reader is flagged as closed. """ offset = 0 @@ -280,7 +281,7 @@ def populate_console(reader, fd, buffer, chunksize, queue, expandsize=None): """Reads bytes from the file descriptor and puts lines into the queue. - The reads happend in parallel, + The reads happened in parallel, using xonsh.winutils.read_console_output_character(), and is thus only available on windows. If the read fails for any reason, the reader is flagged as closed. @@ -300,23 +301,23 @@ # These chunked reads basically need to happen like this because, # a. The default buffer size is HUGE for the console (90k lines x 120 cols) # as so we can't just read in everything at the end and see what we - # care about without a noticible performance hit. + # care about without a noticeable performance hit. # b. Even with this huge size, it is still possible to write more lines than # this, so we should scroll along with the console. - # Unfortnately, because we do not have control over the terminal emulator, - # It is not possible to compute how far back we should set the begining + # Unfortunately, because we do not have control over the terminal emulator, + # It is not possible to compute how far back we should set the beginning # read position because we don't know how many characters have been popped # off the top of the buffer. If we did somehow know this number we could do # something like the following: # # new_offset = (y*cols) + x # if new_offset == max_offset: - # new_offset -= scolled_offset + # new_offset -= scrolled_offset # x = new_offset%cols # y = new_offset//cols # continue # - # So this method is imperfect and only works as long as the sceen has + # So this method is imperfect and only works as long as the screen has # room to expand to. Thus the trick here is to expand the screen size # when we get close enough to the end of the screen. There remain some # async issues related to not being able to set the cursor position. @@ -488,7 +489,7 @@ def still_writable(fd): - """Determines whether a file descriptior is still writable by trying to + """Determines whether a file descriptor is still writable by trying to write an empty string and seeing if it fails. """ try: @@ -664,7 +665,7 @@ def _read_write(self, reader, writer, stdbuf): """Reads a chunk of bytes from a buffer and write into memory or back - down to the standard buffer, as approriate. Returns the number of + down to the standard buffer, as appropriate. Returns the number of successful reads. """ if reader is None: @@ -696,7 +697,7 @@ self._alt_mode_writer(chunk[:i], membuf, stdbuf) # switch modes # write the flag itself the current mode where alt mode is on - # so that it is streamed to the termial ASAP. + # so that it is streamed to the terminal ASAP. # this is needed for terminal emulators to find the correct # positions before and after alt mode. alt_mode = (flag in START_ALTERNATE_MODE) @@ -950,7 +951,7 @@ class FileThreadDispatcher: """Dispatches to different file handles depending on the - current thread. Useful if you want file operation to go to differnt + current thread. Useful if you want file operation to go to different places for different threads. """ @@ -960,7 +961,7 @@ ---------- default : file-like or None, optional The file handle to write to if a thread cannot be found in - the registery. If None, a new in-memory instance. + the registry. If None, a new in-memory instance. Attributes ---------- @@ -1111,13 +1112,13 @@ # These should NOT be lazy since they *need* to get the true stdout from the -# main thread. Also their creation time should be neglibible. +# main thread. Also their creation time should be negligible. STDOUT_DISPATCHER = FileThreadDispatcher(default=sys.stdout) STDERR_DISPATCHER = FileThreadDispatcher(default=sys.stderr) def parse_proxy_return(r, stdout, stderr): - """Proxies may return a variety of outputs. This hanles them generally. + """Proxies may return a variety of outputs. This handles them generally. Parameters ---------- @@ -1189,7 +1190,7 @@ def partial_proxy(f): - """Dispatches the approriate proxy function based on the number of args.""" + """Dispatches the appropriate proxy function based on the number of args.""" numargs = 0 for name, param in inspect.signature(f).parameters.items(): if param.kind == param.POSITIONAL_ONLY or \ @@ -1236,7 +1237,8 @@ set to `None`, then `sys.stderr` is used. universal_newlines : bool, optional Whether or not to use universal newlines. - env : Mapping, optiona Environment mapping. + env : Mapping, optional + Environment mapping. """ self.orig_f = f self.f = partial_proxy(f) @@ -1408,7 +1410,8 @@ def _signal_int(self, signum, frame): """Signal handler for SIGINT - Ctrl+C may have been pressed.""" - # check if we have already be interrupted to prevent infintie recurrsion + # Check if we have already been interrupted. This should prevent + # the possibility of infinite recursion. if self._interrupted: return self._interrupted = True @@ -1605,7 +1608,7 @@ def wait(self, timeout=None): """Runs the function and returns the result. Timeout argument only - present for API compatability. + present for API compatibility. """ if self.f is None: return 0 @@ -1722,7 +1725,7 @@ Parameters ---------- specs : list of SubprocSpec - Process sepcifications + Process specifications Attributes ---------- @@ -1798,7 +1801,7 @@ """Iterates through the last stdout, and returns the lines exactly as found. """ - # get approriate handles + # get appropriate handles spec = self.spec proc = self.proc timeout = builtins.__xonsh_env__.get('XONSH_PROC_FREQUENCY') @@ -2094,7 +2097,7 @@ self._safe_close(s.captured_stderr) def _set_input(self): - """Sets the input vaiable.""" + """Sets the input variable.""" stdin = self.proc.stdin if stdin is None or isinstance(stdin, int) or stdin.closed or \ not stdin.seekable() or not safe_readable(stdin): @@ -2105,7 +2108,7 @@ self.input = self._decode_uninew(input) def _check_signal(self): - """Checks if a signal was recieved and issues a message.""" + """Checks if a signal was received and issues a message.""" proc_signal = getattr(self.proc, 'signal', None) if proc_signal is None: return @@ -2125,7 +2128,7 @@ hist.last_cmd_rtn = self.proc.returncode def _raise_subproc_error(self): - """Raises a subprocess error, if we are suppossed to.""" + """Raises a subprocess error, if we are supposed to.""" spec = self.spec rtn = self.returncode if (not spec.is_proxy and @@ -2296,7 +2299,7 @@ class PrevProcCloser(threading.Thread): """Previous process closer thread for pipelines whose last command is itself unthreadable. This makes sure that the pipeline is - driven foreward and does not deadlock. + driven forward and does not deadlock. """ def __init__(self, pipeline): @@ -2312,7 +2315,7 @@ self.start() def run(self): - """Runs the closing algorithim.""" + """Runs the closing algorithm.""" pipeline = self.pipeline check_prev_done = len(pipeline.procs) == 1 if check_prev_done: diff -Nru xonsh-0.5.12+dfsg/xonsh/prompt/base.py xonsh-0.6.0+dfsg/xonsh/prompt/base.py --- xonsh-0.5.12+dfsg/xonsh/prompt/base.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/prompt/base.py 2017-11-23 00:23:47.000000000 +0000 @@ -71,7 +71,7 @@ val = self._get_field_value(field) return _format_value(val, spec, conv) else: - # color or unkown field, return as is + # color or unknown field, return as is return '{' + field + '}' def _get_field_value(self, field): @@ -158,7 +158,7 @@ headlen = len(head) # tail is the trailing whitespace tail = line if headlen == 0 else line.rsplit(head[-1], 1)[1] - # now to constuct the actual string + # now to construct the actual string dots = builtins.__xonsh_env__.get('MULTILINE_PROMPT') dots = dots() if callable(dots) else dots if dots is None or len(dots) == 0: diff -Nru xonsh-0.5.12+dfsg/xonsh/prompt/cwd.py xonsh-0.6.0+dfsg/xonsh/prompt/cwd.py --- xonsh-0.5.12+dfsg/xonsh/prompt/cwd.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/prompt/cwd.py 2017-11-23 00:23:47.000000000 +0000 @@ -45,16 +45,16 @@ """Return the compact current working directory. It respects the environment variable DYNAMIC_CWD_WIDTH. """ - originial_path = _replace_home_cwd() + original_path = _replace_home_cwd() target_width, units = builtins.__xonsh_env__['DYNAMIC_CWD_WIDTH'] elision_char = builtins.__xonsh_env__['DYNAMIC_CWD_ELISION_CHAR'] if target_width == float('inf'): - return originial_path + return original_path if (units == '%'): cols, _ = shutil.get_terminal_size() target_width = (cols * target_width) // 100 sep = xt.get_sep() - pwd = originial_path.split(sep) + pwd = original_path.split(sep) last = pwd.pop() remaining_space = target_width - len(last) # Reserve space for separators diff -Nru xonsh-0.5.12+dfsg/xonsh/prompt/env.py xonsh-0.6.0+dfsg/xonsh/prompt/env.py --- xonsh-0.5.12+dfsg/xonsh/prompt/env.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/prompt/env.py 2017-11-23 00:23:47.000000000 +0000 @@ -20,7 +20,7 @@ def vte_new_tab_cwd(): - """This prints an escape squence that tells VTE terminals the hostname + """This prints an escape sequence that tells VTE terminals the hostname and pwd. This should not be needed in most cases, but sometimes is for certain Linux terminals that do not read the PWD from the environment on startup. Note that this does not return a string, it simply prints diff -Nru xonsh-0.5.12+dfsg/xonsh/prompt/gitstatus.py xonsh-0.6.0+dfsg/xonsh/prompt/gitstatus.py --- xonsh-0.5.12+dfsg/xonsh/prompt/gitstatus.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/prompt/gitstatus.py 2017-11-23 00:23:47.000000000 +0000 @@ -17,11 +17,33 @@ def _check_output(*args, **kwargs): kwargs.update(dict(env=builtins.__xonsh_env__.detype(), + stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, - timeout=builtins.__xonsh_env__['VC_BRANCH_TIMEOUT'], universal_newlines=True )) - return subprocess.check_output(*args, **kwargs) + timeout = builtins.__xonsh_env__['VC_BRANCH_TIMEOUT'] + # See https://docs.python.org/3/library/subprocess.html#subprocess.Popen.communicate + with subprocess.Popen(*args, **kwargs) as proc: + try: + out, err = proc.communicate(timeout=timeout) + if proc.returncode != 0: + raise subprocess.CalledProcessError(proc.returncode, proc.args, output=out, stderr=err) # note err will always be empty as we redirect stderr to DEVNULL abvoe + return out + except subprocess.TimeoutExpired: + # We use `.terminate()` (SIGTERM) instead of `.kill()` (SIGKILL) here + # because otherwise we guarantee that a `.git/index.lock` file will be + # left over, and subsequent git operations will fail. + # We don't want that. + # As a result, we must rely on git to exit properly on SIGTERM. + proc.terminate() + # We wait() to ensure that git has finished before the next + # `gitstatus` prompt is rendered (otherwise `index.lock` still exists, + # and it will fail). + # We don't technically have to call `wait()` here as the + # `with subprocess.Popen()` context manager above would do that + # for us, but we do it to be explicit that waiting is being done. + proc.wait() # we ignore what git says after we sent it SIGTERM + raise @xl.lazyobject @@ -48,11 +70,10 @@ def _get_tag_or_hash(): - tag = _check_output(['git', 'describe', '--exact-match']).strip() - if tag: - return tag + tag_or_hash = _check_output(['git', 'describe', '--always']).strip() hash_ = _check_output(['git', 'rev-parse', '--short', 'HEAD']).strip() - return _get_def('HASH') + hash_ + have_tag_name = tag_or_hash != hash_ + return tag_or_hash if have_tag_name else _get_def('HASH') + hash_ def _get_stash(gitdir): diff -Nru xonsh-0.5.12+dfsg/xonsh/prompt/vc.py xonsh-0.6.0+dfsg/xonsh/prompt/vc.py --- xonsh-0.5.12+dfsg/xonsh/prompt/vc.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/prompt/vc.py 2017-11-23 00:23:47.000000000 +0000 @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -"""Prompt formatter for simple version control branchs""" +"""Prompt formatter for simple version control branches""" # pylint:disable=no-member, invalid-name import os @@ -13,10 +13,11 @@ def _get_git_branch(q): + denv = builtins.__xonsh_env__.detype() try: branches = xt.decode_bytes(subprocess.check_output( - ['git', 'branch'], - stderr=subprocess.DEVNULL + ['git', 'branch'], env=denv, + stderr=subprocess.DEVNULL, )).splitlines() except (subprocess.CalledProcessError, OSError, FileNotFoundError): q.put(None) @@ -153,13 +154,15 @@ def _git_dirty_working_directory(q, include_untracked): status = None + denv = builtins.__xonsh_env__.detype() try: cmd = ['git', 'status', '--porcelain'] if include_untracked: cmd.append('--untracked-files=normal') else: cmd.append('--untracked-files=no') - status = subprocess.check_output(cmd, stderr=subprocess.DEVNULL) + status = subprocess.check_output(cmd, stderr=subprocess.DEVNULL, + env=denv) except (subprocess.CalledProcessError, OSError, FileNotFoundError): q.put(None) if status is not None: @@ -210,9 +213,9 @@ """ dwd = None cmds = builtins.__xonsh_commands_cache__ - if cmds.lazy_locate_binary('git'): + if cmds.lazy_locate_binary('git', ignore_alias=True): dwd = git_dirty_working_directory() - if cmds.lazy_locate_binary('hg') and dwd is None: + if cmds.lazy_locate_binary('hg', ignore_alias=True) and dwd is None: dwd = hg_dirty_working_directory() return dwd @@ -234,7 +237,7 @@ def branch_bg_color(): """Return red if the current branch is dirty, yellow if the dirtiness can - not be determined, and green if it clean. These are bacground colors. + not be determined, and green if it clean. These are background colors. """ dwd = dirty_working_directory() if dwd is None: diff -Nru xonsh-0.5.12+dfsg/xonsh/ptk/completer.py xonsh-0.6.0+dfsg/xonsh/ptk/completer.py --- xonsh-0.5.12+dfsg/xonsh/ptk/completer.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/ptk/completer.py 2017-11-23 00:23:47.000000000 +0000 @@ -49,7 +49,7 @@ self.ctx) # completions from auto suggest sug_comp = None - if env.get('AUTO_SUGGEST'): + if env.get('AUTO_SUGGEST') and env.get('AUTO_SUGGEST_IN_COMPLETIONS'): sug_comp = self.suggestion_completion(document, line) if sug_comp is None: pass diff -Nru xonsh-0.5.12+dfsg/xonsh/ptk/history.py xonsh-0.6.0+dfsg/xonsh/ptk/history.py --- xonsh-0.5.12+dfsg/xonsh/ptk/history.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/ptk/history.py 2017-11-23 00:23:47.000000000 +0000 @@ -7,7 +7,7 @@ class PromptToolkitHistory(prompt_toolkit.history.History): - """History class that implements the promt-toolkit history interface + """History class that implements the prompt-toolkit history interface with the xonsh backend. """ diff -Nru xonsh-0.5.12+dfsg/xonsh/ptk/key_bindings.py xonsh-0.6.0+dfsg/xonsh/ptk/key_bindings.py --- xonsh-0.5.12+dfsg/xonsh/ptk/key_bindings.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/ptk/key_bindings.py 2017-11-23 00:23:47.000000000 +0000 @@ -144,6 +144,26 @@ return builtins.__xonsh_env__.get("XONSH_AUTOPAIR", False) +@Condition +def whitespace_or_bracket_before(cli): + """Check if there is whitespace or an opening + bracket to the left of the cursor""" + d = cli.current_buffer.document + return bool(d.cursor_position == 0 + or d.char_before_cursor.isspace() + or d.char_before_cursor in '([{') + + +@Condition +def whitespace_or_bracket_after(cli): + """Check if there is whitespace or a closing + bracket to the right of the cursor""" + d = cli.current_buffer.document + return bool(d.is_cursor_at_the_end_of_line + or d.current_char.isspace() + or d.current_char in ')]}') + + def load_xonsh_bindings(key_bindings_manager): """ Load custom key bindings. @@ -174,7 +194,7 @@ else: event.cli.current_buffer.insert_text(env.get('INDENT')) - @handle('(', filter=autopair_condition) + @handle('(', filter=autopair_condition & whitespace_or_bracket_after) def insert_right_parens(event): event.cli.current_buffer.insert_text('(') event.cli.current_buffer.insert_text(')', move_cursor=False) @@ -187,7 +207,7 @@ else: buffer.insert_text(')') - @handle('[', filter=autopair_condition) + @handle('[', filter=autopair_condition & whitespace_or_bracket_after) def insert_right_bracket(event): event.cli.current_buffer.insert_text('[') event.cli.current_buffer.insert_text(']', move_cursor=False) @@ -201,15 +221,32 @@ else: buffer.insert_text(']') + @handle('{', filter=autopair_condition & whitespace_or_bracket_after) + def insert_right_brace(event): + event.cli.current_buffer.insert_text('{') + event.cli.current_buffer.insert_text('}', move_cursor=False) + + @handle('}', filter=autopair_condition) + def overwrite_right_brace(event): + buffer = event.cli.current_buffer + + if buffer.document.current_char == '}': + buffer.cursor_position += 1 + else: + buffer.insert_text('}') + @handle('\'', filter=autopair_condition) def insert_right_quote(event): buffer = event.cli.current_buffer if buffer.document.current_char == '\'': buffer.cursor_position += 1 - else: + elif whitespace_or_bracket_before(event.cli)\ + and whitespace_or_bracket_after(event.cli): buffer.insert_text('\'') buffer.insert_text('\'', move_cursor=False) + else: + buffer.insert_text('\'') @handle('"', filter=autopair_condition) def insert_right_double_quote(event): @@ -217,9 +254,25 @@ if buffer.document.current_char == '"': buffer.cursor_position += 1 - else: + elif whitespace_or_bracket_before(event.cli)\ + and whitespace_or_bracket_after(event.cli): buffer.insert_text('"') buffer.insert_text('"', move_cursor=False) + else: + buffer.insert_text('"') + + @handle(Keys.Backspace, filter=autopair_condition) + def delete_brackets_or_quotes(event): + """Delete empty pair of brackets or quotes""" + buffer = event.cli.current_buffer + before = buffer.document.char_before_cursor + after = buffer.document.current_char + + if any([before == b and after == a + for (b, a) in ['()', '[]', '{}', "''", '""']]): + buffer.delete(1) + + buffer.delete_before_cursor(1) @handle(Keys.ControlD, filter=ctrl_d_condition) def call_exit_alias(event): diff -Nru xonsh-0.5.12+dfsg/xonsh/ptk/shell.py xonsh-0.6.0+dfsg/xonsh/ptk/shell.py --- xonsh-0.5.12+dfsg/xonsh/ptk/shell.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/ptk/shell.py 2017-11-23 00:23:47.000000000 +0000 @@ -63,6 +63,7 @@ kwarg flags whether the input should be stored in PTK's in-memory history. """ + events.on_pre_prompt.fire() env = builtins.__xonsh_env__ mouse_support = env.get('MOUSE_SUPPORT') if store_in_history: @@ -115,7 +116,6 @@ prompt_args['style'] = PygmentsStyle(pyghooks.xonsh_style_proxy(self.styler)) else: prompt_args['style'] = style_from_dict(DEFAULT_STYLE_DICT) - events.on_pre_prompt.fire() line = self.prompter.prompt(**prompt_args) events.on_post_prompt.fire() return line @@ -306,8 +306,8 @@ # needs to be performed by the subprocess itself. This fix is important # when subprocesses don't properly restore the terminal attributes, # like Python in interactive mode. Also note that the sequences "\033M" - # and "\033E" seem to work too, but these are techinally VT100 codes. - # I used the more primitive ANSI sequence to maximize compatability. + # and "\033E" seem to work too, but these are technically VT100 codes. + # I used the more primitive ANSI sequence to maximize compatibility. # -scopatz 2017-01-28 # if not ON_POSIX: # return diff -Nru xonsh-0.5.12+dfsg/xonsh/pyghooks.py xonsh-0.6.0+dfsg/xonsh/pyghooks.py --- xonsh-0.5.12+dfsg/xonsh/pyghooks.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/pyghooks.py 2017-11-23 00:23:47.000000000 +0000 @@ -8,8 +8,13 @@ from collections import ChainMap from collections.abc import MutableMapping +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# DO NOT MOVE # must come before pygments imports from xonsh.lazyasd import load_module_in_background +load_module_in_background('pkg_resources', debug='XONSH_DEBUG', + replacements={'pygments.plugin': 'pkg_resources'}) +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! from pygments.lexer import inherit, bygroups, include from pygments.lexers.agile import PythonLexer @@ -24,15 +29,12 @@ from xonsh.lazyasd import LazyObject, LazyDict, lazyobject from xonsh.tools import (ON_WINDOWS, intensify_colors_for_cmd_exe, expand_gray_colors_for_cmd_exe) -from xonsh.color_tools import (RE_BACKGROUND, BASE_XONSH_COLORS, make_pallete, +from xonsh.color_tools import (RE_BACKGROUND, BASE_XONSH_COLORS, make_palette, find_closest_color) from xonsh.style_tools import norm_name from xonsh.lazyimps import terminal256 from xonsh.platform import os_environ -load_module_in_background('pkg_resources', debug='XONSH_DEBUG', - replacements={'pygments.plugin': 'pkg_resources'}) - def _command_is_valid(cmd): try: @@ -242,7 +244,7 @@ fg = norm_name(name) else: bg = norm_name(name) - # assmble token + # assemble token if fg is None and bg is None: tokname = 'NO_COLOR' elif fg is None: @@ -360,7 +362,7 @@ class CompoundColorMap(MutableMapping): - """Looks up color tokes by name, potentailly generating the value + """Looks up color tokens by name, potentially generating the value from the lookup. """ @@ -410,7 +412,7 @@ style_name : str, optional The style name to initialize with. """ - self.trap = {} # for traping custom colors set by user + self.trap = {} # for trapping custom colors set by user self._smap = {} self._style_name = '' self.style_name = style_name @@ -453,7 +455,7 @@ def enhance_colors_for_cmd_exe(self): """ Enhance colors when using cmd.exe on windows. When using the default style all blue and dark red colors - are changed to CYAN and intence red. + are changed to CYAN and intense red. """ env = builtins.__xonsh_env__ # Ensure we are not using ConEmu @@ -1399,13 +1401,13 @@ _vim_style, _vs_style, _xcode_style) -# dynamic syles -def make_pygments_style(pallette): - """Makes a pygments style based on a color pallete.""" +# dynamic styles +def make_pygments_style(palette): + """Makes a pygments style based on a color palette.""" global Color style = {getattr(Color, 'NO_COLOR'): 'noinherit'} for name, t in BASE_XONSH_COLORS.items(): - color = find_closest_color(t, pallette) + color = find_closest_color(t, palette) style[getattr(Color, name)] = '#' + color style[getattr(Color, 'BOLD_'+name)] = 'bold #' + color style[getattr(Color, 'UNDERLINE_'+name)] = 'underline #' + color @@ -1419,8 +1421,8 @@ if name in STYLES: return STYLES[name] pstyle = get_style_by_name(name) - pallette = make_pallete(pstyle.styles.values()) - astyle = make_pygments_style(pallette) + palette = make_palette(pstyle.styles.values()) + astyle = make_pygments_style(palette) STYLES[name] = astyle return astyle diff -Nru xonsh-0.5.12+dfsg/xonsh/readline_shell.py xonsh-0.6.0+dfsg/xonsh/readline_shell.py --- xonsh-0.5.12+dfsg/xonsh/readline_shell.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/readline_shell.py 2017-11-23 00:23:47.000000000 +0000 @@ -112,7 +112,7 @@ " * failure to wrap or indent lines properly", "", "It is highly recommended that you install gnureadline, which is installable with:", - " pip install gnureadline", + " xpip install gnureadline", "*" * 78]), file=sys.stderr) else: readline.parse_and_bind("tab: complete") @@ -134,7 +134,7 @@ except Exception: # this seems to fail with libedit print_exception('xonsh: could not load readline default init file.') - # properly reset intput typed before the first prompt + # properly reset input typed before the first prompt readline.set_startup_hook(carriage_return) @@ -184,7 +184,7 @@ def rl_completion_suppress_append(val=1): - """Sets the rl_completion_suppress_append varaiable, if possible. + """Sets the rl_completion_suppress_append variable, if possible. A value of 1 (default) means to suppress, a value of 0 means to enable. """ if RL_COMPLETION_SUPPRESS_APPEND is None: @@ -193,7 +193,7 @@ def rl_completion_query_items(val=None): - """Sets the rl_completion_query_items varaiable, if possible. + """Sets the rl_completion_query_items variable, if possible. A None value will set this to $COMPLETION_QUERY_LIMIT, otherwise any integer is accepted. """ @@ -506,7 +506,7 @@ return p def format_color(self, string, hide=False, force_string=False, **kwargs): - """Readline implementation of color formatting. This usess ANSI color + """Readline implementation of color formatting. This uses ANSI color codes. """ hide = hide if self._force_hide is None else self._force_hide diff -Nru xonsh-0.5.12+dfsg/xonsh/replay.py xonsh-0.6.0+dfsg/xonsh/replay.py --- xonsh-0.5.12+dfsg/xonsh/replay.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/replay.py 2017-11-23 00:23:47.000000000 +0000 @@ -39,7 +39,7 @@ Parameters ---------- merge_env : tuple of str or Mappings, optional - Describes how to merge the environments, in order of increasing precednce. + Describes how to merge the environments, in order of increasing precedence. Available strings are 'replay' and 'native'. The 'replay' env comes from the history file that we are replaying. The 'native' env comes from what this instance of xonsh was started up with. Instead of a string, a dict or other diff -Nru xonsh-0.5.12+dfsg/xonsh/shell.py xonsh-0.6.0+dfsg/xonsh/shell.py --- xonsh-0.5.12+dfsg/xonsh/shell.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/shell.py 2017-11-23 00:23:47.000000000 +0000 @@ -18,7 +18,7 @@ on_transform_command(cmd: str) -> str Fired to request xontribs to transform a command line. Return the transformed -command, or the same command if no transformaiton occurs. Only done for +command, or the same command if no transformation occurs. Only done for interactive sessions. This may be fired multiple times per command, with other transformers input or @@ -72,8 +72,8 @@ break i += 1 if i == limit: - print_exception('Modifcations to source input took more than ' - 'the recursion limit number of interations to ' + print_exception('Modifications to source input took more than ' + 'the recursion limit number of iterations to ' 'converge.') debug_level = builtins.__xonsh_env__.get('XONSH_DEBUG') if show_diff and debug_level > 1 and src != raw: @@ -150,7 +150,7 @@ shell_type)) self.shell = shell_class(execer=self.execer, ctx=self.ctx, **kwargs) - # allows history garbage colector to start running + # allows history garbage collector to start running if hist.gc is not None: hist.gc.wait_for_shell = False diff -Nru xonsh-0.5.12+dfsg/xonsh/style_tools.py xonsh-0.6.0+dfsg/xonsh/style_tools.py --- xonsh-0.5.12+dfsg/xonsh/style_tools.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/style_tools.py 2017-11-23 00:23:47.000000000 +0000 @@ -151,7 +151,7 @@ fg = norm_name(name) else: bg = norm_name(name) - # assmble token + # assemble token if fg is None and bg is None: tokname = 'NO_COLOR' elif fg is None: diff -Nru xonsh-0.5.12+dfsg/xonsh/timings.py xonsh-0.6.0+dfsg/xonsh/timings.py --- xonsh-0.5.12+dfsg/xonsh/timings.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/timings.py 2017-11-23 00:23:47.000000000 +0000 @@ -211,7 +211,7 @@ worst = max(worst, worst_tuning) # Check best timing is greater than zero to avoid a # ZeroDivisionError. - # In cases where the slowest timing is lesser than 10 micoseconds + # In cases where the slowest timing is less than 10 microseconds # we assume that it does not really matter if the fastest # timing is 4 times faster than the slowest timing or not. if worst > 4 * best and best > 0 and worst > 1e-5: diff -Nru xonsh-0.5.12+dfsg/xonsh/tokenize.py xonsh-0.6.0+dfsg/xonsh/tokenize.py --- xonsh-0.5.12+dfsg/xonsh/tokenize.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/tokenize.py 2017-11-23 00:23:47.000000000 +0000 @@ -193,19 +193,20 @@ Ignore = Whitespace + tokany(r'\\\r?\n' + Whitespace) + maybe(Comment) Name_RE = r'\$?\w+' -Hexnumber = r'0[xX][0-9a-fA-F]+' -Binnumber = r'0[bB][01]+' -Octnumber = r'0[oO][0-7]+' -Decnumber = r'(?:0+|[1-9][0-9]*)' +Hexnumber = r'0[xX](?:_?[0-9a-fA-F])+' +Binnumber = r'0[bB](?:_?[01])+' +Octnumber = r'0[oO](?:_?[0-7])+' +Decnumber = r'(?:0(?:_?0)*|[1-9](?:_?[0-9])*)' Intnumber = group(Hexnumber, Binnumber, Octnumber, Decnumber) -Exponent = r'[eE][-+]?[0-9]+' -Pointfloat = group(r'[0-9]+\.[0-9]*', r'\.[0-9]+') + maybe(Exponent) -Expfloat = r'[0-9]+' + Exponent +Exponent = r'[eE][-+]?[0-9](?:_?[0-9])*' +Pointfloat = group(r'[0-9](?:_?[0-9])*\.(?:[0-9](?:_?[0-9])*)?', + r'\.[0-9](?:_?[0-9])*') + maybe(Exponent) +Expfloat = r'[0-9](?:_?[0-9])*' + Exponent Floatnumber = group(Pointfloat, Expfloat) -Imagnumber = group(r'[0-9]+[jJ]', Floatnumber + r'[jJ]') +Imagnumber = group(r'[0-9](?:_?[0-9])*[jJ]', Floatnumber + r'[jJ]') Number = group(Imagnumber, Floatnumber, Intnumber) -StringPrefix = r'(?:[bBp][rR]?|[rR][bBp]?|[uU])?' +StringPrefix = r'(?:[bBp][rR]?|[rR][bBpfF]?|[uU]|[fF][rR]?)?' # Tail end of ' string. Single = r"[^'\\]*(?:\\.[^'\\]*)*'" @@ -268,16 +269,23 @@ "'''": Single3, '"""': Double3, "r'''": Single3, 'r"""': Double3, "b'''": Single3, 'b"""': Double3, + "f'''": Single3, 'f"""': Double3, "R'''": Single3, 'R"""': Double3, "B'''": Single3, 'B"""': Double3, + "F'''": Single3, 'F"""': Double3, "br'''": Single3, 'br"""': Double3, + "fr'''": Single3, 'fr"""': Double3, "bR'''": Single3, 'bR"""': Double3, "Br'''": Single3, 'Br"""': Double3, "BR'''": Single3, 'BR"""': Double3, "rb'''": Single3, 'rb"""': Double3, + "rf'''": Single3, 'rf"""': Double3, "Rb'''": Single3, 'Rb"""': Double3, + "Fr'''": Single3, 'Fr"""': Double3, "rB'''": Single3, 'rB"""': Double3, + "rF'''": Single3, 'rF"""': Double3, "RB'''": Single3, 'RB"""': Double3, + "RF'''": Single3, 'RF"""': Double3, "u'''": Single3, 'u"""': Double3, "U'''": Single3, 'U"""': Double3, "p'''": Single3, 'p"""': Double3, @@ -286,16 +294,22 @@ "rp'''": Single3, 'rp"""': Double3, "Rp'''": Single3, 'Rp"""': Double3, 'r': None, 'R': None, 'b': None, 'B': None, - 'u': None, 'U': None, 'p': None} + 'u': None, 'U': None, 'p': None, 'f': None, + 'F': None} triple_quoted = {} for t in ("'''", '"""', "r'''", 'r"""', "R'''", 'R"""', "b'''", 'b"""', "B'''", 'B"""', + "f'''", 'f"""', "F'''", 'F"""', "br'''", 'br"""', "Br'''", 'Br"""', "bR'''", 'bR"""', "BR'''", 'BR"""', "rb'''", 'rb"""', "rB'''", 'rB"""', "Rb'''", 'Rb"""', "RB'''", 'RB"""', + "fr'''", 'fr"""', "Fr'''", 'Fr"""', + "fR'''", 'fR"""', "FR'''", 'FR"""', + "rf'''", 'rf"""', "rF'''", 'rF"""', + "Rf'''", 'Rf"""', "RF'''", 'RF"""', "u'''", 'u"""', "U'''", 'U"""', "p'''", 'p""""', "pr'''", 'pr""""', "pR'''", 'pR""""', "rp'''", 'rp""""', @@ -306,10 +320,15 @@ for t in ("'", '"', "r'", 'r"', "R'", 'R"', "b'", 'b"', "B'", 'B"', + "f'", 'f"', "F'", 'F"', "br'", 'br"', "Br'", 'Br"', "bR'", 'bR"', "BR'", 'BR"', "rb'", 'rb"', "rB'", 'rB"', "Rb'", 'Rb"', "RB'", 'RB"', + "fr'", 'fr"', "Fr'", 'Fr"', + "fR'", 'fR"', "FR'", 'FR"', + "rf'", 'rf"', "rF'", 'rF"', + "Rf'", 'Rf"', "RF'", 'RF"', "u'", 'u"', "U'", 'U"', "p'", 'p"', "pr'", 'pr"', "pR'", 'pR"', "rp'", 'rp"', @@ -801,7 +820,7 @@ def tokenize(readline): """ - The tokenize() generator requires one argment, readline, which + The tokenize() generator requires one argument, readline, which must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as bytes. Alternately, readline diff -Nru xonsh-0.5.12+dfsg/xonsh/tools.py xonsh-0.6.0+dfsg/xonsh/tools.py --- xonsh-0.5.12+dfsg/xonsh/tools.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/tools.py 2017-11-23 00:23:47.000000000 +0000 @@ -23,6 +23,7 @@ import contextlib import ctypes import datetime +from distutils.version import LooseVersion import functools import glob import itertools @@ -38,6 +39,7 @@ # adding imports from further xonsh modules is discouraged to avoid circular # dependencies +from xonsh import __version__ from xonsh.lazyasd import LazyObject, LazyDict, lazyobject from xonsh.platform import (has_prompt_toolkit, scandir, DEFAULT_ENCODING, ON_LINUX, ON_WINDOWS, PYTHON_VERSION_INFO, @@ -216,6 +218,16 @@ p.breakable() p.pretty(item) + def __add__(self, other): + if isinstance(other, EnvPath): + other = other._l + return EnvPath(self._l + other) + + def __radd__(self, other): + if isinstance(other, EnvPath): + other = other._l + return EnvPath(other + self._l) + class DefaultNotGivenType(object): """Singleton for representing when no default value is given.""" @@ -250,6 +262,25 @@ return rtok.type == 'RPAREN' and any(x != 'LPAREN' for x in lparens) +def balanced_parens(line, mincol=0, maxcol=None, lexer=None): + """Determines if parentheses are balanced in an expression.""" + line = line[mincol:maxcol] + if lexer is None: + lexer = builtins.__xonsh_execer__.parser.lexer + if '(' not in line and ')' not in line: + return True + cnt = 0 + lexer.input(line) + for tok in lexer: + if tok.type in LPARENS: + cnt += 1 + elif tok.type == 'RPAREN': + cnt -= 1 + elif tok.type == 'ERRORTOKEN' and ')' in tok.value: + cnt -= 1 + return cnt == 0 + + def find_next_break(line, mincol=0, lexer=None): """Returns the column number of the next logical break in subproc mode. This function may be useful in finding the maxcol argument of @@ -284,7 +315,7 @@ def subproc_toks(line, mincol=-1, maxcol=None, lexer=None, returnline=False, greedy=False): - """Excapsulates tokens in a source code line in a uncaptured + """Encapsulates tokens in a source code line in a uncaptured subprocess ![] starting at a minimum column. If there are no tokens (ie in a comment line) this returns None. If greedy is True, it will encapsulate normal parentheses. Greedy is False by default. @@ -418,7 +449,7 @@ def get_line_continuation(): - """ The line contiuation characters used in subproc mode. In interactive + """ The line continuation characters used in subproc mode. In interactive mode on Windows the backslash must be preceded by a space. This is because paths on Windows may end in a backslash. """ @@ -443,7 +474,7 @@ start = idx line = lines[idx] open_triple = _have_open_triple_quotes(line) - while (line.endswith(linecont) or open_triple) and idx < nlines: + while (line.endswith(linecont) or open_triple) and idx < nlines - 1: n += 1 idx += 1 if line.endswith(linecont): @@ -504,7 +535,7 @@ def subexpr_before_unbalanced(expr, ltok, rtok): - """Obtains the expression prior to last unblanced left token.""" + """Obtains the expression prior to last unbalanced left token.""" subexpr, _, post = expr.rpartition(ltok) nrtoks_in_post = post.count(rtok) while nrtoks_in_post != 0: @@ -875,12 +906,11 @@ def escape_windows_cmd_string(s): """Returns a string that is usable by the Windows cmd.exe. - The escaping is based on details here and emperical testing: + The escaping is based on details here and empirical testing: http://www.robvanderwoude.com/escapechars.php """ - for c in '()%!^<>&|"': + for c in '^()%!<>&|"': s = s.replace(c, '^' + c) - s = s.replace('/?', '/.') return s @@ -1427,7 +1457,7 @@ def is_dynamic_cwd_width(x): """ Determine if the input is a valid input for the DYNAMIC_CWD_WIDTH - environement variable. + environment variable. """ return (isinstance(x, tuple) and len(x) == 2 and @@ -1463,7 +1493,7 @@ def to_history_tuple(x): - """Converts to a canonincal history tuple.""" + """Converts to a canonical history tuple.""" if not isinstance(x, (cabc.Sequence, float, int)): raise ValueError('history size must be given as a sequence or number') if isinstance(x, str): @@ -1612,7 +1642,7 @@ except Exception: print_exception() # \001\002 is there to fool pygments into not returning an empty string - # for potentially empty input. This happend when the template is just a + # for potentially empty input. This happens when the template is just a # color code with no visible text. invis = '\001\002' s = shell.format_color(invis + s + invis, force_string=True) @@ -1620,7 +1650,7 @@ return s -_RE_STRING_START = "[bBprRuU]*" +_RE_STRING_START = "[bBprRuUf]*" _RE_STRING_TRIPLE_DOUBLE = '"""' _RE_STRING_TRIPLE_SINGLE = "'''" _RE_STRING_DOUBLE = '"' @@ -1725,7 +1755,7 @@ return (string_indices[-2], string_indices[-1], starting_quote[-1]) -# regular expressions for matching enviroment variables +# regular expressions for matching environment variables # i.e $FOO, ${'FOO'} @lazyobject def POSIX_ENVVAR_REGEX(): @@ -1771,7 +1801,7 @@ def normabspath(p): - """Retuns as normalized absolute path, namely, normcase(abspath(p))""" + """Returns as normalized absolute path, namely, normcase(abspath(p))""" return os.path.normcase(os.path.abspath(p)) @@ -1940,3 +1970,72 @@ def carriage_return(): """Writes a carriage return to stdout, and nothing else.""" print('\r', flush=True, end='') + + +def deprecated(deprecated_in=None, removed_in=None): + """Parametrized decorator that deprecates a function in a graceful manner. + + Updates the decorated function's docstring to mention the version + that deprecation occurred in and the version it will be removed + in if both of these values are passed. + + When removed_in is not a release equal to or less than the current + release, call ``warnings.warn`` with details, while raising + ``DeprecationWarning``. + + When removed_in is a release equal to or less than the current release, + raise an ``AssertionError``. + + Parameters + ---------- + deprecated_in : str + The version number that deprecated this function. + removed_in : str + The version number that this function will be removed in. + """ + message_suffix = _deprecated_message_suffix(deprecated_in, removed_in) + if not message_suffix: + message_suffix = '' + + def decorated(func): + warning_message = '{} has been deprecated'.format(func.__name__) + warning_message += message_suffix + + @functools.wraps(func) + def wrapped(*args, **kwargs): + _deprecated_error_on_expiration(func.__name__, removed_in) + func(*args, **kwargs) + warnings.warn(warning_message, DeprecationWarning) + + wrapped.__doc__ = ( + '{}\n\n{}'.format(wrapped.__doc__, warning_message) + if wrapped.__doc__ else warning_message) + + return wrapped + return decorated + + +def _deprecated_message_suffix(deprecated_in, removed_in): + if deprecated_in and removed_in: + message_suffix = ( + ' in version {} and will be removed in version {}'.format( + deprecated_in, removed_in)) + elif deprecated_in and not removed_in: + message_suffix = ( + ' in version {}'.format(deprecated_in)) + elif not deprecated_in and removed_in: + message_suffix = ( + ' and will be removed in version {}'.format(removed_in)) + else: + message_suffix = None + + return message_suffix + + +def _deprecated_error_on_expiration(name, removed_in): + if not removed_in: + return + elif LooseVersion(__version__) >= LooseVersion(removed_in): + raise AssertionError( + '{} has passed its version {} expiry date!'.format( + name, removed_in)) diff -Nru xonsh-0.5.12+dfsg/xonsh/tracer.py xonsh-0.6.0+dfsg/xonsh/tracer.py --- xonsh-0.5.12+dfsg/xonsh/tracer.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/tracer.py 2017-11-23 00:23:47.000000000 +0000 @@ -50,7 +50,7 @@ # we have to use a function to set usecolor because of the way that # lazyasd works. Namely, it cannot dispatch setattr to the target # object without being unable to access its own __dict__. This makes - # setting an atter look like getting a function. + # setting an attr look like getting a function. self.usecolor = usecolor def start(self, filename): diff -Nru xonsh-0.5.12+dfsg/xonsh/winutils.py xonsh-0.6.0+dfsg/xonsh/winutils.py --- xonsh-0.5.12+dfsg/xonsh/winutils.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/winutils.py 2017-11-23 00:23:47.000000000 +0000 @@ -28,7 +28,7 @@ LPDWORD, SHORT, LPCWSTR, WORD, SMALL_RECT, LPCSTR) from xonsh.lazyasd import lazyobject -from xonsh import lazyimps # we aren't amagamated in this module. +from xonsh import lazyimps # we aren't amalgamated in this module. from xonsh import platform @@ -246,7 +246,7 @@ def enable_virtual_terminal_processing(): """Enables virtual terminal processing on Windows. - This inlcudes ANSI escape sequence interpretation. + This includes ANSI escape sequence interpretation. See http://stackoverflow.com/a/36760881/2312428 """ SetConsoleMode(GetStdHandle(-11), 7) @@ -305,7 +305,7 @@ def read_console_output_character(x=0, y=0, fd=1, buf=None, bufsize=1024, raw=False): - """Reads chracters from the console buffer. + """Reads characters from the console buffer. Parameters ---------- @@ -320,7 +320,7 @@ An existing buffer to (re-)use. bufsize : int, optional The maximum read size. - raw : bool, opional + raw : bool, optional Whether to read in and return as bytes (True) or as a unicode string (False, default). diff -Nru xonsh-0.5.12+dfsg/xonsh/wizard.py xonsh-0.6.0+dfsg/xonsh/wizard.py --- xonsh-0.5.12+dfsg/xonsh/wizard.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/wizard.py 2017-11-23 00:23:47.000000000 +0000 @@ -65,7 +65,7 @@ Mapping from user-input responses to nodes. converter : callable, optional Converts the string the user typed into another object - that serves as a key to the reponses dict. + that serves as a key to the responses dict. path : str or sequence of str, optional A path within the storage object. """ @@ -99,7 +99,7 @@ default False. retry : bool, optional In the event that the conversion operation fails, should - users be re-prompted until they provide valid input. Deafult False. + users be re-prompted until they provide valid input. Default False. path : str or sequence of str, optional A path within the storage object. """ @@ -113,9 +113,10 @@ class While(Node): """Computes a body while a condition function evaluates to true. - The condition function has the form cond(visitor=None, node=None) and - should return an object that is convertable to a bool. The beg attribute - specifies the number to start the loop iteration at. + + The condition function has the form ``cond(visitor=None, node=None)`` and + must return an object that responds to the Python magic method ``__bool__``. + The beg attribute specifies the number to start the loop iteration at. """ attrs = ('cond', 'body', 'idxname', 'beg', 'path') @@ -126,11 +127,11 @@ ---------- cond : callable Function that determines if the next loop iteration should - be executed. The condition function has the form - cond(visitor=None, node=None) and should return an object that - is convertable to a bool. + be executed. body : sequence of nodes - A list of node to execute on each iteration. + A list of node to execute on each iteration. The condition function + has the form ``cond(visitor=None, node=None)`` and must return an + object that responds to the Python magic method ``__bool__``. idxname : str, optional The variable name for the index. beg : int, optional @@ -212,7 +213,7 @@ class StateFile(Input): - """Node for repesenting the state as a JSON file under a default or user + """Node for representing the state as a JSON file under a default or user given file name. This node type is likely not useful on its own. """ diff -Nru xonsh-0.5.12+dfsg/xonsh/xonfig.py xonsh-0.6.0+dfsg/xonsh/xonfig.py --- xonsh-0.5.12+dfsg/xonsh/xonfig.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/xonfig.py 2017-11-23 00:23:47.000000000 +0000 @@ -74,7 +74,7 @@ {{YELLOW}}--------------------------{{NO_COLOR}} The xonsh shell also allows you to setup environment variables from the static configuration file. Any variables set in this way are -superceded by the definitions in the xonshrc or on the command line. +superseded by the definitions in the xonshrc or on the command line. Still, setting environment variables in this way can help define options that are global to the system or user. @@ -530,7 +530,7 @@ def _align_string(string, align='<', fill=' ', width=80): - """ Align and pad a color formattet string """ + """ Align and pad a color formatted string """ linelen = len(STRIP_COLOR_RE.sub('', string)) padlen = max(width-linelen, 0) if align == '^': diff -Nru xonsh-0.5.12+dfsg/xonsh/xontribs.json xonsh-0.6.0+dfsg/xonsh/xontribs.json --- xonsh-0.5.12+dfsg/xonsh/xontribs.json 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/xontribs.json 2017-11-23 00:23:47.000000000 +0000 @@ -27,7 +27,7 @@ "package": "xonsh", "url": "http://xon.sh", "description": [ - "Additional core utilites that are implemened in xonsh. The current list ", + "Additional core utilities that are implemented in xonsh. The current list ", "includes:\n", "\n", "* cat\n", @@ -47,10 +47,10 @@ "url": "http://xon.sh", "description": [ "The distributed parallel computing library hooks for xonsh. ", - "Importantly this provides a subsitute 'dworker' command which enables ", + "Importantly this provides a substitute 'dworker' command which enables ", "distributed workers to have access to xonsh builtins.\n\n", "Furthermore, this xontrib adds a 'DSubmitter' context manager for ", - "executing a block remotely. Moroever, this also adds a convienece ", + "executing a block remotely. Moreover, this also adds a convenience ", "function 'dsubmit()' for creating DSubmitter and Executor instances ", "at the same time. Thus users may submit distributed jobs with::\n\n", " with dsubmit('127.0.0.1:8786', rtn='x') as dsub:\n", @@ -93,6 +93,13 @@ "if any extensions are enabled that hook the prompt and relies on", "``os.getcwd()``"] }, + {"name": "whole_word_jumping", + "package": "xonsh", + "url": "http://xon.sh", + "description": [ + "Jumping across whole words (non-whitespace) with Ctrl+Left/Right.", + "Alt+Left/Right remains unmodified to jump over smaller word segments."] + }, {"name": "scrapy_tabcomplete", "package": "xonsh-scrapy-tabcomplete", "url": "https://github.com/Granitas/xonsh-scrapy-tabcomplete", @@ -150,6 +157,11 @@ "package": "xontrib-fzf-widgets", "url": "https://github.com/shahinism/xontrib-fzf-widgets", "description": ["Adds some fzf widgets to your xonsh shell."] + }, + {"name": "schedule", + "package": "xontrib-schedule", + "url": "https://github.com/astronouth7303/xontrib-schedule", + "description": ["Xonsh Task Scheduling"] } ], "packages": { @@ -158,14 +170,14 @@ "url": "http://exofrills.org", "install": { "conda": "conda install -c conda-forge xo", - "pip": "pip install exofrills"} + "pip": "xpip install exofrills"} }, "xonsh": { "license": "BSD 3-clause", "url": "http://xon.sh", "install": { "conda": "conda install -c conda-forge xonsh", - "pip": "pip install xonsh", + "pip": "xpip install xonsh", "aura": "sudo aura -A xonsh", "yaourt": "yaourt -Sa xonsh"} }, @@ -173,98 +185,105 @@ "license": "MIT", "url": "https://github.com/Siecje/xontrib-prompt-ret-code", "install": { - "pip": "pip install xontrib-prompt-ret-code" + "pip": "xpip install xontrib-prompt-ret-code" } }, "xonsh-apt-tabcomplete": { "license": "BSD 2-clause", "url": "https://github.com/DangerOnTheRanger/xonsh-apt-tabcomplete", "install": { - "pip": "pip install xonsh-apt-tabcomplete" + "pip": "xpip install xonsh-apt-tabcomplete" } }, "xonsh-docker-tabcomplete": { "license": "MIT", "url": "https://github.com/xsteadfastx/xonsh-docker-tabcomplete", "install": { - "pip": "pip install xonsh-docker-tabcomplete" + "pip": "xpip install xonsh-docker-tabcomplete" } }, "xonsh-scrapy-tabcomplete": { "license": "GPLv3", "url": "https://github.com/Granitas/xonsh-scrapy-tabcomplete", "install": { - "pip": "pip install xonsh-scrapy-tabcomplete" + "pip": "xpip install xonsh-scrapy-tabcomplete" } }, "xonsh-vox-tabcomplete": { "license": "GPLv3", "url": "https://github.com/Granitosaurus/xonsh-vox-tabcomplete", "install": { - "pip": "pip install xonsh-vox-tabcomplete" + "pip": "xpip install xonsh-vox-tabcomplete" } }, "xonsh-click-tabcomplete": { "license": "GPLv3", "url": "https://github.com/Granitosaurus/xonsh-click-tabcomplete", "install": { - "pip": "pip install xonsh-click-tabcomplete" + "pip": "xpip install xonsh-click-tabcomplete" } }, "xonsh-autoxsh": { "license": "GPLv3", "url": "https://github.com/Granitas/xonsh-autoxsh", "install": { - "pip": "pip install xonsh-autoxsh" + "pip": "xpip install xonsh-autoxsh" } }, "xonda": { "license": "MIT", "url": "https://github.com/gforsyth/xonda", "install": { - "pip": "pip install xonda" + "pip": "xpip install xonda" } }, "xontrib-avox": { "license": "GPLv3", "url": "https://github.com/astronouth7303/xontrib-avox", "install": { - "pip": "xip install xontrib-avox" + "pip": "xpip install xontrib-avox" } }, "xontrib-z": { "license": "GPLv3", "url": "https://github.com/astronouth7303/xontrib-z", "install": { - "pip": "xip install xontrib-z" + "pip": "xpip install xontrib-z" } }, "xontrib-powerline": { "license": "MIT", "url": "https://github.com/santagada/xontrib-powerline", "install": { - "pip": "pip install xontrib-powerline" + "pip": "xpip install xontrib-powerline" } }, "xontrib-thefuck": { "license": "MIT", "url": "https://github.com/meatballs/xontrib-thefuck", "install": { - "pip": "pip install xontrib-thefuck" + "pip": "xpip install xontrib-thefuck" } }, "xontrib-prompt-vi-mode": { "license": "MIT", "url": "https://github.com/t184256/xontrib-prompt-vi-mode", "install": { - "pip": "pip install xontrib-prompt-vi-mode" + "pip": "xpip install xontrib-prompt-vi-mode" } }, "xontrib-fzf-widgets": { "license": "GPLv3", "url": "https://github.com/shahinism/xontrib-fzf-widgets", "install": { - "pip": "xip install xontrib-fzf-widgets" + "pip": "xpip install xontrib-fzf-widgets" + } + }, + "xontrib-schedule": { + "license": "MIT", + "url": "https://github.com/astronouth7303/xontrib-schedule", + "install": { + "pip": "xpip install xontrib-schedule" } } } diff -Nru xonsh-0.5.12+dfsg/xonsh/xontribs.py xonsh-0.6.0+dfsg/xonsh/xontribs.py --- xonsh-0.5.12+dfsg/xonsh/xontribs.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xonsh/xontribs.py 2017-11-23 00:23:47.000000000 +0000 @@ -51,8 +51,8 @@ print('The following xontribs are enabled but not installed: \n' ' {xontribs}\n' 'To install them run \n' - ' pip install {packages}'.format(xontribs=' '.join(names), - packages=' '.join(packages))) + ' xpip install {packages}'.format(xontribs=' '.join(names), + packages=' '.join(packages))) def update_context(name, ctx=None): diff -Nru xonsh-0.5.12+dfsg/xontrib/bashisms.py xonsh-0.6.0+dfsg/xontrib/bashisms.py --- xonsh-0.5.12+dfsg/xontrib/bashisms.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xontrib/bashisms.py 2017-11-23 00:23:47.000000000 +0000 @@ -1,7 +1,12 @@ """Bash-like interface extensions for xonsh.""" +import shlex +import sys + from prompt_toolkit.keys import Keys from prompt_toolkit.filters import Condition, EmacsInsertMode, ViInsertMode +__all__ = () + @events.on_transform_command def bash_preproc(cmd, **kw): @@ -26,3 +31,28 @@ def recall_last_arg(event): arg = __xonsh_history__[-1].cmd.split()[-1] event.current_buffer.insert_text(arg) + + +def alias(args, stdin=None): + ret = 0 + + if args: + for arg in args: + if '=' in arg: + # shlex.split to remove quotes, e.g. "foo='echo hey'" into + # "foo=echo hey" + name, cmd = shlex.split(arg)[0].split('=', 1) + aliases[name] = shlex.split(cmd) + elif arg in aliases: + print('{}={}'.format(arg, aliases[arg])) + else: + print("alias: {}: not found".format(arg), file=sys.stderr) + ret = 1 + else: + for alias, cmd in aliases.items(): + print('{}={}'.format(alias, cmd)) + + return ret + + +aliases['alias'] = alias diff -Nru xonsh-0.5.12+dfsg/xontrib/coreutils.py xonsh-0.6.0+dfsg/xontrib/coreutils.py --- xonsh-0.5.12+dfsg/xontrib/coreutils.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xontrib/coreutils.py 2017-11-23 00:23:47.000000000 +0000 @@ -1,4 +1,4 @@ -"""Additional core utilites that are implemented in xonsh. The current list +"""Additional core utilities that are implemented in xonsh. The current list includes: * cat diff -Nru xonsh-0.5.12+dfsg/xontrib/distributed.py xonsh-0.6.0+dfsg/xontrib/distributed.py --- xonsh-0.5.12+dfsg/xontrib/distributed.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xontrib/distributed.py 2017-11-23 00:23:47.000000000 +0000 @@ -5,7 +5,7 @@ def dworker(args, stdin=None): - """Programatic access to the dworker utility, to allow launching + """Programmatic access to the dworker utility, to allow launching workers that also have access to xonsh builtins. """ from distributed.cli import dworker diff -Nru xonsh-0.5.12+dfsg/xontrib/free_cwd.py xonsh-0.6.0+dfsg/xontrib/free_cwd.py --- xonsh-0.5.12+dfsg/xontrib/free_cwd.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xontrib/free_cwd.py 2017-11-23 00:23:47.000000000 +0000 @@ -32,7 +32,7 @@ """ Decorator for Windows to the wrap the prompt function and release the process lock on the current directory while the prompt is displayed. This works by temporarily setting - the workdir to the users home direcotry. + the workdir to the users home directory. """ env = builtins.__xonsh_env__ if env.get('UPDATE_PROMPT_ON_KEYPRESS'): diff -Nru xonsh-0.5.12+dfsg/xontrib/mplhooks.py xonsh-0.6.0+dfsg/xontrib/mplhooks.py --- xonsh-0.5.12+dfsg/xontrib/mplhooks.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xontrib/mplhooks.py 2017-11-23 00:23:47.000000000 +0000 @@ -93,7 +93,7 @@ # leave only one line for top and bottom fig.subplots_adjust(bottom=1/height, top=1-1/height, left=0, right=1) - # redeuce font size in order to reduce text impact on the image + # reduce font size in order to reduce text impact on the image font_size = matplotlib.rcParams['font.size'] matplotlib.rcParams.update({'font.size': 0}) else: diff -Nru xonsh-0.5.12+dfsg/xontrib/mpl.py xonsh-0.6.0+dfsg/xontrib/mpl.py --- xonsh-0.5.12+dfsg/xontrib/mpl.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xontrib/mpl.py 2017-11-23 00:23:47.000000000 +0000 @@ -44,7 +44,7 @@ """This is a monkey patched version of matplotlib.pyplot.show() for xonsh's interactive mode. First it tries non-blocking mode (block=False). If for some reason this fails, it will run show - in normal bloking mode (block=True). + in normal blocking mode (block=True). """ kwargs.update(block=False) rtn = plt_show(*args, **kwargs) diff -Nru xonsh-0.5.12+dfsg/xontrib/vox.py xonsh-0.6.0+dfsg/xontrib/vox.py --- xonsh-0.5.12+dfsg/xontrib/vox.py 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xontrib/vox.py 2017-11-23 00:23:47.000000000 +0000 @@ -100,13 +100,13 @@ try: self.vox.activate(args.name) except KeyError: - print('This environment doesn\'t exist. Create it with "vox new %s".\n' % name, file=sys.stderr) + print('This environment doesn\'t exist. Create it with "vox new %s".\n' % args.name, file=sys.stderr) return None else: print('Activated "%s".\n' % args.name) def cmd_deactivate(self, args, stdin=None): - """Deactive the active virtual environment.""" + """Deactivate the active virtual environment.""" if self.vox.active() is None: print('No environment currently active. Activate one with "vox activate".\n', file=sys.stderr) diff -Nru xonsh-0.5.12+dfsg/xontrib/whole_word_jumping.py xonsh-0.6.0+dfsg/xontrib/whole_word_jumping.py --- xonsh-0.5.12+dfsg/xontrib/whole_word_jumping.py 1970-01-01 00:00:00.000000000 +0000 +++ xonsh-0.6.0+dfsg/xontrib/whole_word_jumping.py 2017-11-23 00:23:47.000000000 +0000 @@ -0,0 +1,32 @@ +"""Jumping across whole words (non-whitespace) with Ctrl+Left/Right. + +Alt+Left/Right remains unmodified to jump over smaller word segments. +""" +from prompt_toolkit.keys import Keys + +__all__ = () + + +@events.on_ptk_create +def custom_keybindings(bindings, **kw): + + # Key bindings for jumping over whole words (everything that's not + # white space) using Ctrl+Left and Ctrl+Right; + # Alt+Left and Alt+Right still jump over smaller word segments. + # See https://github.com/xonsh/xonsh/issues/2403 + + handler = bindings.registry.add_binding + + @handler(Keys.ControlLeft) + def ctrl_left(event): + buff = event.current_buffer + pos = buff.document.find_previous_word_beginning(count=event.arg, WORD=True) + if pos: + buff.cursor_position += pos + + @handler(Keys.ControlRight) + def ctrl_right(event): + buff = event.current_buffer + pos = buff.document.find_next_word_ending(count=event.arg, WORD=True) + if pos: + buff.cursor_position += pos diff -Nru xonsh-0.5.12+dfsg/xontribs.json xonsh-0.6.0+dfsg/xontribs.json --- xonsh-0.5.12+dfsg/xontribs.json 2017-06-10 13:05:15.000000000 +0000 +++ xonsh-0.6.0+dfsg/xontribs.json 2017-11-23 00:23:47.000000000 +0000 @@ -27,7 +27,7 @@ "package": "xonsh", "url": "http://xon.sh", "description": [ - "Additional core utilites that are implemened in xonsh. The current list ", + "Additional core utilities that are implemented in xonsh. The current list ", "includes:\n", "\n", "* cat\n", @@ -47,10 +47,10 @@ "url": "http://xon.sh", "description": [ "The distributed parallel computing library hooks for xonsh. ", - "Importantly this provides a subsitute 'dworker' command which enables ", + "Importantly this provides a substitute 'dworker' command which enables ", "distributed workers to have access to xonsh builtins.\n\n", "Furthermore, this xontrib adds a 'DSubmitter' context manager for ", - "executing a block remotely. Moroever, this also adds a convienece ", + "executing a block remotely. Moreover, this also adds a convenience ", "function 'dsubmit()' for creating DSubmitter and Executor instances ", "at the same time. Thus users may submit distributed jobs with::\n\n", " with dsubmit('127.0.0.1:8786', rtn='x') as dsub:\n", @@ -93,6 +93,13 @@ "if any extensions are enabled that hook the prompt and relies on", "``os.getcwd()``"] }, + {"name": "whole_word_jumping", + "package": "xonsh", + "url": "http://xon.sh", + "description": [ + "Jumping across whole words (non-whitespace) with Ctrl+Left/Right.", + "Alt+Left/Right remains unmodified to jump over smaller word segments."] + }, {"name": "scrapy_tabcomplete", "package": "xonsh-scrapy-tabcomplete", "url": "https://github.com/Granitas/xonsh-scrapy-tabcomplete", @@ -150,6 +157,11 @@ "package": "xontrib-fzf-widgets", "url": "https://github.com/shahinism/xontrib-fzf-widgets", "description": ["Adds some fzf widgets to your xonsh shell."] + }, + {"name": "schedule", + "package": "xontrib-schedule", + "url": "https://github.com/astronouth7303/xontrib-schedule", + "description": ["Xonsh Task Scheduling"] } ], "packages": { @@ -158,14 +170,14 @@ "url": "http://exofrills.org", "install": { "conda": "conda install -c conda-forge xo", - "pip": "pip install exofrills"} + "pip": "xpip install exofrills"} }, "xonsh": { "license": "BSD 3-clause", "url": "http://xon.sh", "install": { "conda": "conda install -c conda-forge xonsh", - "pip": "pip install xonsh", + "pip": "xpip install xonsh", "aura": "sudo aura -A xonsh", "yaourt": "yaourt -Sa xonsh"} }, @@ -173,98 +185,105 @@ "license": "MIT", "url": "https://github.com/Siecje/xontrib-prompt-ret-code", "install": { - "pip": "pip install xontrib-prompt-ret-code" + "pip": "xpip install xontrib-prompt-ret-code" } }, "xonsh-apt-tabcomplete": { "license": "BSD 2-clause", "url": "https://github.com/DangerOnTheRanger/xonsh-apt-tabcomplete", "install": { - "pip": "pip install xonsh-apt-tabcomplete" + "pip": "xpip install xonsh-apt-tabcomplete" } }, "xonsh-docker-tabcomplete": { "license": "MIT", "url": "https://github.com/xsteadfastx/xonsh-docker-tabcomplete", "install": { - "pip": "pip install xonsh-docker-tabcomplete" + "pip": "xpip install xonsh-docker-tabcomplete" } }, "xonsh-scrapy-tabcomplete": { "license": "GPLv3", "url": "https://github.com/Granitas/xonsh-scrapy-tabcomplete", "install": { - "pip": "pip install xonsh-scrapy-tabcomplete" + "pip": "xpip install xonsh-scrapy-tabcomplete" } }, "xonsh-vox-tabcomplete": { "license": "GPLv3", "url": "https://github.com/Granitosaurus/xonsh-vox-tabcomplete", "install": { - "pip": "pip install xonsh-vox-tabcomplete" + "pip": "xpip install xonsh-vox-tabcomplete" } }, "xonsh-click-tabcomplete": { "license": "GPLv3", "url": "https://github.com/Granitosaurus/xonsh-click-tabcomplete", "install": { - "pip": "pip install xonsh-click-tabcomplete" + "pip": "xpip install xonsh-click-tabcomplete" } }, "xonsh-autoxsh": { "license": "GPLv3", "url": "https://github.com/Granitas/xonsh-autoxsh", "install": { - "pip": "pip install xonsh-autoxsh" + "pip": "xpip install xonsh-autoxsh" } }, "xonda": { "license": "MIT", "url": "https://github.com/gforsyth/xonda", "install": { - "pip": "pip install xonda" + "pip": "xpip install xonda" } }, "xontrib-avox": { "license": "GPLv3", "url": "https://github.com/astronouth7303/xontrib-avox", "install": { - "pip": "xip install xontrib-avox" + "pip": "xpip install xontrib-avox" } }, "xontrib-z": { "license": "GPLv3", "url": "https://github.com/astronouth7303/xontrib-z", "install": { - "pip": "xip install xontrib-z" + "pip": "xpip install xontrib-z" } }, "xontrib-powerline": { "license": "MIT", "url": "https://github.com/santagada/xontrib-powerline", "install": { - "pip": "pip install xontrib-powerline" + "pip": "xpip install xontrib-powerline" } }, "xontrib-thefuck": { "license": "MIT", "url": "https://github.com/meatballs/xontrib-thefuck", "install": { - "pip": "pip install xontrib-thefuck" + "pip": "xpip install xontrib-thefuck" } }, "xontrib-prompt-vi-mode": { "license": "MIT", "url": "https://github.com/t184256/xontrib-prompt-vi-mode", "install": { - "pip": "pip install xontrib-prompt-vi-mode" + "pip": "xpip install xontrib-prompt-vi-mode" } }, "xontrib-fzf-widgets": { "license": "GPLv3", "url": "https://github.com/shahinism/xontrib-fzf-widgets", "install": { - "pip": "xip install xontrib-fzf-widgets" + "pip": "xpip install xontrib-fzf-widgets" + } + }, + "xontrib-schedule": { + "license": "MIT", + "url": "https://github.com/astronouth7303/xontrib-schedule", + "install": { + "pip": "xpip install xontrib-schedule" } } }