Adjust the rest of the code for rfc6266 -> pypeg2
This commit is contained in:
parent
ef1035f2ba
commit
c7bfe784e4
@ -73,7 +73,7 @@ The following software and libraries are required to run qutebrowser:
|
|||||||
* http://www.riverbankcomputing.com/software/pyqt/intro[PyQt] 5.2 or newer
|
* http://www.riverbankcomputing.com/software/pyqt/intro[PyQt] 5.2 or newer
|
||||||
(5.3.1 recommended) for Python 3
|
(5.3.1 recommended) for Python 3
|
||||||
* https://pypi.python.org/pypi/setuptools/[pkg_resources/setuptools]
|
* https://pypi.python.org/pypi/setuptools/[pkg_resources/setuptools]
|
||||||
* https://github.com/g2p/rfc6266[rfc6266]
|
* http://fdik.org/pyPEG/[pyPEG2]
|
||||||
|
|
||||||
The following libraries are optional and provide colored logging in the
|
The following libraries are optional and provide colored logging in the
|
||||||
console:
|
console:
|
||||||
@ -86,19 +86,19 @@ On Debian
|
|||||||
|
|
||||||
----
|
----
|
||||||
# apt-get install python3-pyqt5 python3-pyqt5.qtwebkit python3-pkg-resources python3-pip
|
# apt-get install python3-pyqt5 python3-pyqt5.qtwebkit python3-pkg-resources python3-pip
|
||||||
# pip3 install rfc6266
|
# pip3 install pypeg2 --allow-external pypeg2 --allow-unverified pypeg2
|
||||||
----
|
----
|
||||||
|
|
||||||
On Archlinux
|
On Archlinux
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
There's an Archlinux package available in `pkg/`. You can install it (and the
|
There's an Archlinux package available in `pkg/`. You can install it (and the
|
||||||
python-rfc6266 dependency) like this:
|
python-pypeg2 dependency) like this:
|
||||||
|
|
||||||
----
|
----
|
||||||
$ wget https://aur.archlinux.org/packages/py/python-rfc6266/python-rfc6266.tar.gz <1>
|
$ wget https://aur.archlinux.org/packages/py/python-pypeg2/python-pypeg2.tar.gz <1>
|
||||||
$ tar xzvf python-rfc6266.tar.gz
|
$ tar xzvf python-pypeg2.tar.gz
|
||||||
$ cd python-rfc6266
|
$ cd python-pypeg2
|
||||||
$ makepkg -si
|
$ makepkg -si
|
||||||
$ cd ..
|
$ cd ..
|
||||||
|
|
||||||
@ -107,10 +107,10 @@ $ cd qutebrowser
|
|||||||
$ wget http://git.the-compiler.org/qutebrowser/plain/pkg/PKGBUILD.qutebrowser-git -O PKGBUILD
|
$ wget http://git.the-compiler.org/qutebrowser/plain/pkg/PKGBUILD.qutebrowser-git -O PKGBUILD
|
||||||
$ makepkg -si
|
$ makepkg -si
|
||||||
$ cd ..
|
$ cd ..
|
||||||
$ rm -rf python-rfc6266.tar.gz python-rfc6266 qutebrowser
|
$ rm -rf python-pypeg2.tar.gz python-pypeg2 qutebrowser
|
||||||
----
|
----
|
||||||
<1> Instead of the first block of commands you could also use an AUR helper,
|
<1> Instead of the first block of commands you could also use an AUR helper,
|
||||||
e.g. +yaourt -S python-rfc6266+.
|
e.g. +yaourt -S python-pypeg2+.
|
||||||
|
|
||||||
As soon as v0.1 is out, there will be a package in the AUR, so this will get
|
As soon as v0.1 is out, there will be a package in the AUR, so this will get
|
||||||
easier.
|
easier.
|
||||||
@ -127,7 +127,8 @@ http://www.riverbankcomputing.com/software/pyqt/download5[Riverbank computing]
|
|||||||
to get Qt and PyQt5.
|
to get Qt and PyQt5.
|
||||||
* Run `scripts/ez_setup.py` to get setuptools.
|
* Run `scripts/ez_setup.py` to get setuptools.
|
||||||
* Get pip as described http://stackoverflow.com/a/12476379[on Stack Overflow].
|
* Get pip as described http://stackoverflow.com/a/12476379[on Stack Overflow].
|
||||||
* Run +pip install rfc6266+ to install rfc6266.
|
* Run +pip install --allow-external pypeg2 --allow-unverified pypeg2 pypeg2+ to
|
||||||
|
install pypeg2.
|
||||||
|
|
||||||
As soon as v0.1 is out, a standalone .exe (built with
|
As soon as v0.1 is out, a standalone .exe (built with
|
||||||
http://cx-freeze.sourceforge.net/[cx_Freeze]) will be provided. In the
|
http://cx-freeze.sourceforge.net/[cx_Freeze]) will be provided. In the
|
||||||
|
@ -9,7 +9,7 @@ arch=(any)
|
|||||||
url="http://www.qutebrowser.org/"
|
url="http://www.qutebrowser.org/"
|
||||||
license=('GPL')
|
license=('GPL')
|
||||||
depends=('python>=3.4' 'python-setuptools' 'python-pyqt5>=5.2' 'qt5-base>=5.2'
|
depends=('python>=3.4' 'python-setuptools' 'python-pyqt5>=5.2' 'qt5-base>=5.2'
|
||||||
'qt5-webkit>=5.2' 'libxkbcommon-x11' 'python-rfc6266')
|
'qt5-webkit>=5.2' 'libxkbcommon-x11' 'python-pypeg2')
|
||||||
makedepends=('python' 'python-setuptools')
|
makedepends=('python' 'python-setuptools')
|
||||||
optdepends=('python-colorlog: colored logging output')
|
optdepends=('python-colorlog: colored logging output')
|
||||||
options=(!emptydirs)
|
options=(!emptydirs)
|
||||||
|
@ -111,7 +111,7 @@ def main():
|
|||||||
earlyinit.check_qt_version()
|
earlyinit.check_qt_version()
|
||||||
earlyinit.check_pyqt_webkit()
|
earlyinit.check_pyqt_webkit()
|
||||||
earlyinit.check_pkg_resources()
|
earlyinit.check_pkg_resources()
|
||||||
earlyinit.check_rfc6266()
|
earlyinit.check_pypeg2()
|
||||||
# We do this import late as we need to fix harfbuzz first.
|
# We do this import late as we need to fix harfbuzz first.
|
||||||
from qutebrowser.app import Application
|
from qutebrowser.app import Application
|
||||||
from qutebrowser.utils.debug import trace_lines
|
from qutebrowser.utils.debug import trace_lines
|
||||||
|
@ -231,15 +231,21 @@ def check_pkg_resources():
|
|||||||
_die(text)
|
_die(text)
|
||||||
|
|
||||||
|
|
||||||
def check_rfc6266():
|
def check_pypeg2():
|
||||||
"""Check if rfc6266 is installed."""
|
"""Check if pypeg2 is installed."""
|
||||||
try:
|
try:
|
||||||
import rfc6266 # pylint: disable=unused-variable
|
import pypeg2 # pylint: disable=unused-variable
|
||||||
except ImportError:
|
except ImportError:
|
||||||
text = _missing_str("rfc6266",
|
text = _missing_str("pypeg2",
|
||||||
debian="No package available, try:\n"
|
debian="No package available, try:\n"
|
||||||
"pip3 install rfc6266",
|
"pip3 install pypeg2 "
|
||||||
arch="pacman -S python-rfc6266",
|
"--allow-external pypeg2 "
|
||||||
windows="pip install rfc6266 (using python3)",
|
"--allow-unverified pypeg2",
|
||||||
pip="rfc6266")
|
arch="pacman -S python-pypeg2",
|
||||||
|
windows="pip install pypeg2 "
|
||||||
|
"--allow-external pypeg2 "
|
||||||
|
"--allow-unverified pypeg2 "
|
||||||
|
"(using python3)",
|
||||||
|
pip="pypeg2 --allow-external pypeg2 "
|
||||||
|
"--allow-unverified pypeg2")
|
||||||
_die(text)
|
_die(text)
|
||||||
|
@ -111,11 +111,9 @@ def init_log(args):
|
|||||||
if console is not None:
|
if console is not None:
|
||||||
if args.logfilter is not None and numeric_level < logging.DEBUG:
|
if args.logfilter is not None and numeric_level < logging.DEBUG:
|
||||||
console.addFilter(LogFilter(args.logfilter.split(',')))
|
console.addFilter(LogFilter(args.logfilter.split(',')))
|
||||||
console.addFilter(LeplFilter())
|
|
||||||
root.addHandler(console)
|
root.addHandler(console)
|
||||||
if ram is not None:
|
if ram is not None:
|
||||||
root.addHandler(ram)
|
root.addHandler(ram)
|
||||||
ram.addFilter(LeplFilter())
|
|
||||||
root.setLevel(logging.NOTSET)
|
root.setLevel(logging.NOTSET)
|
||||||
logging.captureWarnings(True)
|
logging.captureWarnings(True)
|
||||||
qInstallMessageHandler(qt_message_handler)
|
qInstallMessageHandler(qt_message_handler)
|
||||||
@ -129,23 +127,6 @@ def disable_qt_msghandler():
|
|||||||
qInstallMessageHandler(old_handler)
|
qInstallMessageHandler(old_handler)
|
||||||
|
|
||||||
|
|
||||||
def fix_rfc2622():
|
|
||||||
"""Fix the rfc6266 logger.
|
|
||||||
|
|
||||||
In rfc2622 <= v0.04, a NullHandler class is added as handler, instead of an
|
|
||||||
object, which causes an exception later.
|
|
||||||
|
|
||||||
This was fixed in [1], but since v0.05 is not out yet, we work around the
|
|
||||||
issue by deleting the wrong handler.
|
|
||||||
|
|
||||||
This should be executed after init_log is done and rfc6266 is imported, but
|
|
||||||
before using it.
|
|
||||||
|
|
||||||
[1]: https://github.com/g2p/rfc6266/commit/cad58963ed13f5e1068fcc9e4326123b6b2bdcf8
|
|
||||||
"""
|
|
||||||
rfc6266.removeHandler(logging.NullHandler)
|
|
||||||
|
|
||||||
|
|
||||||
def _init_handlers(level, color, ram_capacity):
|
def _init_handlers(level, color, ram_capacity):
|
||||||
"""Init log handlers.
|
"""Init log handlers.
|
||||||
|
|
||||||
@ -307,22 +288,6 @@ class LogFilter(logging.Filter):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class LeplFilter(logging.Filter):
|
|
||||||
|
|
||||||
"""Filter to filter debug log records by the lepl library."""
|
|
||||||
|
|
||||||
def filter(self, record):
|
|
||||||
"""Determine if the specified record is to be logged."""
|
|
||||||
if (record.levelno == logging.INFO and
|
|
||||||
record.name == 'lepl.lexer.rewriters.AddLexer'):
|
|
||||||
# Special useless info message triggered by rfc6266
|
|
||||||
return False
|
|
||||||
if record.levelno > logging.DEBUG:
|
|
||||||
# More important than DEBUG, so we won't filter at all
|
|
||||||
return True
|
|
||||||
return not record.name.startswith('lepl.')
|
|
||||||
|
|
||||||
|
|
||||||
class RAMHandler(logging.Handler):
|
class RAMHandler(logging.Handler):
|
||||||
|
|
||||||
"""Logging handler which keeps the messages in a deque in RAM.
|
"""Logging handler which keeps the messages in a deque in RAM.
|
||||||
|
@ -97,7 +97,7 @@ setupdata = {
|
|||||||
'description': _get_constant('description'),
|
'description': _get_constant('description'),
|
||||||
'long_description': read_file('README.asciidoc'),
|
'long_description': read_file('README.asciidoc'),
|
||||||
'url': 'http://www.qutebrowser.org/',
|
'url': 'http://www.qutebrowser.org/',
|
||||||
'requires': ['rfc6266'],
|
'requires': ['pypeg2'],
|
||||||
'author': _get_constant('author'),
|
'author': _get_constant('author'),
|
||||||
'author_email': _get_constant('email'),
|
'author_email': _get_constant('email'),
|
||||||
'license': _get_constant('license'),
|
'license': _get_constant('license'),
|
||||||
|
Loading…
Reference in New Issue
Block a user