Skip to content

Migrate to use Python 3 #378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/SwiftSyntax/TokenKind.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public enum TokenKind {
case .eof: return .zero
% for token in SYNTAX_TOKENS:
% if token.text:
case .${token.swift_kind()}: return SourceLength(utf8Length: ${len(token.text.decode('string_escape'))})
case .${token.swift_kind()}: return SourceLength(utf8Length: ${len(token.text.encode('utf-8').decode('unicode-escape'))})
% else:
case .${token.swift_kind()}(let text): return SourceLength(of: text)
% end
Expand Down Expand Up @@ -168,7 +168,7 @@ extension TokenKind {
% for token in SYNTAX_TOKENS:
% if token.text:
case .${token.swift_kind()}:
let length = ${len(token.text.decode('string_escape'))}
let length = ${len(token.text.encode('utf-8').decode('unicode-escape'))}
return body(.init(kind: .${token.swift_kind()}, length: length))
% else:
case .${token.swift_kind()}(var text):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from gyb_syntax_support import SYNTAX_TOKEN_MAP, create_node_map, SYNTAX_NODES
from gyb_syntax_support.kinds import SYNTAX_BASE_KINDS
from gyb_syntax_support.kinds import lowercase_first_word
from ExpressibleAsConformances import SYNTAX_BUILDABLE_EXPRESSIBLE_AS_CONFORMANCES
from utils import flat_documentation
from .ExpressibleAsConformances import SYNTAX_BUILDABLE_EXPRESSIBLE_AS_CONFORMANCES
from .utils import flat_documentation

class SyntaxBuildableChild:
"""
Expand Down
4 changes: 2 additions & 2 deletions Sources/SwiftSyntaxBuilder/gyb_helpers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from SyntaxBuildableWrappers import SyntaxBuildableChild, SyntaxBuildableNode, SyntaxBuildableType
from utils import conformance_clause, flat_documentation
from .SyntaxBuildableWrappers import SyntaxBuildableChild, SyntaxBuildableNode, SyntaxBuildableType
from .utils import conformance_clause, flat_documentation
7 changes: 2 additions & 5 deletions build-script.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/usr/bin/env python


from __future__ import absolute_import, print_function, unicode_literals
#!/usr/bin/env python3

import argparse
import os
Expand Down Expand Up @@ -519,7 +516,7 @@ def find_lit_test_helper_exec(toolchain, build_dir, release):
swiftpm_call.extend(["--show-bin-path"])

bin_dir = subprocess.check_output(swiftpm_call)
return os.path.join(bin_dir.strip(), "lit-test-helper")
return os.path.join(bin_dir.strip().decode('utf-8'), "lit-test-helper")


def run_lit_tests(toolchain, build_dir, release, filecheck_exec, verbose):
Expand Down