Commit Graph

14 Commits

Author SHA1 Message Date
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 7f5c0d660d Pop first path from sys.path
According to the `sys.path` documentation “As initialized upon program startup,
the first item of this list, path[0], is the directory containing the script
that was used to invoke the Python interpreter.” Since client is named
`powerline.py` it tries to use the client itself as powerline module and
obviously fails to import `lib` submodule.
2014-09-17 00:05:10 +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 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 484b9af6ed Use the same function for getting encoding in Python client and daemon 2014-08-27 22:38:52 +04:00
ZyX 7871cfcda4 Use posix.environ in Python client if available
This way there will be no need in converting keys and values to bytes objects on
\*nix systems.
2014-08-27 22:38:52 +04:00
ZyX 5434852977 A few style improvements in Python client 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 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 dc76396912 Solve encoding issues in powerline python client 2014-08-23 15:18:59 +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 95dcef8bf8 Some style fixes 2014-08-02 21:30:51 +04:00
ZyX 3b060562e2 Fix UnicodeDecodeError in Python version of powerline client 2014-08-02 19:46:04 +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