From 7dca0870884fbf720db6afff773040cc05e83ad0cfd84a1bcef9cc303c461883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Mon, 9 Jun 2025 10:29:17 +0000 Subject: [PATCH] - convert to libalternatives OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-lesscpy?expand=0&rev=30 --- .gitattributes | 23 +++ .gitignore | 1 + lesscpy-0.15.1.tar.gz | 3 + python-lesscpy-no-six.patch | 274 ++++++++++++++++++++++++++++++++++++ python-lesscpy.changes | 145 +++++++++++++++++++ python-lesscpy.spec | 79 +++++++++++ 6 files changed, 525 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 lesscpy-0.15.1.tar.gz create mode 100644 python-lesscpy-no-six.patch create mode 100644 python-lesscpy.changes create mode 100644 python-lesscpy.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/lesscpy-0.15.1.tar.gz b/lesscpy-0.15.1.tar.gz new file mode 100644 index 0000000..57c7401 --- /dev/null +++ b/lesscpy-0.15.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1045d17a98f688646ca758dff254e6e9c03745648e051a081b0395c3b77c824c +size 177240 diff --git a/python-lesscpy-no-six.patch b/python-lesscpy-no-six.patch new file mode 100644 index 0000000..563b7f3 --- /dev/null +++ b/python-lesscpy-no-six.patch @@ -0,0 +1,274 @@ +diff --git a/lesscpy/lessc/color.py b/lesscpy/lessc/color.py +index d734233..50aa15d 100644 +--- a/lesscpy/lessc/color.py ++++ b/lesscpy/lessc/color.py +@@ -9,10 +9,9 @@ + """ + + import operator ++import re + + import colorsys +-import re +-from six import string_types + from . import utility + from lesscpy.lib import colors + +@@ -304,7 +303,7 @@ def spin(self, color, degree, *args): + str + """ + if color and degree: +- if isinstance(degree, string_types): ++ if isinstance(degree, str): + degree = float(degree.strip('%')) + h, l, s = self._hextohls(color) + h = ((h * 360.0) + degree) % 360.0 +@@ -348,7 +347,7 @@ def mix(self, color1, color2, weight=50, *args): + str + """ + if color1 and color2: +- if isinstance(weight, string_types): ++ if isinstance(weight, str): + weight = float(weight.strip('%')) + weight = ((weight / 100.0) * 2) - 1 + rgb1 = self._hextorgb(color1) +@@ -417,7 +416,7 @@ def _hextohls(self, hex): + return colorsys.rgb_to_hls(*[c / 255.0 for c in rgb]) + + def _ophsl(self, color, diff, idx, operation): +- if isinstance(diff, string_types): ++ if isinstance(diff, str): + diff = float(diff.strip('%')) + hls = list(self._hextohls(color)) + hls[idx] = self._clamp(operation(hls[idx], diff / 100.0)) +diff --git a/lesscpy/lessc/lexer.py b/lesscpy/lessc/lexer.py +index 38a964f..15c5cbb 100644 +--- a/lesscpy/lessc/lexer.py ++++ b/lesscpy/lessc/lexer.py +@@ -11,7 +11,6 @@ + """ + import re + import ply.lex as lex +-from six import string_types + + from lesscpy.lib import dom + from lesscpy.lib import css +@@ -422,7 +421,7 @@ def input(self, file): + Load lexer with content from `file` which can be a path or a file + like object. + """ +- if isinstance(file, string_types): ++ if isinstance(file, str): + with open(file) as f: + self.lexer.input(f.read()) + else: +diff --git a/lesscpy/lessc/parser.py b/lesscpy/lessc/parser.py +index a16a7d8..2621a62 100644 +--- a/lesscpy/lessc/parser.py ++++ b/lesscpy/lessc/parser.py +@@ -12,13 +12,10 @@ + .. moduleauthor:: Johann T. Mariusson + """ + +-from __future__ import print_function +- + import os + import tempfile + import sys + import ply.yacc +-from six import string_types + + from . import lexer + from . import utility +@@ -234,7 +231,7 @@ def p_statement_import(self, p): + if self.importlvl > 8: + raise ImportError( + 'Recrusive import level too deep > 8 (circular import ?)') +- if isinstance(p[3], string_types): ++ if isinstance(p[3], str): + ipath = utility.destring(p[3]) + elif isinstance(p[3], list): + p[3] = Import(p[3], p.lineno(4)).parse(self.scope) +diff --git a/lesscpy/lessc/scope.py b/lesscpy/lessc/scope.py +index 05d8ec2..04ab3e1 100644 +--- a/lesscpy/lessc/scope.py ++++ b/lesscpy/lessc/scope.py +@@ -7,8 +7,6 @@ + See LICENSE for details. + .. moduleauthor:: Johann T. Mariusson + """ +-from six import string_types +- + from . import utility + + +@@ -190,7 +188,7 @@ def swap(self, name): + var = self.variables('@' + name[2:-1]) + if var is False: + raise SyntaxError('Unknown escaped variable %s' % name) +- if isinstance(var.value[0], string_types): ++ if isinstance(var.value[0], str): + var.value[0] = utility.destring(var.value[0]) + else: + var = self.variables(name) +diff --git a/lesscpy/lessc/utility.py b/lesscpy/lessc/utility.py +index 9c23d29..cba96ff 100644 +--- a/lesscpy/lessc/utility.py ++++ b/lesscpy/lessc/utility.py +@@ -8,13 +8,10 @@ + .. moduleauthor:: Johann T. Mariusson + """ + +-from __future__ import print_function +- + import itertools + import math + import re + import sys +-from six import string_types + + try: + from collections.abc import Iterable +@@ -30,8 +27,7 @@ def flatten(lst): + generator + """ + for elm in lst: +- if isinstance(elm, Iterable) and not isinstance( +- elm, string_types): ++ if isinstance(elm, Iterable) and not isinstance(elm, str): + for sub in flatten(elm): + yield sub + else: +@@ -138,7 +134,7 @@ def analyze_number(var, err=''): + tuple + """ + n, u = split_unit(var) +- if not isinstance(var, string_types): ++ if not isinstance(var, str): + return var, u + if is_color(var): + return var, 'color' +@@ -168,7 +164,7 @@ def with_unit(number, unit=None): + if number.startswith('.'): + number = '0' + number + return "%s%s" % (number, unit) +- return number if isinstance(number, string_types) else str(number) ++ return number if isinstance(number, str) else str(number) + + + def is_color(value): +@@ -178,7 +174,7 @@ def is_color(value): + returns: + bool + """ +- if not value or not isinstance(value, string_types): ++ if not value or not isinstance(value, str): + return False + if value[0] == '#' and len(value) in [4, 5, 7, 9]: + try: +@@ -196,7 +192,7 @@ def is_variable(value): + returns: + bool + """ +- if isinstance(value, string_types): ++ if isinstance(value, str): + return value.startswith('@') or value.startswith('-@') + elif isinstance(value, tuple): + value = ''.join(value) +@@ -287,7 +283,7 @@ def pc_or_float(s): + returns: + float + """ +- if isinstance(s, string_types) and '%' in s: ++ if isinstance(s, str) and '%' in s: + return float(s.strip('%')) / 100.0 + return float(s) + +diff --git a/lesscpy/plib/call.py b/lesscpy/plib/call.py +index f45d04b..fde8b9d 100644 +--- a/lesscpy/plib/call.py ++++ b/lesscpy/plib/call.py +@@ -13,7 +13,6 @@ + from urllib.parse import quote as urlquote + except ImportError: + from urllib import quote as urlquote +-from six import string_types + from .node import Node + import lesscpy.lessc.utility as utility + import lesscpy.lessc.color as Color +@@ -46,7 +45,7 @@ def parse(self, scope): + color = Color.Color() + args = [ + t for t in parsed +- if not isinstance(t, string_types) or t not in '(),' ++ if not isinstance(t, str) or t not in '(),' + ] + if hasattr(self, name): + try: +diff --git a/lesscpy/plib/negated_expression.py b/lesscpy/plib/negated_expression.py +index 60d35d6..25341a6 100644 +--- a/lesscpy/plib/negated_expression.py ++++ b/lesscpy/plib/negated_expression.py +@@ -7,8 +7,6 @@ + See LICENSE for details. + """ + +-from six import string_types +- + from .node import Node + + +@@ -17,6 +15,6 @@ class NegatedExpression(Node): + + def parse(self, scope): + val, = self.process(self.tokens, scope) +- if isinstance(val, string_types): ++ if isinstance(val, str): + return '-' + val + return -val +diff --git a/test/test_lexer.py b/test/test_lexer.py +index 8158f6c..df88b37 100644 +--- a/test/test_lexer.py ++++ b/test/test_lexer.py +@@ -1,11 +1,10 @@ + """ + Unit tests for the lexer. + """ ++from io import StringIO + from tempfile import NamedTemporaryFile + import unittest + +-from six import StringIO +- + from lesscpy.lessc.lexer import LessLexer + + +diff --git a/test/test_parser.py b/test/test_parser.py +index 7a23605..032e521 100644 +--- a/test/test_parser.py ++++ b/test/test_parser.py +@@ -2,8 +2,7 @@ + Unit test for the parser. + """ + import unittest +- +-from six import StringIO ++from io import StringIO + + from lesscpy.lessc.parser import LessParser + +diff --git a/test/test_pycompile.py b/test/test_pycompile.py +index 2ed54aa..1cb2b53 100644 +--- a/test/test_pycompile.py ++++ b/test/test_pycompile.py +@@ -3,8 +3,7 @@ + + """ + import unittest +- +-from six import StringIO ++from io import StringIO + + from lesscpy import compile + + diff --git a/python-lesscpy.changes b/python-lesscpy.changes new file mode 100644 index 0000000..49cd45a --- /dev/null +++ b/python-lesscpy.changes @@ -0,0 +1,145 @@ +------------------------------------------------------------------- +Mon Jun 9 10:28:23 UTC 2025 - Markéta Machová + +- convert to libalternatives + +------------------------------------------------------------------- +Fri May 30 13:37:16 UTC 2025 - Markéta Machová + +- Convert to pip-based build + +------------------------------------------------------------------- +Mon Oct 2 10:42:43 UTC 2023 - pgajdos@suse.com + +- do not require six in the code +- added patches + fix https://github.com/lesscpy/lesscpy/pull/126 + + python-lesscpy-no-six.patch + +------------------------------------------------------------------- +Fri Oct 28 18:02:02 UTC 2022 - Yogalakshmi Arunachalam + +- Update to v0.15.1 + * Git: Ignore '.DS_Store' (macOS) + * Add `dev-requirements.txt` for `build` and `twine` packages + * README: Remove mentioning of 'six' + * Merge pull request #123 from saschpe/supported-interpreters + * Update supported Python versions + +------------------------------------------------------------------- +Thu Sep 29 14:42:56 UTC 2022 - Yogalakshmi Arunachalam + +- Release version 0.15.0 + * Update .gitignore + * Remove old interpreter versions + * Merge pull request #118 from lephe/master + * Improve support for nested media queries + * Merge pull request #117 from lephe/master + * Basic support for CSS4 variables + * Merge pull request #109 from saschpe/rel + +- Release version 0.14.0 + * Merge pull request #108 from saschpe/pycharm + * Version a PyCharm project configuration + * Update .gitignore rules based on Github Boilerplate + * Merge pull request #107 from saschpe/cleanups + * Add Python-3.7 to supported versions + * Improve minor style issues + * Merge pull request #105 from tirkarthi/fix-collections-import + * Import ABC from collections.abc instead of collections for Python 3.9 compatibility. + * Merge pull request #99 from hroncok/rpartition + * Merge pull request #98 from movermeyer/fix_badges + * Merge pull request #100 from cladmi/pr/fix/readme/command + * README.rst: fix the outdated lesscpy usage + * Apply PEP-8 consistently + * Allow to run tests from versioned folder + * Switched broken pypip.in badges to shields.io + * Merge pull request #96 from sambler/pyversions + * Merge pull request #97 from sambler/pysix + * adjust tox.ini to prevent errors from missing interpreters + * Make use of six.string_types consistent + * update python versions 2.6 was EOL in 2013 3.3 was EOL in 2017-09 add 3.6, pypy and pypy3 + +------------------------------------------------------------------- +Wed Apr 15 12:40:52 UTC 2020 - pgajdos@suse.com + +- version update to 0.14.0 + * no upstream changelog found + +------------------------------------------------------------------- +Mon Oct 14 13:52:12 UTC 2019 - Matej Cepl + +- Replace %fdupes -s with plain %fdupes; hardlinks are better. + +------------------------------------------------------------------- +Thu Feb 28 07:37:24 UTC 2019 - John Vandenberg + +- Fix incorrect URL +- Remove unnecessary build dependencies on flake8 and coverage by + using nose directly +- Add fdupes +- Update to v0.13.0 + Version bump due to non-linear version sequences + https://github.com/lesscpy/lesscpy/issues/94 + No changelog available + +------------------------------------------------------------------- +Tue Dec 4 12:49:58 UTC 2018 - Matej Cepl + +- Remove superfluous devel dependency for noarch package + +------------------------------------------------------------------- +Thu Aug 31 06:55:58 UTC 2017 - toddrme2178@gmail.com + +- update to 0.12.0 + * no changelog available + +------------------------------------------------------------------- +Thu Aug 24 13:44:20 UTC 2017 - jmatejek@suse.com + +- singlespec auto-conversion + +------------------------------------------------------------------- +Mon Aug 15 14:51:56 UTC 2016 - toddrme2178@gmail.com + +- Fix update-alternatives implementation. + +------------------------------------------------------------------- +Thu May 7 11:06:21 UTC 2015 - benoit.monin@gmx.fr + +- update to 0.10.2: + * no changelog available +- add python-setuptools and python-six as build dependencies +- add python-coverage, python-flake8 and python-nose as test + dependencies +- add python-six as runtime dependency +- remove some failing tests which rely on find_and_load_cases +- run the tests via setup.py +- fix alternatives for lesscpy binary + +------------------------------------------------------------------- +Sat Nov 08 20:50:00 UTC 2014 - Led + +- fix bashism in pre script + +------------------------------------------------------------------- +Mon Aug 12 11:42:11 UTC 2013 - speilicke@suse.com + +- Update to version 0.9j + + Support for SVG stylesheets + + Increased lessc compatibility + + Many testing improvements +- Use update-alternatives + +------------------------------------------------------------------- +Wed Jul 17 13:20:57 UTC 2013 - speilicke@suse.com + +- Update to version 0.9h +- Run testsuite + +------------------------------------------------------------------- +Wed Feb 29 12:25:36 UTC 2012 - saschpe@suse.de + +- Initial version + + diff --git a/python-lesscpy.spec b/python-lesscpy.spec new file mode 100644 index 0000000..9428d53 --- /dev/null +++ b/python-lesscpy.spec @@ -0,0 +1,79 @@ +# +# spec file for package python-lesscpy +# +# Copyright (c) 2025 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%bcond_without libalternatives +Name: python-lesscpy +Version: 0.15.1 +Release: 0 +Summary: Lesscss compiler +License: MIT +URL: https://github.com/lesscpy/lesscpy +Source: https://files.pythonhosted.org/packages/source/l/lesscpy/lesscpy-%{version}.tar.gz +# https://github.com/lesscpy/lesscpy/pull/126 +Patch0: python-lesscpy-no-six.patch +BuildRequires: %{python_module pip} +BuildRequires: %{python_module ply} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: alts +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: alts +Requires: python-ply +Requires: python-setuptools +BuildArch: noarch +%python_subpackages + +%description +python LessCss Compiler. + +A compiler written in python 3 for the lesscss language. +For those of us not willing/able to have node.js installed in our environment. +Not all features of lesscss are supported (yet). +Some features wil probably never be supported (JavaScript evaluation). +This program uses PLY (Python Lex-Yacc) to tokenize/parse the input. + +%prep +%autosetup -p1 -n lesscpy-%{version} +# remove failing tests, which rely on find_and_load_cases +rm test/test_{bootstrap3,less,issues}.py + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_clone -a %{buildroot}%{_bindir}/lesscpy +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%pre +# removing old update-alternatives entries +%python_libalternatives_reset_alternative lesscpy + +%check +%pytest + +%files %{python_files} +%license LICENSE +%doc README.rst +%python_alternative %{_bindir}/lesscpy +%{python_sitelib}/lesscpy +%{python_sitelib}/lesscpy-%{version}*-info + +%changelog