Skip to content

Commit

Permalink
Remove python2 support in c2f.py
Browse files Browse the repository at this point in the history
  • Loading branch information
wdeconinck committed Aug 21, 2024
1 parent f62b174 commit f7213e9
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions tools/c2f.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.

#! /usr/bin/env python
#! /usr/bin/env python3

from __future__ import print_function
from argparse import ArgumentParser
import re
import time
Expand Down Expand Up @@ -50,7 +49,7 @@
'logical(c_bool)':'c_bool'
}

function_signature = re.compile('''^
function_signature = re.compile(r'''^
( #1 Type
(const\s+)? #2 Leading const
([^\*\&\s\[]+) #3
Expand All @@ -72,7 +71,7 @@ def __init__(self,msg):

class Argument:

arg_signature = re.compile('''^
arg_signature = re.compile(r'''^
( #1 Type
(const\s+)? #2 Leading const
([^\*\&\s\[]+) #3
Expand Down Expand Up @@ -180,9 +179,6 @@ def __init__(self,line):
except KeyError:
raise ParsingFailed("Could not parse return type for statement "+line)

def __nonzero__(self): # python 2
return self.type != "void"

def __bool__(self): # python 3
return self.type != "void"

Expand Down Expand Up @@ -304,9 +300,9 @@ def statements(self):

with open(input,'r') as file:
content = file.read()
externC = re.compile('^extern\s+"C"(\s*{)?')
externC = re.compile(r'^extern\s+"C"(\s*{)?')

regex_externC = [re.compile('^extern\s+"C"(\s*{)?'),re.compile('^{')]
regex_externC = [re.compile(r'^extern\s+"C"(\s*{)?'),re.compile('^{')]
in_externC = [False,False]

for line in content.splitlines():
Expand Down

0 comments on commit f7213e9

Please sign in to comment.