From 9ce9ee262497761012df7c20c77a9fdf90f452d6 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 26 Feb 2019 16:36:41 +0800 Subject: [PATCH] hack-patch pythonparser for Python 3.7 compatibility Python 3.7 will be the main version in NixOS 19.03. --- artiq/pkgs/python-deps.nix | 1 + artiq/pkgs/python37hack.patch | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 artiq/pkgs/python37hack.patch diff --git a/artiq/pkgs/python-deps.nix b/artiq/pkgs/python-deps.nix index 7917d3a..c36001f 100644 --- a/artiq/pkgs/python-deps.nix +++ b/artiq/pkgs/python-deps.nix @@ -33,6 +33,7 @@ rec { rev = "5b391fe86f43bb9f4f96c5bc0532e2a112db2936"; sha256 = "1gw1fk4y2l6bwq0fg2a9dfc1rvq8cv492dyil96amjdhsxvnx35b"; }; + patches = [ ./python37hack.patch ]; propagatedBuildInputs = with python3Packages; [ regex ]; }; diff --git a/artiq/pkgs/python37hack.patch b/artiq/pkgs/python37hack.patch new file mode 100644 index 0000000..391da2f --- /dev/null +++ b/artiq/pkgs/python37hack.patch @@ -0,0 +1,33 @@ +diff --git a/pythonparser/lexer.py b/pythonparser/lexer.py +index a62eaf1..2c48d36 100644 +--- a/pythonparser/lexer.py ++++ b/pythonparser/lexer.py +@@ -79,6 +79,7 @@ class Lexer: + (3, 4): _reserved_3_1, + (3, 5): _reserved_3_5, + (3, 6): _reserved_3_5, ++ (3, 7): _reserved_3_5, + } + """ + A map from a tuple (*major*, *minor*) corresponding to Python version to +@@ -102,6 +103,7 @@ class Lexer: + (3, 4): _string_prefixes_3_3, + (3, 5): _string_prefixes_3_3, + (3, 6): _string_prefixes_3_6, ++ (3, 7): _string_prefixes_3_6, + } + """ + A map from a tuple (*major*, *minor*) corresponding to Python version to +diff --git a/pythonparser/parser.py b/pythonparser/parser.py +index 10c741d..f748695 100644 +--- a/pythonparser/parser.py ++++ b/pythonparser/parser.py +@@ -419,7 +419,7 @@ class Parser(object): + self.expr_stmt_1 = self.expr_stmt_1__26 + self.yield_expr = self.yield_expr__26 + return +- elif version in ((3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6)): ++ elif version in ((3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6), (3, 7)): + if version == (3, 0): + self.with_stmt = self.with_stmt__26 # lol + else: