Commit Graph

26 Commits

Author SHA1 Message Date
Foo 25657089db Remove mutable global variables from daemon script 2016-08-20 21:03:24 +03:00
Foo 03e63fc8d2 Also provide WM threads with common shutdown event and config loader 2016-08-20 21:03:24 +03:00
Foo 5784c0cbc6 Use powerline daemon for running awesome bindings
Also adds functional tests for awesome bindings.

Replaces #1641
2016-08-20 21:03:24 +03:00
Iblis Lin 436be7dacb Increase socket backlog number for `powerline-daemon` 2016-05-28 14:25:54 +08:00
ZyX ea9eae676f Always write UTF-8 string 2015-01-25 17:17:24 +03:00
ZyX 0c37948c37 Allow --foreground to be used with --replace
Fixes #1235
2015-01-08 16:48:42 +03:00
ZyX 917dfed842 Take overrides from environment variables
Ref #1201
2015-01-07 01:09:53 +03:00
ZyX 45ccbee171 Use singular --*-override form for command-line overrides
Ref #1126
2015-01-07 01:09:52 +03:00
ZyX aaf52c92c5 Use sockets in abstract namespace only if running on linux
Also adds fallback to shell client which uses `uname -o` in place of `ostype`.

Closes #1215
2014-12-06 00:05:25 +03:00
ZyX fadd1eec17 Move all parser definitions to powerline.commands.*.get_argparser()
Reasoning: they will be easier to reach there. It will also be possible to use
specific ArgumentParser class that will just collect data for sphinx.
2014-10-25 22:03:33 +04:00
ZyX 77b0695caf Replace all ASCII ' with Unicode ’ in comments and docstrings 2014-09-20 17:48:15 +04:00
ZyX 849fef9b5a Use powerline.lib.encoding* in place of sys.get*encoding/locale.get*
Fixes #1078
2014-09-17 00:05:10 +04:00
ZyX d3b57f7c31 Include args.config_path in the key
Consider the following script:

    % powerline-daemon -s powerline-test
    % powerline --socket powerline-test -p/dev/null shell left
    Config file not found in search paths (/dev/null): config.json
    % powerline --socket powerline-test shell left
    Config file not found in search paths (/dev/null): config.json

Note the problem: second call to powerline does not use offending path, but it 
still emits the error “Config file not found in search paths”.
2014-09-08 23:53:05 +04:00
ZyX 06211cbe63 Unify imports
Now imports follow the following structure:

1. __future__ line: exactly one line allowed:

        from __future__ import (unicode_literals, division, absolute_import, print_function)

   (powerline.shell is the only exception due to problems with argparse).
2. Standard python library imports in a form `import X`.
3. Standard python library imports in a form `from X import Y`.
4. and 5. 2. and 3. for third-party (non-python and non-powerline imports).
6. 3. for powerline non-test imports.
7. and 8. 2. and 3. for powerline testing module imports.

Each list entry is separated by exactly one newline from another import. If
there is module docstring it goes between `# vim:` comment and `__future__`
import. So the structure containing all items is the following:

    #!/usr/bin/env python
    # vim:fileencoding=utf-8:noet

    '''Powerline super module'''

    import sys

    from argparse import ArgumentParser

    import psutil

    from colormath.color_diff import delta_e_cie2000

    from powerline.lib.unicode import u

    import tests.vim as vim_module

    from tests import TestCase

.
2014-09-01 00:25:24 +04:00
ZyX 0e98bc2d4f Fix style in a number of places
- Fixes lines where line with N tab indent is followed by a line with N+2 tab 
  indent or greater (most of such lines were already fixed in 
  ae92d83eae, but regex used there has one flow: 
  it does not catches lines where N=0 for which case first `\+` needs to be 
  replaced with `*`).
- Replace print(…, file=sys.stderr) with sys.stderr.write in powerline-daemon.
2014-08-31 21:29:03 +04:00
ZyX 7e7803f680 Make powerline-render respect user locale as well
Closes #1023
2014-08-27 22:38:52 +04:00
ZyX 70e7088b04 Do not replace ascii with UTF-8 in powerline-daemon and python client
Assuming ascii was expected to be used when LANG=C it did not work in any case:
in this case preferred encoding is “ANSI_X3.4-1968”. Same for
`sys.getfilesystemencoding()`.
2014-08-27 22:34:13 +04:00
ZyX d88d87f6af Do not make daemon output zero byte
This byte is useless and can be seen in zsh output (strange that it did not 
cause bugs so far, at least none I know about). It may have been needed if any 
client was supposed to hold connection with daemon for a few runs, but all 
current clients work in “request → output response → exit” fashion without 
caring about terminating newline and definitely without preserving connection to 
daemon accross runs.
2014-08-26 21:13:56 +04:00
ZyX 0232d3215b Add --socket argument to all clients
Makes it not needed to kill daemon for testing, but disables implicit
`powerline-config shell command` testing.
2014-08-23 15:19:00 +04:00
ZyX 74d147a0be Use `open` to open file descriptors in place of `file`
Reason: there is no `file()` in Python 3.

Fix was originally presented by @kovidgoyal in [3deb69][1], but I cannot
cherry-pick this commit, because its commit message is highly undescriptive.

Fixes #1008

[1]: 3deb6988c8
2014-08-23 04:34:44 +04:00
ZyX 203a374b54 Do not use argparge for parsing --env and --cwd
It took 2/3 of do_render call according to profiler. New variant takes only 1/6.

WARNING: This commit will break all powerline installations with running daemon
because it changes communication protocol. You must kill and restart all your
powerline daemons for powerline to function properly.

Highlight @kovidgoyal
2014-08-04 03:02:05 +04:00
ZyX cfb107724f Exclude renderer_arg from daemon powerline objects cache
It may easily change between runs from one client and only affects segment_info 
which is regenerated always.
2014-08-04 00:17:41 +04:00
ZyX ea7f3b6501 Add powerline-daemon --quiet 2014-08-02 22:20:06 +04:00
ZyX 9290c2a23b Make daemon work with aboveleft shell key 2014-08-02 21:31:01 +04:00
ZyX 95dcef8bf8 Some style fixes 2014-08-02 21:30:51 +04:00
Kim Silkebækken a122e73b9b Add files from @kovidgoyal's powerline-daemon repo
Minor changes have been applied:

- Removed copyright info and GPL 3 license since Powerline is MIT (needs
  confirmation from kovidgoyal before merge)
- The `powerline-client` script is renamed to `powerline`, and calls the
  daemon or `powerline-render` (the previous `powerline`) to render
  a statusline
- Minor coding style corrections to match the rest of the project
- Python 3 support is removed for now due to setuptools failing with
  binary scripts

Todo:

- Automatically attempt to launch powerline-daemon the first time
  powerline is run if the daemon isn't already running?
- pip install -e fails with binary files (it appears that pip recodes
  the powerline binary to ASCII, the compiled powerline script must be
  copied manually to ~/.local/bin after pip install -e has been run)
2014-08-02 18:45:18 +04:00