Commit afbfb63a authored by Eli Schwartz's avatar Eli Schwartz Committed by Philipp Hörist

Replace css-utils with css-parser

The latter is a maintained fork that runs natively on python2/python3
(without using the fragile 2to3), fixes deprecations, and has a passing
testsuite.
parent 20cb0f09
Pipeline #4159 passed with stages
in 2 minutes and 47 seconds
......@@ -9,7 +9,7 @@
- gir1.2-gtk-3.0 (>=3.22)
- python3-nbxmpp (>=0.9.90.4)
- python3-openssl (>=16.2)
- python3-cssutils (>=1.0.2)
- python3-css-parser
- python3-keyring
- python3-precis-i18n
......
......@@ -147,16 +147,14 @@ modules:
url: https://files.pythonhosted.org/packages/6e/b3/b4d443d2e30c00cdb73612426222172182e54359545cfb17774792619e49/keyring-19.0.2-py2.py3-none-any.whl
sha256: afbfe7bc9bdba69d25c551b0c738adde533d87e0b51ad6bbe332cbea19ad8476
- name: python3-cssutils
- name: python3-css-parser
buildsystem: simple
build-commands:
- pip3 install --prefix=/app cssutils-1.0.2-py3-none-any.whl
cleanup:
- /bin
- pip3 install --prefix=/app css-parser-1.0.4-py3-none-any.whl
sources:
- type: file
url: https://files.pythonhosted.org/packages/6b/15/a9fb9010f58d1c55dd0b7779db2334feb9a572d407024f39a60f44293861/cssutils-1.0.2-py3-none-any.whl
sha256: c74dbe19c92f5052774eadb15136263548dd013250f1ed1027988e7fef125c8d
url: https://files.pythonhosted.org/packages/py3/c/css_parser/css_parser-1.0.4-py3-none-any.whl
sha256: 49d6906416569e715b144df97ed81a94b6dc663fbcae6d1dbf4807e7fb8367ae
- name: python3-precis_i18n
buildsystem: simple
......
......@@ -19,10 +19,10 @@ import os
import math
import logging
import cssutils
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import Pango
import css_parser
from gajim.common import app
from gajim.common import configpaths
......@@ -66,7 +66,7 @@ class CSSConfig():
css here."""
# Delete empty rules
cssutils.ser.prefs.keepEmptyRules = False
css_parser.ser.prefs.keepEmptyRules = False
# Holds the currently selected theme in the Theme Editor
self._pre_css = None
......@@ -202,16 +202,16 @@ class CSSConfig():
self._css_path = self._determine_theme_path()
else:
self._css_path = new_path
self._css = cssutils.parseFile(self._css_path)
self._css = css_parser.parseFile(self._css_path)
def _load_default(self):
self._default_css_path = self.get_theme_path('default', user=False)
self._default_css = cssutils.parseFile(self._default_css_path)
self._default_css = css_parser.parseFile(self._default_css_path)
def _load_pre(self, theme):
log.info('Preload theme %s', theme)
self._pre_css_path = self.get_theme_path(theme)
self._pre_css = cssutils.parseFile(self._pre_css_path)
self._pre_css = css_parser.parseFile(self._pre_css_path)
def _write(self, pre):
path = self._css_path
......@@ -251,7 +251,7 @@ class CSSConfig():
# The rule was not found, so we add it to this theme
log.info('Set %s %s %s', selector, attr, value)
rule = cssutils.css.CSSStyleRule(selectorText=selector)
rule = css_parser.css.CSSStyleRule(selectorText=selector)
rule.style[attr] = value
css.add(rule)
self._write(pre)
......@@ -282,7 +282,7 @@ class CSSConfig():
# The rule was not found, so we add it to this theme
log.info('Set Font for: %s %s %s %s %s',
selector, family, size, style, weight)
rule = cssutils.css.CSSStyleRule(selectorText=selector)
rule = css_parser.css.CSSStyleRule(selectorText=selector)
rule.style['font-family'] = family
rule.style['font-style'] = style
rule.style['font-size'] = '%spt' % size
......
......@@ -51,7 +51,7 @@ ignore_missing_imports = True
[mypy-ossaudiodev.*]
ignore_missing_imports = True
[mypy-cssutils.*]
[mypy-css_parser.*]
ignore_missing_imports = True
[mypy-distro.*]
......@@ -70,4 +70,4 @@ ignore_missing_imports = True
ignore_missing_imports = True
[mypy-cairo.*]
ignore_missing_imports = True
\ No newline at end of file
ignore_missing_imports = True
[flake8]
ignore =
ignore =
exclude = .git,__pycache__,.gitlab
max-complexity = 15
builtins=_
......@@ -20,7 +20,7 @@ python_requires = >=3.5
packages = find:
test_suite = test
install_requires =
cssutils>=1.0.2
css-parser
keyring
nbxmpp>=0.9.92
precis-i18n>=1.0.0
......@@ -45,4 +45,3 @@ gajim =
exclude =
gajim.dev
test*
......@@ -105,7 +105,7 @@ keyring
python-gnupg
python-axolotl
qrcode
cssutils
css_parser
"
build_pip install $(echo "$PIP_REQUIREMENTS" | tr ["\\n"] [" "])
......
......@@ -25,7 +25,7 @@ git+https://github.com/enthought/pywin32-ctypes.git
python-axolotl
python-gnupg
keyring
cssutils
css_parser
qrcode
"
pip3 install precis-i18n
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment