diff options
Diffstat (limited to 'system/xonsh')
-rw-r--r-- | system/xonsh/v310.patch | 432 | ||||
-rw-r--r-- | system/xonsh/xonsh.SlackBuild | 12 | ||||
-rw-r--r-- | system/xonsh/xonsh.info | 10 |
3 files changed, 446 insertions, 8 deletions
diff --git a/system/xonsh/v310.patch b/system/xonsh/v310.patch new file mode 100644 index 0000000000000..836124714eaa8 --- /dev/null +++ b/system/xonsh/v310.patch @@ -0,0 +1,432 @@ +--- xonsh-0.14.4/xonsh/parsers/v310.orig.py 2024-01-18 17:58:44.463700213 +0200 ++++ xonsh-0.14.4/xonsh/parsers/v310.py 2024-01-18 19:03:33.985074856 +0200 +@@ -76,26 +76,24 @@ + """ + + loc = self.get_line_cols(p, 1) +- match list(p): +- case [_, _, pattern, _, suite]: +- p[0] = ast.match_case(pattern=pattern, body=suite, **loc) +- case [_, _, pattern, _, guard, _, suite]: +- p[0] = ast.match_case(pattern=pattern, body=suite, guard=guard, **loc) +- case _: +- raise AssertionError() ++ if list(p) == [_, _, pattern, _, suite]: ++ p[0] = ast.match_case(pattern=pattern, body=suite, **loc) ++ elif list(p) == [_, _, pattern, _, guard, _, suite]: ++ p[0] = ast.match_case(pattern=pattern, body=suite, guard=guard, **loc) ++ else: ++ raise AssertionError() + + def p_case_block_list_nonempty(self, p): + """ + case_block_list_nonempty : case_block + | case_block case_block_list_nonempty + """ +- match list(p): +- case [_, case_block]: +- p[0] = [case_block] +- case [_, case_block, case_block_list_nonempty]: +- p[0] = [case_block] + case_block_list_nonempty +- case _: +- raise AssertionError() ++ if list(p) == [_, case_block]: ++ p[0] = [case_block] ++ elif list(p) == [_, case_block, case_block_list_nonempty]: ++ p[0] = [case_block] + case_block_list_nonempty ++ else: ++ raise AssertionError() + + # subject expression + def p_subject_expr_single_value(self, p): +@@ -103,33 +101,31 @@ + subject_expr : test_or_star_expr comma_opt + """ + +- match list(p): +- case [_, test_or_star_expr, None]: +- # single value +- p[0] = test_or_star_expr +- case [_, test_or_star_expr, ","]: +- # tuple with one element +- p[0] = ast.Tuple( +- elts=[test_or_star_expr], ctx=ast.Load(), **self.get_line_cols(p, 1) +- ) +- case _: +- raise AssertionError() ++ if list(p) == [_, test_or_star_expr, None]: ++ # single value ++ p[0] = test_or_star_expr ++ elif list(p) == [_, test_or_star_expr, ","]: ++ # tuple with one element ++ p[0] = ast.Tuple( ++ elts=[test_or_star_expr], ctx=ast.Load(), **self.get_line_cols(p, 1) ++ ) ++ else: ++ raise AssertionError() + + def p_subject_expr_multiple_values(self, p): + """ + subject_expr : test_or_star_expr comma_test_or_star_expr_list comma_opt + """ + +- match list(p): +- case [_, test_or_star_expr, comma_test_or_star_expr_list, "," | None]: +- # tuple with more than one element +- p[0] = ast.Tuple( +- elts=[test_or_star_expr] + comma_test_or_star_expr_list, +- ctx=ast.Load(), +- **self.get_line_cols(p, 1), +- ) +- case _: +- raise AssertionError() ++ if list(p) == [_, test_or_star_expr, comma_test_or_star_expr_list, "," | None]: ++ # tuple with more than one element ++ p[0] = ast.Tuple( ++ elts=[test_or_star_expr] + comma_test_or_star_expr_list, ++ ctx=ast.Load(), ++ **self.get_line_cols(p, 1), ++ ) ++ else: ++ raise AssertionError() + + # patterns + def p_closed_pattern(self, p): +@@ -167,22 +163,20 @@ + + _, or_pattern_list = p + +- match or_pattern_list: +- case [single_value]: +- p[0] = single_value +- case multiple_values: +- p[0] = ast.MatchOr(patterns=multiple_values, **self.get_line_cols(p, 1)) ++ if or_pattern_list == [single_value]: ++ p[0] = single_value ++ elif or_pattern_list == multiple_values: ++ p[0] = ast.MatchOr(patterns=multiple_values, **self.get_line_cols(p, 1)) + + def p_or_pattern_list(self, p): + """ + or_pattern_list : closed_pattern + | closed_pattern PIPE or_pattern_list + """ +- match list(p): +- case [_, closed_pattern]: +- p[0] = [closed_pattern] +- case [_, closed_pattern, "|", or_pattern_list]: +- p[0] = [closed_pattern] + or_pattern_list ++ if list(p) == [_, closed_pattern]: ++ p[0] = [closed_pattern] ++ elif list(p) == [_, closed_pattern, "|", or_pattern_list]: ++ p[0] = [closed_pattern] + or_pattern_list + + # group pattern + def p_group_pattern(self, p): +@@ -198,11 +192,10 @@ + literal_pattern : literal_expr + """ + +- match p[1]: +- case None | True | False: +- p[0] = ast.MatchSingleton(value=p[1], **self.get_line_cols(p, 1)) +- case _: +- p[0] = ast.MatchValue(value=p[1], **self.get_line_cols(p, 1)) ++ if p[1] == None | True | False: ++ p[0] = ast.MatchSingleton(value=p[1], **self.get_line_cols(p, 1)) ++ else: ++ p[0] = ast.MatchValue(value=p[1], **self.get_line_cols(p, 1)) + + def p_literal_expr_number_or_string_literal_list(self, p): + """ +@@ -212,11 +205,10 @@ + + p[0] = p[1] + +- match p[1]: +- case ast.JoinedStr(): +- raise AssertionError("patterns may not match formatted string literals") +- # TODO: raise SyntaxError instead +- # (doing so currently somehow causes an IndexError in tools.py:get_logical_line) ++ if p[1] == ast.JoinedStr(): ++ raise AssertionError("patterns may not match formatted string literals") ++ # TODO: raise SyntaxError instead ++ # (doing so currently somehow causes an IndexError in tools.py:get_logical_line) + + # TODO: f"hi" "hi" does not parse in xonsh + +@@ -227,15 +219,14 @@ + | false_tok + """ + +- match p[1].value: +- case "None": +- value = None +- case "True": +- value = True +- case "False": +- value = False +- case _: +- raise AssertionError() ++ if p[1].value == "None": ++ value = None ++ elif "True": ++ value = True ++ elif "False": ++ value = False ++ else: ++ raise AssertionError() + + p[0] = value + +@@ -253,19 +244,18 @@ + build_complex = False + loc = self.get_line_cols(p, 1) + +- match list(p): +- case [_, x]: +- p[0] = x +- case [_, "-", x]: +- p[0] = ast.UnaryOp(op=ast.USub(), operand=x, **loc) +- case [_, left, ("+" | "-") as op_char, right]: +- build_complex = True +- negate_left_side = False +- case [_, "-", left, ("+" | "-") as op_char, right]: +- build_complex = True +- negate_left_side = True +- case _: +- raise AssertionError() ++ if list(p) == [_, x]: ++ p[0] = x ++ elif list(p) == [_, "-", x]: ++ p[0] = ast.UnaryOp(op=ast.USub(), operand=x, **loc) ++ elif list(p) == [_, left, ("+", op_char) | ("-", op_char), right]: ++ build_complex = True ++ negate_left_side = False ++ elif list(p) == [_, "-", left, ("+", op_char) | ("-", op_char), right]: ++ build_complex = True ++ negate_left_side = True ++ else: ++ raise AssertionError() + + if build_complex: + # TODO raise syntax error instead (see reason in p_literal_expr_number_or_string_literal_list) +@@ -322,17 +312,16 @@ + | LPAREN RPAREN + """ + +- match list(p): +- case [_, _, ast.MatchSequence() as seq, _]: +- p[0] = seq +- case [_, _, single_item, _]: +- p[0] = ast.MatchSequence( +- patterns=[single_item], **self.get_line_cols(p, 1) +- ) +- case [_, _, _]: +- p[0] = ast.MatchSequence(patterns=[], **self.get_line_cols(p, 1)) +- case _: +- raise AssertionError() ++ if list(p) == [_, _, (ast.MatchSequence(), seq), _]: ++ p[0] = seq ++ elif list(p) == [_, _, single_item, _]: ++ p[0] = ast.MatchSequence( ++ patterns=[single_item], **self.get_line_cols(p, 1) ++ ) ++ elif list(p) == [_, _, _]: ++ p[0] = ast.MatchSequence(patterns=[], **self.get_line_cols(p, 1)) ++ else: ++ raise AssertionError() + + def p_maybe_sequence_pattern(self, p): + """ +@@ -340,30 +329,24 @@ + | maybe_star_pattern COMMA maybe_sequence_pattern + """ + +- match list(p): +- case [_, maybe_star_pattern, ","]: +- p[0] = ast.MatchSequence( +- patterns=[maybe_star_pattern], **self.get_line_cols(p, 1) +- ) +- case [_, maybe_star_pattern, None]: +- p[0] = maybe_star_pattern +- case [ +- _, +- maybe_star_pattern, +- ",", +- ast.MatchSequence(patterns=list(maybe_sequence_pattern)), +- ]: +- p[0] = ast.MatchSequence( +- patterns=[maybe_star_pattern] + maybe_sequence_pattern, +- **self.get_line_cols(p, 1), +- ) +- case [_, maybe_star_pattern, ",", maybe_sequence_pattern]: +- p[0] = ast.MatchSequence( +- patterns=[maybe_star_pattern, maybe_sequence_pattern], +- **self.get_line_cols(p, 1), +- ) +- case _: +- raise AssertionError() ++ if list(p) == [_, maybe_star_pattern, ","]: ++ p[0] = ast.MatchSequence( ++ patterns=[maybe_star_pattern], **self.get_line_cols(p, 1) ++ ) ++ elif list(p) == [_, maybe_star_pattern, None]: ++ p[0] = maybe_star_pattern ++ elif list(p) == [_, maybe_star_pattern, ",", ast.MatchSequence(patterns=list(maybe_sequence_pattern)),]: ++ p[0] = ast.MatchSequence( ++ patterns=[maybe_star_pattern] + maybe_sequence_pattern, ++ **self.get_line_cols(p, 1), ++ ) ++ elif list(p) == [_, maybe_star_pattern, ",", maybe_sequence_pattern]: ++ p[0] = ast.MatchSequence( ++ patterns=[maybe_star_pattern, maybe_sequence_pattern], ++ **self.get_line_cols(p, 1), ++ ) ++ else: ++ raise AssertionError() + + def p_open_sequence_pattern(self, p): + """ +@@ -429,19 +412,18 @@ + | name_str EQUALS pattern COMMA class_pattern_keyword_part + """ + +- match list(p): +- case [_]: +- p[0] = ([], []) +- case [_, pattern]: +- p[0] = ([pattern], []) +- case [_, pattern, ",", (names, patterns)]: +- p[0] = ([pattern] + names, patterns) +- case [_, name, "=", pattern]: +- p[0] = ([], [(name, pattern)]) +- case [_, name, "=", pattern, ",", class_pattern_keyword_part]: +- p[0] = ([], [(name, pattern)] + class_pattern_keyword_part) +- case _: +- raise AssertionError() ++ if list(p) == [_]: ++ p[0] = ([], []) ++ elif list(p) == [_, pattern]: ++ p[0] = ([pattern], []) ++ elif list(p) == [_, pattern, ",", (names, patterns)]: ++ p[0] = ([pattern] + names, patterns) ++ elif list(p) == [_, name, "=", pattern]: ++ p[0] = ([], [(name, pattern)]) ++ elif list(p) == [_, name, "=", pattern, ",", class_pattern_keyword_part]: ++ p[0] = ([], [(name, pattern)] + class_pattern_keyword_part) ++ else: ++ raise AssertionError() + + # returns ( [pattern], [ (name, pattern) ] ) + def p_class_pattern_positional_part_skip(self, p): +@@ -457,13 +439,12 @@ + | pattern COMMA class_pattern_positional_part + """ + +- match list(p): +- case [_, pattern]: +- p[0] = ([pattern], []) +- case [_, pattern, ",", (names, patterns)]: +- p[0] = ([pattern] + names, patterns) +- case _: +- raise AssertionError() ++ if list(p) == [_, pattern]: ++ p[0] = ([pattern], []) ++ elif list(p) == [_, pattern, ",", (names, patterns)]: ++ p[0] = ([pattern] + names, patterns) ++ else: ++ raise AssertionError() + + # returns [ (name, pattern) ] + def p_class_pattern_keyword_part(self, p): +@@ -474,15 +455,14 @@ + | name_str EQUALS pattern COMMA class_pattern_keyword_part + """ + +- match list(p): +- case [_] | [_, ","]: +- p[0] = [] +- case [_, name, "=", pattern]: +- p[0] = [(name, pattern)] +- case [_, name, "=", pattern, ",", class_pattern_keyword_part]: +- p[0] = [(name, pattern)] + class_pattern_keyword_part +- case _: +- raise AssertionError() ++ if list(p) == [_] | [_, ","]: ++ p[0] = [] ++ elif list(p) == [_, name, "=", pattern]: ++ p[0] = [(name, pattern)] ++ elif list(p) == [_, name, "=", pattern, ",", class_pattern_keyword_part]: ++ p[0] = [(name, pattern)] + class_pattern_keyword_part ++ else: ++ raise AssertionError() + + # Mapping pattern + +@@ -505,43 +485,40 @@ + | key_value_pattern COMMA mapping_pattern_args_item_part + | double_star_pattern + """ +- match list(p): +- case [_]: +- p[0] = [], [], None +- case [_, (key, value)]: +- p[0] = [key], [value], None +- case [_, (key, value), ",", (keys, values, rest)]: +- p[0] = [key] + keys, [value] + values, rest +- case [_, str(double_star_pattern)]: +- p[0] = [], [], double_star_pattern +- case _: +- raise AssertionError() ++ if list(p) == [_]: ++ p[0] = [], [], None ++ elif list(p) == [_, (key, value)]: ++ p[0] = [key], [value], None ++ elif list(p) == [_, (key, value), ",", (keys, values, rest)]: ++ p[0] = [key] + keys, [value] + values, rest ++ elif list(p) == [_, str(double_star_pattern)]: ++ p[0] = [], [], double_star_pattern ++ else: ++ raise AssertionError() + + def p_mapping_pattern_args_item_part_skip(self, p): + """ + mapping_pattern_args_item_part : + | double_star_pattern + """ +- match list(p): +- case [_]: +- p[0] = [], [], None +- case [_, rest]: +- p[0] = [], [], rest +- case _: +- raise AssertionError() ++ if list(p) == [_]: ++ p[0] = [], [], None ++ elif list(p) == [_, rest]: ++ p[0] = [], [], rest ++ else: ++ raise AssertionError() + + def p_mapping_pattern_args_item_part(self, p): + """ + mapping_pattern_args_item_part : key_value_pattern + | key_value_pattern COMMA mapping_pattern_args_item_part + """ +- match list(p): +- case [_, (key, value)]: +- p[0] = [key], [value], None +- case [_, (key, value), ",", (keys, values, rest)]: +- p[0] = [key] + keys, [value] + values, rest +- case _: +- raise AssertionError() ++ if list(p) == [_, (key, value)]: ++ p[0] = [key], [value], None ++ elif list(p) == [_, (key, value), ",", (keys, values, rest)]: ++ p[0] = [key] + keys, [value] + values, rest ++ else: ++ raise AssertionError() + + def p_double_star_pattern(self, p): + """ diff --git a/system/xonsh/xonsh.SlackBuild b/system/xonsh/xonsh.SlackBuild index 5a976fbe113f9..471c8698d03f8 100644 --- a/system/xonsh/xonsh.SlackBuild +++ b/system/xonsh/xonsh.SlackBuild @@ -2,7 +2,7 @@ # Slackware build script for xonsh -# Copyright 2016-2019 Dimitris Zlatanidis Orestiada, Greece +# Copyright 2016-2024 Dimitris Zlatanidis Orestiada, Greece # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -28,7 +28,7 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM=xonsh -VERSION=${VERSION:-0.11.0} +VERSION=${VERSION:-0.14.4} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -79,7 +79,13 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; -python3 setup.py install --root=$PKG +# Fixed compatibility with python3.9 +patch -p1 < $CWD/v310.patch + +export PYTHONPATH=/opt/python3.9/site-packages/ + +python3 -m build --wheel --no-isolation +python3 -m installer --destdir "$PKG" dist/*.whl find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true diff --git a/system/xonsh/xonsh.info b/system/xonsh/xonsh.info index 7e676835b0c81..88b0267a5080e 100644 --- a/system/xonsh/xonsh.info +++ b/system/xonsh/xonsh.info @@ -1,10 +1,10 @@ PRGNAM="xonsh" -VERSION="0.11.0" +VERSION="0.14.4" HOMEPAGE="https://xon.sh/" -DOWNLOAD="https://github.com/xonsh/xonsh/archive/0.11.0/xonsh-0.11.0.tar.gz" -MD5SUM="032a2d790c9ab35dd426c15c5474d57f" +DOWNLOAD="https://github.com/xonsh/xonsh/archive/0.14.4/xonsh-0.14.4.tar.gz" +MD5SUM="75a00385bca4e113c21eaabcf68bee18" DOWNLOAD_x86_64="" MD5SUM_x86_64="" -REQUIRES="" +REQUIRES="python3-setuptools-opt" MAINTAINER="Dimitris Zlatanidis" -EMAIL="d.zlatanidis@gmail.com" +EMAIL="dslackw@gmail.com" |