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 74ed71f5
Pipeline #3175 passed with stages
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
- gir1.2-gtk-3.0 (>=3.22) - gir1.2-gtk-3.0 (>=3.22)
- python3-nbxmpp (>=0.9.90.4) - python3-nbxmpp (>=0.9.90.4)
- python3-openssl (>=16.2) - python3-openssl (>=16.2)
- python3-cssutils (>=1.0.2) - python3-css-parser
- python3-keyring - python3-keyring
- python3-precis-i18n - python3-precis-i18n
......
...@@ -151,16 +151,14 @@ modules: ...@@ -151,16 +151,14 @@ modules:
url: https://files.pythonhosted.org/packages/a1/28/0058032477bfdf2003e605d175629963759220661615443e20711446bfa7/keyring-18.0.0-py2.py3-none-any.whl url: https://files.pythonhosted.org/packages/a1/28/0058032477bfdf2003e605d175629963759220661615443e20711446bfa7/keyring-18.0.0-py2.py3-none-any.whl
sha256: ca33f5ccc542b9ffaa196ee9a33488069e5e7eac77d5b81969f8a3ce74d0230c sha256: ca33f5ccc542b9ffaa196ee9a33488069e5e7eac77d5b81969f8a3ce74d0230c
- name: python3-cssutils - name: python3-css-parser
buildsystem: simple buildsystem: simple
build-commands: build-commands:
- pip3 install --prefix=/app cssutils-1.0.2-py3-none-any.whl - pip3 install --prefix=/app css-parser-1.0.4-py3-none-any.whl
cleanup:
- /bin
sources: sources:
- type: file - type: file
url: https://files.pythonhosted.org/packages/6b/15/a9fb9010f58d1c55dd0b7779db2334feb9a572d407024f39a60f44293861/cssutils-1.0.2-py3-none-any.whl url: https://files.pythonhosted.org/packages/py3/c/css_parser/css_parser-1.0.4-py3-none-any.whl
sha256: c74dbe19c92f5052774eadb15136263548dd013250f1ed1027988e7fef125c8d sha256: 49d6906416569e715b144df97ed81a94b6dc663fbcae6d1dbf4807e7fb8367ae
- name: python3-precis_i18n - name: python3-precis_i18n
buildsystem: simple buildsystem: simple
......
...@@ -19,7 +19,7 @@ import os ...@@ -19,7 +19,7 @@ import os
import math import math
import logging import logging
import cssutils import css_parser
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import Gdk from gi.repository import Gdk
from gi.repository import Pango from gi.repository import Pango
...@@ -66,7 +66,7 @@ class CSSConfig(): ...@@ -66,7 +66,7 @@ class CSSConfig():
css here.""" css here."""
# Delete empty rules # Delete empty rules
cssutils.ser.prefs.keepEmptyRules = False css_parser.ser.prefs.keepEmptyRules = False
# Holds the currently selected theme in the Theme Editor # Holds the currently selected theme in the Theme Editor
self._pre_css = None self._pre_css = None
...@@ -202,16 +202,16 @@ class CSSConfig(): ...@@ -202,16 +202,16 @@ class CSSConfig():
self._css_path = self._determine_theme_path() self._css_path = self._determine_theme_path()
else: else:
self._css_path = new_path self._css_path = new_path
self._css = cssutils.parseFile(self._css_path) self._css = css_parser.parseFile(self._css_path)
def _load_default(self): def _load_default(self):
self._default_css_path = self.get_theme_path('default', user=False) 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): def _load_pre(self, theme):
log.info('Preload theme %s', theme) log.info('Preload theme %s', theme)
self._pre_css_path = self.get_theme_path(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): def _write(self, pre):
path = self._css_path path = self._css_path
...@@ -251,7 +251,7 @@ class CSSConfig(): ...@@ -251,7 +251,7 @@ class CSSConfig():
# The rule was not found, so we add it to this theme # The rule was not found, so we add it to this theme
log.info('Set %s %s %s', selector, attr, value) 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 rule.style[attr] = value
css.add(rule) css.add(rule)
self._write(pre) self._write(pre)
...@@ -282,7 +282,7 @@ class CSSConfig(): ...@@ -282,7 +282,7 @@ class CSSConfig():
# The rule was not found, so we add it to this theme # The rule was not found, so we add it to this theme
log.info('Set Font for: %s %s %s %s %s', log.info('Set Font for: %s %s %s %s %s',
selector, family, size, style, weight) 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-family'] = family
rule.style['font-style'] = style rule.style['font-style'] = style
rule.style['font-size'] = '%spt' % size rule.style['font-size'] = '%spt' % size
......
...@@ -54,7 +54,7 @@ ignore_missing_imports = True ...@@ -54,7 +54,7 @@ ignore_missing_imports = True
[mypy-ossaudiodev.*] [mypy-ossaudiodev.*]
ignore_missing_imports = True ignore_missing_imports = True
[mypy-cssutils.*] [mypy-css_parser.*]
ignore_missing_imports = True ignore_missing_imports = True
[mypy-distro.*] [mypy-distro.*]
...@@ -73,4 +73,4 @@ ignore_missing_imports = True ...@@ -73,4 +73,4 @@ ignore_missing_imports = True
ignore_missing_imports = True ignore_missing_imports = True
[mypy-cairo.*] [mypy-cairo.*]
ignore_missing_imports = True ignore_missing_imports = True
\ No newline at end of file
[flake8] [flake8]
ignore = ignore =
exclude = .git,__pycache__,.gitlab exclude = .git,__pycache__,.gitlab
max-complexity = 15 max-complexity = 15
builtins=_ builtins=_
...@@ -20,7 +20,7 @@ python_requires = >=3.5 ...@@ -20,7 +20,7 @@ python_requires = >=3.5
packages = find: packages = find:
test_suite = test test_suite = test
install_requires = install_requires =
cssutils>=1.0.2 css-parser
keyring keyring
nbxmpp>=0.9.91 nbxmpp>=0.9.91
precis-i18n>=1.0.0 precis-i18n>=1.0.0
...@@ -44,4 +44,3 @@ gajim = ...@@ -44,4 +44,3 @@ gajim =
exclude = exclude =
gajim.dev gajim.dev
test* test*
...@@ -109,7 +109,7 @@ keyring ...@@ -109,7 +109,7 @@ keyring
python-gnupg python-gnupg
python-axolotl python-axolotl
qrcode qrcode
cssutils css_parser
" "
build_pip install $(echo "$PIP_REQUIREMENTS" | tr ["\\n"] [" "]) build_pip install $(echo "$PIP_REQUIREMENTS" | tr ["\\n"] [" "])
......
...@@ -25,7 +25,7 @@ git+https://github.com/enthought/pywin32-ctypes.git ...@@ -25,7 +25,7 @@ git+https://github.com/enthought/pywin32-ctypes.git
python-axolotl python-axolotl
python-gnupg python-gnupg
keyring keyring
cssutils css_parser
qrcode qrcode
precis-i18n 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