ColinDuquesnoy / QDarkStyleSheet

A dark style sheet for QtWidgets application
Other
2.76k stars 725 forks source link

Regression in 3.2: sass.CompileError: Error: Undefined variable: "$COLOR-DISABLED". #337

Closed mgorny closed 8 months ago

mgorny commented 8 months ago

Describe Your Environment

$ qdarkstyle --all

[notice] A new release of pip is available: 23.2.1 -> 23.3.1
[notice] To update, run: pip install --upgrade pip
* OPERATING SYSTEM---------------------------------------------------------------
    - System........................ Linux
    - Release....................... 6.4.7-gentoo-dist
    - Platform...................... Linux-6.4.7-gentoo-dist-x86_64-AMD_Ryzen_5_3600_6-Core_Processor-with-glibc2.38
    - Version....................... #1 SMP PREEMPT_DYNAMIC Thu Jul 27 12:32:01 -00 2023
* PYTHON DISTRIBUTION------------------------------------------------------------
    - Version....................... 3.10.13
    - C Compiler.................... GCC 13.2.1 20230826
    - C API Version................. 1013
    - Implementation................ cpython
    - Implementation Version........ 3.10.13
* QT BINDINGS--------------------------------------------------------------------
    - PyQt5 Version................. 5.15.10
    - PyQt5 Qt Version.............. 5.15.2
* QT ABSTRACTIONS----------------------------------------------------------------
    - qtpy Version.................. 2.4.1
    - qtpy Binding.................. pyqt5
    - qtpy Binding Variable......... os.environ['QT_API']
    - qtpy Import Name.............. qtpy
    - qtpy Status................... OK
* PYTHON PACKAGES----------------------------------------------------------------
    - helpdev....................... 0.7.1
    - QDarkStyle.................... 3.2

Description / Steps to Reproduce [if necessary]

The test suite in the 3.2 release and git as of 5eda73d310b6baf21be18d698f7a7a00ebf10686 fails:

FAILED test/test_sass_compiler.py::test_create_qss_dark - sass.CompileError: Error: Undefined variable: "$COLOR-DISABLED".
FAILED test/test_sass_compiler.py::test_create_qss_light - sass.CompileError: Error: Undefined variable: "$COLOR-DISABLED".

I can reproduce by running e.g.:

tox -e lin-py310-pyqt5-test-develop

(I needed to add -develop as otherwise qtsass wasn't pulled in)

Actual Result

$ tox -e lin-py310-pyqt5-test-develop
lin-py310-pyqt5-test-develop: install_deps> python -I -m pip install pyqt5 -r req-test.txt -r req-develop.txt
.pkg-cpython310: install_requires> python -I -m pip install 'setuptools>=40.8.0' wheel
.pkg-cpython310: _optional_hooks> python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg-cpython310: get_requires_for_build_editable> python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg-cpython310: install_requires_for_build_editable> python -I -m pip install wheel
.pkg-cpython310: build_editable> python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
lin-py310-pyqt5-test-develop: install_package_deps> python -I -m pip install 'qtpy>=2'
lin-py310-pyqt5-test-develop: install_package> python -I -m pip install --force-reinstall --no-deps /tmp/QDarkStyleSheet/.tox/.tmp/package/3/QDarkStyle-3.2-0.editable-py2.py3-none-any.whl
lin-py310-pyqt5-test-develop: commands[0]> pip check
No broken requirements found.
lin-py310-pyqt5-test-develop: commands[1]> pip list
Package               Version
--------------------- ---------
astroid               3.0.1
autopep8              2.0.4
bandit                1.7.5
cachetools            5.3.2
certifi               2023.7.22
cfgv                  3.4.0
chardet               5.2.0
charset-normalizer    3.3.1
click                 8.1.7
click-completion      0.5.2
colorama              0.4.6
coverage              7.3.2
crayons               0.4.0
dill                  0.3.7
distlib               0.3.7
doc8                  1.1.1
docformatter          1.7.5
docutils              0.20.1
dparse                0.6.3
eradicate             2.3.0
exceptiongroup        1.1.3
filelock              3.12.4
gitdb                 4.0.11
GitPython             3.1.40
identify              2.5.30
idna                  3.4
iniconfig             2.0.0
isort                 5.12.0
Jinja2                3.1.2
libsass               0.22.0
mando                 0.7.1
markdown-it-py        3.0.0
MarkupSafe            2.1.3
mccabe                0.7.0
mdurl                 0.1.2
nodeenv               1.8.0
packaging             23.2
pbr                   5.11.1
pip                   23.2.1
pipdeptree            2.13.0
platformdirs          3.11.0
pluggy                1.3.0
pre-commit            3.5.0
pycodestyle           2.11.1
pycycle               0.0.8
pydocstyle            6.3.0
pyflakes              3.1.0
Pygments              2.16.1
pylama                8.4.1
pylama-pylint         3.1.1
pylint                3.0.2
pyproject-api         1.6.1
PyQt5                 5.15.10
PyQt5-Qt5             5.15.2
PyQt5-sip             12.13.0
pytest                7.4.3
pytest-cov            4.1.0
pytest-qt             4.2.0
PyYAML                6.0.1
QDarkStyle            3.2
QtPy                  2.4.1
qtsass                0.4.0
radon                 6.0.1
requests              2.31.0
restructuredtext-lint 1.4.0
rich                  13.6.0
ruamel.yaml           0.18.2
ruamel.yaml.clib      0.2.8
safety                2.3.4
scspell3k             2.2
setuptools            68.2.2
shellingham           1.5.4
six                   1.16.0
smmap                 5.0.1
snowballstemmer       2.2.0
stevedore             5.1.0
tomli                 2.0.1
tomlkit               0.12.1
tox                   4.11.3
typing_extensions     4.8.0
untokenize            0.1.1
urllib3               2.0.7
virtualenv            20.24.6
watchdog              3.0.0
wheel                 0.41.2
lin-py310-pyqt5-test-develop: commands[2]> pytest --cov
========================================================= test session starts =========================================================
platform linux -- Python 3.10.13, pytest-7.4.3, pluggy-1.3.0
cachedir: .tox/lin-py310-pyqt5-test-develop/.pytest_cache
PyQt5 5.15.10 -- Qt runtime 5.15.2 -- Qt compiled 5.15.2
rootdir: /tmp/QDarkStyleSheet
plugins: cov-4.1.0, qt-4.2.0, pylama-8.4.1
collected 2 items                                                                                                                     

test/test_sass_compiler.py FF                                                                                                   [100%]

============================================================== FAILURES ===============================================================
________________________________________________________ test_create_qss_dark _________________________________________________________

    def test_create_qss_dark():
        # Should not raise a CompileError
>       create_qss(DarkPalette)

test/test_sass_compiler.py:16: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
qdarkstyle/utils/scss.py:163: in create_qss
    stylesheet = _create_qss(main_scss_filepath, qss_filepath)
qdarkstyle/utils/scss.py:101: in _create_qss
    qtsass.compile_filename(main_scss_path, qss_filepath,
.tox/lin-py310-pyqt5-test-develop/lib/python3.10/site-packages/qtsass/api.py:131: in compile_filename
    css = compile(string, **kwargs)
.tox/lin-py310-pyqt5-test-develop/lib/python3.10/site-packages/qtsass/api.py:103: in compile
    return qt_conform(sass.compile(**kwargs))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

kwargs = {}, mode_name = 'filename', precision = 5, output_style = 1, source_comments = False
_get_file_arg = <function compile.<locals>._get_file_arg at 0x7f364ad5fe20>, source_map_filename = None

    def compile(**kwargs):
        r"""There are three modes of parameters :func:`compile()` can take:
        ``string``, ``filename``, and ``dirname``.

        The ``string`` parameter is the most basic way to compile Sass.
        It simply takes a string of Sass code, and then returns a compiled
        CSS string.

        :param string: Sass source code to compile.  it's exclusive to
                       ``filename`` and ``dirname`` parameters
        :type string: :class:`str`
        :param output_style: an optional coding style of the compiled result.
                             choose one of: ``'nested'`` (default), ``'expanded'``,
                             ``'compact'``, ``'compressed'``
        :type output_style: :class:`str`
        :param source_comments: whether to add comments about source lines.
                                :const:`False` by default
        :type source_comments: :class:`bool`
        :param source_map_contents: embed include contents in map
        :type source_map_contents: :class:`bool`
        :param source_map_embed: embed sourceMappingUrl as data URI
        :type source_map_embed: :class:`bool`
        :param omit_source_map_url: omit source map URL comment from output
        :type omit_source_map_url: :class:`bool`
        :param source_map_root: base path, will be emitted in source map as is
        :type source_map_root: :class:`str`
        :param include_paths: an optional list of paths to find ``@import``\ ed
                              Sass/CSS source files
        :type include_paths: :class:`collections.abc.Sequence`
        :param precision: optional precision for numbers. :const:`5` by default.
        :type precision: :class:`int`
        :param custom_functions: optional mapping of custom functions.
                                 see also below `custom functions
                                 <custom-functions_>`_ description
        :type custom_functions: :class:`set`,
                                :class:`collections.abc.Sequence`,
                                :class:`collections.abc.Mapping`
        :param custom_import_extensions: (ignored, for backward compatibility)
        :param indented: optional declaration that the string is Sass, not SCSS
                         formatted. :const:`False` by default
        :type indented: :class:`bool`
        :returns: the compiled CSS string
        :param importers: optional callback functions.
                         see also below `importer callbacks
                         <importer-callbacks_>`_ description
        :type importers: :class:`collections.abc.Callable`
        :rtype: :class:`str`
        :raises sass.CompileError: when it fails for any reason
                                   (for example the given Sass has broken syntax)

        The ``filename`` is the most commonly used way.  It takes a string of
        Sass filename, and then returns a compiled CSS string.

        :param filename: the filename of Sass source code to compile.
                         it's exclusive to ``string`` and ``dirname`` parameters
        :type filename: :class:`str`
        :param output_style: an optional coding style of the compiled result.
                             choose one of: ``'nested'`` (default), ``'expanded'``,
                             ``'compact'``, ``'compressed'``
        :type output_style: :class:`str`
        :param source_comments: whether to add comments about source lines.
                                :const:`False` by default
        :type source_comments: :class:`bool`
        :param source_map_filename: use source maps and indicate the source map
                                    output filename.  :const:`None` means not
                                    using source maps.  :const:`None` by default.
        :type source_map_filename: :class:`str`
        :param source_map_contents: embed include contents in map
        :type source_map_contents: :class:`bool`
        :param source_map_embed: embed sourceMappingUrl as data URI
        :type source_map_embed: :class:`bool`
        :param omit_source_map_url: omit source map URL comment from output
        :type omit_source_map_url: :class:`bool`
        :param source_map_root: base path, will be emitted in source map as is
        :type source_map_root: :class:`str`
        :param include_paths: an optional list of paths to find ``@import``\ ed
                              Sass/CSS source files
        :type include_paths: :class:`collections.abc.Sequence`
        :param precision: optional precision for numbers. :const:`5` by default.
        :type precision: :class:`int`
        :param custom_functions: optional mapping of custom functions.
                                 see also below `custom functions
                                 <custom-functions_>`_ description
        :type custom_functions: :class:`set`,
                                :class:`collections.abc.Sequence`,
                                :class:`collections.abc.Mapping`
        :param custom_import_extensions: (ignored, for backward compatibility)
        :param importers: optional callback functions.
                         see also below `importer callbacks
                         <importer-callbacks_>`_ description
        :type importers: :class:`collections.abc.Callable`
        :returns: the compiled CSS string, or a pair of the compiled CSS string
                  and the source map string if ``source_map_filename`` is set
        :rtype: :class:`str`, :class:`tuple`
        :raises sass.CompileError: when it fails for any reason
                                   (for example the given Sass has broken syntax)
        :raises exceptions.IOError: when the ``filename`` doesn't exist or
                                    cannot be read

        The ``dirname`` is useful for automation.  It takes a pair of paths.
        The first of the ``dirname`` pair refers the source directory, contains
        several Sass source files to compiled.  Sass source files can be nested
        in directories.  The second of the pair refers the output directory
        that compiled CSS files would be saved.  Directory tree structure of
        the source directory will be maintained in the output directory as well.
        If ``dirname`` parameter is used the function returns :const:`None`.

        :param dirname: a pair of ``(source_dir, output_dir)``.
                        it's exclusive to ``string`` and ``filename``
                        parameters
        :type dirname: :class:`tuple`
        :param output_style: an optional coding style of the compiled result.
                             choose one of: ``'nested'`` (default), ``'expanded'``,
                             ``'compact'``, ``'compressed'``
        :type output_style: :class:`str`
        :param source_comments: whether to add comments about source lines.
                                :const:`False` by default
        :type source_comments: :class:`bool`
        :param source_map_contents: embed include contents in map
        :type source_map_contents: :class:`bool`
        :param source_map_embed: embed sourceMappingUrl as data URI
        :type source_map_embed: :class:`bool`
        :param omit_source_map_url: omit source map URL comment from output
        :type omit_source_map_url: :class:`bool`
        :param source_map_root: base path, will be emitted in source map as is
        :type source_map_root: :class:`str`
        :param include_paths: an optional list of paths to find ``@import``\ ed
                              Sass/CSS source files
        :type include_paths: :class:`collections.abc.Sequence`
        :param precision: optional precision for numbers. :const:`5` by default.
        :type precision: :class:`int`
        :param custom_functions: optional mapping of custom functions.
                                 see also below `custom functions
                                 <custom-functions_>`_ description
        :type custom_functions: :class:`set`,
                                :class:`collections.abc.Sequence`,
                                :class:`collections.abc.Mapping`
        :param custom_import_extensions: (ignored, for backward compatibility)
        :raises sass.CompileError: when it fails for any reason
                                   (for example the given Sass has broken syntax)

        .. _custom-functions:

        The ``custom_functions`` parameter can take three types of forms:

        :class:`~set`/:class:`~collections.abc.Sequence` of \
        :class:`SassFunction`\ s
           It is the most general form.  Although pretty verbose, it can take
           any kind of callables like type objects, unnamed functions,
           and user-defined callables.

           .. code-block:: python

              sass.compile(
                  ...,
                  custom_functions={
                      sass.SassFunction('func-name', ('$a', '$b'), some_callable),
                      ...
                  }
              )

        :class:`~collections.abc.Mapping` of names to functions
           Less general, but easier-to-use form.  Although it's not it can take
           any kind of callables, it can take any kind of *functions* defined
           using :keyword:`def`/:keyword:`lambda` syntax.
           It cannot take callables other than them since inspecting arguments
           is not always available for every kind of callables.

           .. code-block:: python

              sass.compile(
                  ...,
                  custom_functions={
                      'func-name': lambda a, b: ...,
                      ...
                  }
              )

        :class:`~set`/:class:`~collections.abc.Sequence` of \
        named functions
           Not general, but the easiest-to-use form for *named* functions.
           It can take only named functions, defined using :keyword:`def`.
           It cannot take lambdas sinc names are unavailable for them.

           .. code-block:: python

              def func_name(a, b):
                  return ...

              sass.compile(
                  ...,
                  custom_functions={func_name}
              )

        .. _importer-callbacks:

        Newer versions of ``libsass`` allow developers to define callbacks to be
        called and given a chance to process ``@import`` directives. You can
        define yours by passing in a list of callables via the ``importers``
        parameter. The callables must be passed as 2-tuples in the form:

        .. code-block:: python

            (priority_int, callback_fn)

        A priority of zero is acceptable; priority determines the order callbacks
        are attempted.

        These callbacks can accept one or two string arguments. The first argument
        is the path that was passed to the ``@import`` directive; the second
        (optional) argument is the previous resolved path, where the ``@import``
        directive was found. The callbacks must either return ``None`` to
        indicate the path wasn't handled by that callback (to continue with others
        or fall back on internal ``libsass`` filesystem behaviour) or a list of
        one or more tuples, each in one of three forms:

        * A 1-tuple representing an alternate path to handle internally; or,
        * A 2-tuple representing an alternate path and the content that path
          represents; or,
        * A 3-tuple representing the same as the 2-tuple with the addition of a
          "sourcemap".

        All tuple return values must be strings. As a not overly realistic
        example:

        .. code-block:: python

            def my_importer(path, prev):
                return [(path, '#' + path + ' { color: red; }')]

            sass.compile(
                    ...,
                    importers=[(0, my_importer)]
                )

        Now, within the style source, attempting to ``@import 'button';`` will
        instead attach ``color: red`` as a property of an element with the
        imported name.

        .. versionadded:: 0.4.0
           Added ``source_comments`` and ``source_map_filename`` parameters.

        .. versionchanged:: 0.6.0
           The ``source_comments`` parameter becomes to take only :class:`bool`
           instead of :class:`str`.

        .. deprecated:: 0.6.0
           Values like ``'none'``, ``'line_numbers'``, and ``'map'`` for
           the ``source_comments`` parameter are deprecated.

        .. versionadded:: 0.7.0
           Added ``precision`` parameter.

        .. versionadded:: 0.7.0
           Added ``custom_functions`` parameter.

        .. versionadded:: 0.11.0
           ``source_map_filename`` no longer implies ``source_comments``.

        .. versionadded:: 0.17.0
           Added ``source_map_contents``, ``source_map_embed``,
           ``omit_source_map_url``, and ``source_map_root`` parameters.

        .. versionadded:: 0.18.0
            The importer callbacks can now take a second argument, the previously-
            resolved path, so that importers can do relative path resolution.

        """
        modes = set()
        for mode_name in MODES:
            if mode_name in kwargs:
                modes.add(mode_name)
        if not modes:
            raise TypeError('choose one at least in ' + and_join(MODES))
        elif len(modes) > 1:
            raise TypeError(
                and_join(modes) + ' are exclusive each other; '
                'cannot be used at a time',
            )
        precision = kwargs.pop('precision', 5)
        output_style = kwargs.pop('output_style', 'nested')
        if not isinstance(output_style, str):
            raise TypeError(
                'output_style must be a string, not ' +
                repr(output_style),
            )
        try:
            output_style = OUTPUT_STYLES[output_style]
        except KeyError:
            raise CompileError(
                '{} is unsupported output_style; choose one of {}'
                ''.format(output_style, and_join(OUTPUT_STYLES)),
            )
        source_comments = kwargs.pop('source_comments', False)
        if source_comments in SOURCE_COMMENTS:
            if source_comments == 'none':
                deprecation_message = (
                    'you can simply pass False to '
                    "source_comments instead of 'none'"
                )
                source_comments = False
            elif source_comments in ('line_numbers', 'default'):
                deprecation_message = (
                    'you can simply pass True to '
                    'source_comments instead of ' +
                    repr(source_comments)
                )
                source_comments = True
            else:
                deprecation_message = (
                    "you don't have to pass 'map' to "
                    'source_comments but just need to '
                    'specify source_map_filename'
                )
                source_comments = False
            warnings.warn(
                "values like 'none', 'line_numbers', and 'map' for "
                'the source_comments parameter are deprecated; ' +
                deprecation_message,
                FutureWarning,
            )
        if not isinstance(source_comments, bool):
            raise TypeError(
                'source_comments must be bool, not ' +
                repr(source_comments),
            )
        fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()

        def _get_file_arg(key):
            ret = kwargs.pop(key, None)
            if ret is not None and not isinstance(ret, str):
                raise TypeError(f'{key} must be a string, not {ret!r}')
            elif isinstance(ret, str):
                ret = ret.encode(fs_encoding)
            if ret and 'filename' not in modes:
                raise CompileError(
                    '{} is only available with filename= keyword argument since '
                    'has to be aware of it'.format(key),
                )
            return ret

        source_map_filename = _get_file_arg('source_map_filename')
        output_filename_hint = _get_file_arg('output_filename_hint')

        source_map_contents = kwargs.pop('source_map_contents', False)
        source_map_embed = kwargs.pop('source_map_embed', False)
        omit_source_map_url = kwargs.pop('omit_source_map_url', False)
        source_map_root = kwargs.pop('source_map_root', None)

        if isinstance(source_map_root, str):
            source_map_root = source_map_root.encode('utf-8')

        # #208: cwd is always included in include paths
        include_paths = (os.getcwd(),)
        include_paths += tuple(kwargs.pop('include_paths', ()) or ())
        include_paths = os.pathsep.join(include_paths)
        if isinstance(include_paths, str):
            include_paths = include_paths.encode(fs_encoding)

        custom_functions = kwargs.pop('custom_functions', ())
        if isinstance(custom_functions, collections.abc.Mapping):
            custom_functions = [
                SassFunction.from_lambda(name, lambda_)
                for name, lambda_ in custom_functions.items()
            ]
        elif isinstance(
                custom_functions,
                (collections.abc.Set, collections.abc.Sequence),
        ):
            custom_functions = [
                func if isinstance(func, SassFunction)
                else SassFunction.from_named_function(func)
                for func in custom_functions
            ]
        else:
            raise TypeError(
                'custom_functions must be one of:\n'
                '- a set/sequence of {0.__module__}.{0.__name__} objects,\n'
                '- a mapping of function name strings to lambda functions,\n'
                '- a set/sequence of named functions,\n'
                'not {1!r}'.format(SassFunction, custom_functions),
            )

        if kwargs.pop('custom_import_extensions', None) is not None:
            warnings.warn(
                '`custom_import_extensions` has no effect and will be removed in '
                'a future version.',
                FutureWarning,
            )

        importers = _validate_importers(kwargs.pop('importers', None))

        if 'string' in modes:
            string = kwargs.pop('string')
            if isinstance(string, str):
                string = string.encode('utf-8')
            indented = kwargs.pop('indented', False)
            if not isinstance(indented, bool):
                raise TypeError(
                    'indented must be bool, not ' +
                    repr(source_comments),
                )
            _check_no_remaining_kwargs(compile, kwargs)
            s, v = _sass.compile_string(
                string, output_style, source_comments, include_paths, precision,
                custom_functions, indented, importers,
                source_map_contents, source_map_embed, omit_source_map_url,
                source_map_root,
            )
            if s:
                return v.decode('utf-8')
        elif 'filename' in modes:
            filename = kwargs.pop('filename')
            if not isinstance(filename, str):
                raise TypeError('filename must be a string, not ' + repr(filename))
            elif not os.path.isfile(filename):
                raise OSError(f'{filename!r} seems not a file')
            elif isinstance(filename, str):
                filename = filename.encode(fs_encoding)
            _check_no_remaining_kwargs(compile, kwargs)
            s, v, source_map = _sass.compile_filename(
                filename, output_style, source_comments, include_paths, precision,
                source_map_filename, custom_functions, importers,
                output_filename_hint,
                source_map_contents, source_map_embed, omit_source_map_url,
                source_map_root,
            )
            if s:
                v = v.decode('utf-8')
                if source_map_filename:
                    source_map = source_map.decode('utf-8')
                    v = v, source_map
                return v
        elif 'dirname' in modes:
            try:
                search_path, output_path = kwargs.pop('dirname')
            except ValueError:
                raise ValueError(
                    'dirname must be a pair of (source_dir, '
                    'output_dir)',
                )
            _check_no_remaining_kwargs(compile, kwargs)
            s, v = compile_dirname(
                search_path, output_path, output_style, source_comments,
                include_paths, precision, custom_functions, importers,
                source_map_contents, source_map_embed, omit_source_map_url,
                source_map_root,
            )
            if s:
                return
        else:
            raise TypeError('something went wrong')
        assert not s
>       raise CompileError(v)
E       sass.CompileError: Error: Undefined variable: "$COLOR-DISABLED".
E               on line 49:16 of ../qss/_styles
E               from line 4:9 of stdin
E       >>         color: $COLOR_DISABLED;
E       
E          ---------------^

.tox/lin-py310-pyqt5-test-develop/lib/python3.10/site-packages/sass.py:725: CompileError
---------------------------------------------------------- Captured log call ----------------------------------------------------------
ERROR    qtsass.api:api.py:105 Failed to compile source code
________________________________________________________ test_create_qss_light ________________________________________________________

    def test_create_qss_light():
        # Should not raise a CompileError
>       create_qss(LightPalette)

test/test_sass_compiler.py:21: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
qdarkstyle/utils/scss.py:163: in create_qss
    stylesheet = _create_qss(main_scss_filepath, qss_filepath)
qdarkstyle/utils/scss.py:101: in _create_qss
    qtsass.compile_filename(main_scss_path, qss_filepath,
.tox/lin-py310-pyqt5-test-develop/lib/python3.10/site-packages/qtsass/api.py:131: in compile_filename
    css = compile(string, **kwargs)
.tox/lin-py310-pyqt5-test-develop/lib/python3.10/site-packages/qtsass/api.py:103: in compile
    return qt_conform(sass.compile(**kwargs))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

kwargs = {}, mode_name = 'filename', precision = 5, output_style = 1, source_comments = False
_get_file_arg = <function compile.<locals>._get_file_arg at 0x7f364adccc10>, source_map_filename = None

    def compile(**kwargs):
        r"""There are three modes of parameters :func:`compile()` can take:
        ``string``, ``filename``, and ``dirname``.

        The ``string`` parameter is the most basic way to compile Sass.
        It simply takes a string of Sass code, and then returns a compiled
        CSS string.

        :param string: Sass source code to compile.  it's exclusive to
                       ``filename`` and ``dirname`` parameters
        :type string: :class:`str`
        :param output_style: an optional coding style of the compiled result.
                             choose one of: ``'nested'`` (default), ``'expanded'``,
                             ``'compact'``, ``'compressed'``
        :type output_style: :class:`str`
        :param source_comments: whether to add comments about source lines.
                                :const:`False` by default
        :type source_comments: :class:`bool`
        :param source_map_contents: embed include contents in map
        :type source_map_contents: :class:`bool`
        :param source_map_embed: embed sourceMappingUrl as data URI
        :type source_map_embed: :class:`bool`
        :param omit_source_map_url: omit source map URL comment from output
        :type omit_source_map_url: :class:`bool`
        :param source_map_root: base path, will be emitted in source map as is
        :type source_map_root: :class:`str`
        :param include_paths: an optional list of paths to find ``@import``\ ed
                              Sass/CSS source files
        :type include_paths: :class:`collections.abc.Sequence`
        :param precision: optional precision for numbers. :const:`5` by default.
        :type precision: :class:`int`
        :param custom_functions: optional mapping of custom functions.
                                 see also below `custom functions
                                 <custom-functions_>`_ description
        :type custom_functions: :class:`set`,
                                :class:`collections.abc.Sequence`,
                                :class:`collections.abc.Mapping`
        :param custom_import_extensions: (ignored, for backward compatibility)
        :param indented: optional declaration that the string is Sass, not SCSS
                         formatted. :const:`False` by default
        :type indented: :class:`bool`
        :returns: the compiled CSS string
        :param importers: optional callback functions.
                         see also below `importer callbacks
                         <importer-callbacks_>`_ description
        :type importers: :class:`collections.abc.Callable`
        :rtype: :class:`str`
        :raises sass.CompileError: when it fails for any reason
                                   (for example the given Sass has broken syntax)

        The ``filename`` is the most commonly used way.  It takes a string of
        Sass filename, and then returns a compiled CSS string.

        :param filename: the filename of Sass source code to compile.
                         it's exclusive to ``string`` and ``dirname`` parameters
        :type filename: :class:`str`
        :param output_style: an optional coding style of the compiled result.
                             choose one of: ``'nested'`` (default), ``'expanded'``,
                             ``'compact'``, ``'compressed'``
        :type output_style: :class:`str`
        :param source_comments: whether to add comments about source lines.
                                :const:`False` by default
        :type source_comments: :class:`bool`
        :param source_map_filename: use source maps and indicate the source map
                                    output filename.  :const:`None` means not
                                    using source maps.  :const:`None` by default.
        :type source_map_filename: :class:`str`
        :param source_map_contents: embed include contents in map
        :type source_map_contents: :class:`bool`
        :param source_map_embed: embed sourceMappingUrl as data URI
        :type source_map_embed: :class:`bool`
        :param omit_source_map_url: omit source map URL comment from output
        :type omit_source_map_url: :class:`bool`
        :param source_map_root: base path, will be emitted in source map as is
        :type source_map_root: :class:`str`
        :param include_paths: an optional list of paths to find ``@import``\ ed
                              Sass/CSS source files
        :type include_paths: :class:`collections.abc.Sequence`
        :param precision: optional precision for numbers. :const:`5` by default.
        :type precision: :class:`int`
        :param custom_functions: optional mapping of custom functions.
                                 see also below `custom functions
                                 <custom-functions_>`_ description
        :type custom_functions: :class:`set`,
                                :class:`collections.abc.Sequence`,
                                :class:`collections.abc.Mapping`
        :param custom_import_extensions: (ignored, for backward compatibility)
        :param importers: optional callback functions.
                         see also below `importer callbacks
                         <importer-callbacks_>`_ description
        :type importers: :class:`collections.abc.Callable`
        :returns: the compiled CSS string, or a pair of the compiled CSS string
                  and the source map string if ``source_map_filename`` is set
        :rtype: :class:`str`, :class:`tuple`
        :raises sass.CompileError: when it fails for any reason
                                   (for example the given Sass has broken syntax)
        :raises exceptions.IOError: when the ``filename`` doesn't exist or
                                    cannot be read

        The ``dirname`` is useful for automation.  It takes a pair of paths.
        The first of the ``dirname`` pair refers the source directory, contains
        several Sass source files to compiled.  Sass source files can be nested
        in directories.  The second of the pair refers the output directory
        that compiled CSS files would be saved.  Directory tree structure of
        the source directory will be maintained in the output directory as well.
        If ``dirname`` parameter is used the function returns :const:`None`.

        :param dirname: a pair of ``(source_dir, output_dir)``.
                        it's exclusive to ``string`` and ``filename``
                        parameters
        :type dirname: :class:`tuple`
        :param output_style: an optional coding style of the compiled result.
                             choose one of: ``'nested'`` (default), ``'expanded'``,
                             ``'compact'``, ``'compressed'``
        :type output_style: :class:`str`
        :param source_comments: whether to add comments about source lines.
                                :const:`False` by default
        :type source_comments: :class:`bool`
        :param source_map_contents: embed include contents in map
        :type source_map_contents: :class:`bool`
        :param source_map_embed: embed sourceMappingUrl as data URI
        :type source_map_embed: :class:`bool`
        :param omit_source_map_url: omit source map URL comment from output
        :type omit_source_map_url: :class:`bool`
        :param source_map_root: base path, will be emitted in source map as is
        :type source_map_root: :class:`str`
        :param include_paths: an optional list of paths to find ``@import``\ ed
                              Sass/CSS source files
        :type include_paths: :class:`collections.abc.Sequence`
        :param precision: optional precision for numbers. :const:`5` by default.
        :type precision: :class:`int`
        :param custom_functions: optional mapping of custom functions.
                                 see also below `custom functions
                                 <custom-functions_>`_ description
        :type custom_functions: :class:`set`,
                                :class:`collections.abc.Sequence`,
                                :class:`collections.abc.Mapping`
        :param custom_import_extensions: (ignored, for backward compatibility)
        :raises sass.CompileError: when it fails for any reason
                                   (for example the given Sass has broken syntax)

        .. _custom-functions:

        The ``custom_functions`` parameter can take three types of forms:

        :class:`~set`/:class:`~collections.abc.Sequence` of \
        :class:`SassFunction`\ s
           It is the most general form.  Although pretty verbose, it can take
           any kind of callables like type objects, unnamed functions,
           and user-defined callables.

           .. code-block:: python

              sass.compile(
                  ...,
                  custom_functions={
                      sass.SassFunction('func-name', ('$a', '$b'), some_callable),
                      ...
                  }
              )

        :class:`~collections.abc.Mapping` of names to functions
           Less general, but easier-to-use form.  Although it's not it can take
           any kind of callables, it can take any kind of *functions* defined
           using :keyword:`def`/:keyword:`lambda` syntax.
           It cannot take callables other than them since inspecting arguments
           is not always available for every kind of callables.

           .. code-block:: python

              sass.compile(
                  ...,
                  custom_functions={
                      'func-name': lambda a, b: ...,
                      ...
                  }
              )

        :class:`~set`/:class:`~collections.abc.Sequence` of \
        named functions
           Not general, but the easiest-to-use form for *named* functions.
           It can take only named functions, defined using :keyword:`def`.
           It cannot take lambdas sinc names are unavailable for them.

           .. code-block:: python

              def func_name(a, b):
                  return ...

              sass.compile(
                  ...,
                  custom_functions={func_name}
              )

        .. _importer-callbacks:

        Newer versions of ``libsass`` allow developers to define callbacks to be
        called and given a chance to process ``@import`` directives. You can
        define yours by passing in a list of callables via the ``importers``
        parameter. The callables must be passed as 2-tuples in the form:

        .. code-block:: python

            (priority_int, callback_fn)

        A priority of zero is acceptable; priority determines the order callbacks
        are attempted.

        These callbacks can accept one or two string arguments. The first argument
        is the path that was passed to the ``@import`` directive; the second
        (optional) argument is the previous resolved path, where the ``@import``
        directive was found. The callbacks must either return ``None`` to
        indicate the path wasn't handled by that callback (to continue with others
        or fall back on internal ``libsass`` filesystem behaviour) or a list of
        one or more tuples, each in one of three forms:

        * A 1-tuple representing an alternate path to handle internally; or,
        * A 2-tuple representing an alternate path and the content that path
          represents; or,
        * A 3-tuple representing the same as the 2-tuple with the addition of a
          "sourcemap".

        All tuple return values must be strings. As a not overly realistic
        example:

        .. code-block:: python

            def my_importer(path, prev):
                return [(path, '#' + path + ' { color: red; }')]

            sass.compile(
                    ...,
                    importers=[(0, my_importer)]
                )

        Now, within the style source, attempting to ``@import 'button';`` will
        instead attach ``color: red`` as a property of an element with the
        imported name.

        .. versionadded:: 0.4.0
           Added ``source_comments`` and ``source_map_filename`` parameters.

        .. versionchanged:: 0.6.0
           The ``source_comments`` parameter becomes to take only :class:`bool`
           instead of :class:`str`.

        .. deprecated:: 0.6.0
           Values like ``'none'``, ``'line_numbers'``, and ``'map'`` for
           the ``source_comments`` parameter are deprecated.

        .. versionadded:: 0.7.0
           Added ``precision`` parameter.

        .. versionadded:: 0.7.0
           Added ``custom_functions`` parameter.

        .. versionadded:: 0.11.0
           ``source_map_filename`` no longer implies ``source_comments``.

        .. versionadded:: 0.17.0
           Added ``source_map_contents``, ``source_map_embed``,
           ``omit_source_map_url``, and ``source_map_root`` parameters.

        .. versionadded:: 0.18.0
            The importer callbacks can now take a second argument, the previously-
            resolved path, so that importers can do relative path resolution.

        """
        modes = set()
        for mode_name in MODES:
            if mode_name in kwargs:
                modes.add(mode_name)
        if not modes:
            raise TypeError('choose one at least in ' + and_join(MODES))
        elif len(modes) > 1:
            raise TypeError(
                and_join(modes) + ' are exclusive each other; '
                'cannot be used at a time',
            )
        precision = kwargs.pop('precision', 5)
        output_style = kwargs.pop('output_style', 'nested')
        if not isinstance(output_style, str):
            raise TypeError(
                'output_style must be a string, not ' +
                repr(output_style),
            )
        try:
            output_style = OUTPUT_STYLES[output_style]
        except KeyError:
            raise CompileError(
                '{} is unsupported output_style; choose one of {}'
                ''.format(output_style, and_join(OUTPUT_STYLES)),
            )
        source_comments = kwargs.pop('source_comments', False)
        if source_comments in SOURCE_COMMENTS:
            if source_comments == 'none':
                deprecation_message = (
                    'you can simply pass False to '
                    "source_comments instead of 'none'"
                )
                source_comments = False
            elif source_comments in ('line_numbers', 'default'):
                deprecation_message = (
                    'you can simply pass True to '
                    'source_comments instead of ' +
                    repr(source_comments)
                )
                source_comments = True
            else:
                deprecation_message = (
                    "you don't have to pass 'map' to "
                    'source_comments but just need to '
                    'specify source_map_filename'
                )
                source_comments = False
            warnings.warn(
                "values like 'none', 'line_numbers', and 'map' for "
                'the source_comments parameter are deprecated; ' +
                deprecation_message,
                FutureWarning,
            )
        if not isinstance(source_comments, bool):
            raise TypeError(
                'source_comments must be bool, not ' +
                repr(source_comments),
            )
        fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()

        def _get_file_arg(key):
            ret = kwargs.pop(key, None)
            if ret is not None and not isinstance(ret, str):
                raise TypeError(f'{key} must be a string, not {ret!r}')
            elif isinstance(ret, str):
                ret = ret.encode(fs_encoding)
            if ret and 'filename' not in modes:
                raise CompileError(
                    '{} is only available with filename= keyword argument since '
                    'has to be aware of it'.format(key),
                )
            return ret

        source_map_filename = _get_file_arg('source_map_filename')
        output_filename_hint = _get_file_arg('output_filename_hint')

        source_map_contents = kwargs.pop('source_map_contents', False)
        source_map_embed = kwargs.pop('source_map_embed', False)
        omit_source_map_url = kwargs.pop('omit_source_map_url', False)
        source_map_root = kwargs.pop('source_map_root', None)

        if isinstance(source_map_root, str):
            source_map_root = source_map_root.encode('utf-8')

        # #208: cwd is always included in include paths
        include_paths = (os.getcwd(),)
        include_paths += tuple(kwargs.pop('include_paths', ()) or ())
        include_paths = os.pathsep.join(include_paths)
        if isinstance(include_paths, str):
            include_paths = include_paths.encode(fs_encoding)

        custom_functions = kwargs.pop('custom_functions', ())
        if isinstance(custom_functions, collections.abc.Mapping):
            custom_functions = [
                SassFunction.from_lambda(name, lambda_)
                for name, lambda_ in custom_functions.items()
            ]
        elif isinstance(
                custom_functions,
                (collections.abc.Set, collections.abc.Sequence),
        ):
            custom_functions = [
                func if isinstance(func, SassFunction)
                else SassFunction.from_named_function(func)
                for func in custom_functions
            ]
        else:
            raise TypeError(
                'custom_functions must be one of:\n'
                '- a set/sequence of {0.__module__}.{0.__name__} objects,\n'
                '- a mapping of function name strings to lambda functions,\n'
                '- a set/sequence of named functions,\n'
                'not {1!r}'.format(SassFunction, custom_functions),
            )

        if kwargs.pop('custom_import_extensions', None) is not None:
            warnings.warn(
                '`custom_import_extensions` has no effect and will be removed in '
                'a future version.',
                FutureWarning,
            )

        importers = _validate_importers(kwargs.pop('importers', None))

        if 'string' in modes:
            string = kwargs.pop('string')
            if isinstance(string, str):
                string = string.encode('utf-8')
            indented = kwargs.pop('indented', False)
            if not isinstance(indented, bool):
                raise TypeError(
                    'indented must be bool, not ' +
                    repr(source_comments),
                )
            _check_no_remaining_kwargs(compile, kwargs)
            s, v = _sass.compile_string(
                string, output_style, source_comments, include_paths, precision,
                custom_functions, indented, importers,
                source_map_contents, source_map_embed, omit_source_map_url,
                source_map_root,
            )
            if s:
                return v.decode('utf-8')
        elif 'filename' in modes:
            filename = kwargs.pop('filename')
            if not isinstance(filename, str):
                raise TypeError('filename must be a string, not ' + repr(filename))
            elif not os.path.isfile(filename):
                raise OSError(f'{filename!r} seems not a file')
            elif isinstance(filename, str):
                filename = filename.encode(fs_encoding)
            _check_no_remaining_kwargs(compile, kwargs)
            s, v, source_map = _sass.compile_filename(
                filename, output_style, source_comments, include_paths, precision,
                source_map_filename, custom_functions, importers,
                output_filename_hint,
                source_map_contents, source_map_embed, omit_source_map_url,
                source_map_root,
            )
            if s:
                v = v.decode('utf-8')
                if source_map_filename:
                    source_map = source_map.decode('utf-8')
                    v = v, source_map
                return v
        elif 'dirname' in modes:
            try:
                search_path, output_path = kwargs.pop('dirname')
            except ValueError:
                raise ValueError(
                    'dirname must be a pair of (source_dir, '
                    'output_dir)',
                )
            _check_no_remaining_kwargs(compile, kwargs)
            s, v = compile_dirname(
                search_path, output_path, output_style, source_comments,
                include_paths, precision, custom_functions, importers,
                source_map_contents, source_map_embed, omit_source_map_url,
                source_map_root,
            )
            if s:
                return
        else:
            raise TypeError('something went wrong')
        assert not s
>       raise CompileError(v)
E       sass.CompileError: Error: Undefined variable: "$COLOR-DISABLED".
E               on line 49:16 of ../qss/_styles
E               from line 4:9 of stdin
E       >>         color: $COLOR_DISABLED;
E       
E          ---------------^

.tox/lin-py310-pyqt5-test-develop/lib/python3.10/site-packages/sass.py:725: CompileError
---------------------------------------------------------- Captured log call ----------------------------------------------------------
ERROR    qtsass.api:api.py:105 Failed to compile source code

---------- coverage: platform linux, python 3.10.13-final-0 ----------
Name                           Stmts   Miss  Cover
--------------------------------------------------
qdarkstyle/__init__.py           140    101    28%
qdarkstyle/colorsystem.py         34      0   100%
qdarkstyle/dark/__init__.py        0      0   100%
qdarkstyle/dark/palette.py        22      0   100%
qdarkstyle/light/__init__.py       0      0   100%
qdarkstyle/light/palette.py       22      0   100%
qdarkstyle/palette.py             46      3    93%
qdarkstyle/utils/__init__.py      26     18    31%
qdarkstyle/utils/images.py       234    210    10%
qdarkstyle/utils/scss.py         124     74    40%
test/test_sass_compiler.py        10      0   100%
--------------------------------------------------
TOTAL                            658    406    38%

======================================================= short test summary info =======================================================
FAILED test/test_sass_compiler.py::test_create_qss_dark - sass.CompileError: Error: Undefined variable: "$COLOR-DISABLED".
FAILED test/test_sass_compiler.py::test_create_qss_light - sass.CompileError: Error: Undefined variable: "$COLOR-DISABLED".
========================================================== 2 failed in 1.38s ==========================================================
lin-py310-pyqt5-test-develop: exit 1 (3.18 seconds) /tmp/QDarkStyleSheet> pytest --cov pid=368834
musicinmybrain commented 8 months ago

I’m seeing the same issue while trying to update the python-qdarkstyle package in Fedora Linux.

+ /usr/bin/python3 -m qdarkstyle --all
* OPERATING SYSTEM---------------------------------------------------------------
    - System........................ Linux
    - Release....................... 6.5.5-200.fc38.x86_64
    - Platform...................... Linux-6.5.5-200.fc38.x86_64-x86_64-with-glibc2.38.9000
    - Version....................... #1 SMP PREEMPT_DYNAMIC Sun Sep 24 15:52:44 UTC 2023
* PYTHON DISTRIBUTION------------------------------------------------------------
    - Version....................... 3.12.0
    - C Compiler.................... GCC 13.2.1 20230918 (Red Hat 13.2.1-3)
    - C API Version................. 1013
    - Implementation................ cpython
    - Implementation Version........ 3.12.0
* QT BINDINGS--------------------------------------------------------------------
    - PyQt5 Version................. 5.15.9
    - PyQt5 Qt Version.............. 5.15.11
* QT ABSTRACTIONS----------------------------------------------------------------
    - qtpy Version.................. 2.4.1
    - qtpy Binding.................. pyqt5
    - qtpy Binding Variable......... os.environ['QT_API']
    - qtpy Import Name.............. qtpy
    - qtpy Status................... OK
* PYTHON PACKAGES----------------------------------------------------------------
    - helpdev....................... 0.7.1
    - QDarkStyle.................... 3.2
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/builddir/build/BUILD/QDarkStyleSheet-5eda73d310b6baf21be18d698f7a7a00ebf10686/qdarkstyle/utils/__main__.py", line 97, in <module>
    sys.exit(main())
             ^^^^^^
  File "/builddir/build/BUILD/QDarkStyleSheet-5eda73d310b6baf21be18d698f7a7a00ebf10686/qdarkstyle/utils/__main__.py", line 93, in main
    process_palette(palette=palette, compile_for=args.create)
  File "/builddir/build/BUILD/QDarkStyleSheet-5eda73d310b6baf21be18d698f7a7a00ebf10686/qdarkstyle/utils/__init__.py", line 70, in process_palette   
    create_qss(palette=palette)
  File "/builddir/build/BUILD/QDarkStyleSheet-5eda73d310b6baf21be18d698f7a7a00ebf10686/qdarkstyle/utils/scss.py", line 162, in create_qss
    stylesheet = _create_qss(main_scss_filepath, qss_filepath)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/QDarkStyleSheet-5eda73d310b6baf21be18d698f7a7a00ebf10686/qdarkstyle/utils/scss.py", line 100, in _create_qss
    qtsass.compile_filename(main_scss_path, qss_filepath,
  File "/usr/lib/python3.12/site-packages/qtsass/api.py", line 131, in compile_filename
    css = compile(string, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/qtsass/api.py", line 103, in compile
    return qt_conform(sass.compile(**kwargs))
                      ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/site-packages/sass.py", line 725, in compile
    raise CompileError(v)
sass.CompileError: Error: Undefined variable: "$COLOR-DISABLED".
        on line 49:16 of ../qss/_styles
        from line 4:9 of stdin
>>         color: $COLOR_DISABLED;

   ---------------^
AndrewAmmerlaan commented 8 months ago

This is now blocking upgrading to spyder-5.5.0:

andrew@andrew-gentoo-laptop ~ % spyder
QSocketNotifier: Can only be used with threads started with QThread
fromIccProfile: failed minimal tag size sanity
Traceback (most recent call last):
File "/usr/lib/python-exec/python3.11/spyder", line 8, in <module>
sys.exit(main())
^^^^^^
File "/usr/lib/python3.11/site-packages/spyder/app/start.py", line 256, in main
mainwindow.main(options, args)
File "/usr/lib/python3.11/site-packages/spyder/app/mainwindow.py", line 1847, in main
mainwindow = create_window(MainWindow, app, splash, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/spyder/app/utils.py", line 289, in create_window
main.setup()
File "/usr/lib/python3.11/site-packages/spyder/app/mainwindow.py", line 752, in setup
internal_plugins = find_internal_plugins()
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/spyder/app/find_plugins.py", line 40, in find_internal_plugins
mod = importlib.import_module(entry_point.module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/usr/lib/python3.11/site-packages/spyder/plugins/pylint/plugin.py", line 22, in <module>
from spyder.plugins.pylint.confpage import PylintConfigPage
File "/usr/lib/python3.11/site-packages/spyder/plugins/pylint/confpage.py", line 16, in <module>
from spyder.plugins.pylint.main_widget import (MAX_HISTORY_ENTRIES,
File "/usr/lib/python3.11/site-packages/spyder/plugins/pylint/main_widget.py", line 90, in <module>
class CategoryItem(QTreeWidgetItem):
File "/usr/lib/python3.11/site-packages/spyder/plugins/pylint/main_widget.py", line 102, in CategoryItem
'icon': ima.icon("convention")
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/spyder/utils/icon_manager.py", line 439, in icon
kwargs['color_disabled'] = QStylePalette.COLOR_DISABLED
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'DarkPalette' has no attribute 'COLOR_DISABLED'
ccordoba12 commented 8 months ago

Hey guys, for now you can copy/paste the package assets from the PyPI tarball until we have time to address this.

musicinmybrain commented 8 months ago

Hey guys, for now you can copy/paste the package assets from the PyPI tarball until we have time to address this.

Thanks for the suggestion! In Fedora Linux we’ll need to wait for a proper solution, since our packaging guidelines explicitly forbid shipping precompiled CSS assets.

dpizetta commented 8 months ago

Thank you all for reporting, could you check the develop version? I this new version solves the problem. @ccordoba12 if you have time, could you check in Spyder this version? Now all the icons and resources are up to date. If everything is ok, I can generate the build/pypi. Thanks

musicinmybrain commented 8 months ago

I haven’t tested with Spyder, but I tried building a 3.2.1 prerelease package for Fedora Linux using 969fd6042659e8cd3a18d95710e697013887a133, and I was able to compile assets using python3 -m qdarkstyle.utils --create pyqt5.

mgorny commented 8 months ago

Yeah, that one looks fine. Thanks!

ccordoba12 commented 8 months ago

@ccordoba12 if you have time, could you check in Spyder this version?

@dpizetta, it seems that everything is in order for Spyder. Specifically, I ran the following commands in a clean virtualenv:

cd QDarkStyleSheet  # my clone of this repo with your latest changes
pip install -e .
pip install spyder

Spyder runs without problems and picks up correctly the color for disabled icons we added in 3.2.

Let me know if you need anything else I can help you with.

dpizetta commented 8 months ago

Thanks you all, new release in PyPI