Skip to content

Commit 4254ccb

Browse files
committed
python 3 fixes
1 parent fa9d1a0 commit 4254ccb

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ PYTHON_CONFIG=python-config
9595
#PYTHON_CONFIG=python-debug-config
9696

9797
#PYTHON=python3-debug
98-
#PYTHON_CONFIG=python3.2dmu-config
98+
#PYTHON_CONFIG=python3.3dm-config
9999

100100
PYTHON_INCLUDES=$(shell $(PYTHON_CONFIG) --includes)
101101
PYTHON_LIBS=$(shell $(PYTHON_CONFIG) --libs)

gcc-python-plugin.spec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Name: gcc-python-plugin
2-
Version: 0.12
2+
Version: 0.13
33
Release: 1%{?dist}
44
Summary: GCC plugin that embeds Python
55

@@ -177,7 +177,7 @@ BuildPlugin \
177177

178178
BuildPlugin \
179179
python3-debug \
180-
python3.2dmu-config \
180+
python3.3dm-config \
181181
python3_debug.so \
182182
python3_debug
183183

@@ -236,7 +236,7 @@ InstallPlugin \
236236

237237
InstallPlugin \
238238
python3-debug \
239-
python3.2dmu-config \
239+
python3.3dm-config \
240240
python3_debug.so \
241241
python3_debug
242242

@@ -322,7 +322,7 @@ CheckPlugin \
322322
# (shares the issues of the above)
323323
CheckPlugin \
324324
python3-debug \
325-
python3.2dmu-config \
325+
python3.3dm-config \
326326
python3_debug.so \
327327
python3_debug \
328328
"-x tests/cpychecker"

gccutils/graph/stmtgraph.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ def __str__(self):
182182
def __repr__(self):
183183
return 'StmtNode(%r)' % self.stmt
184184

185+
def __hash__(self):
186+
return hash(self.stmt)
187+
185188
def get_stmt(self):
186189
return self.stmt
187190

libcpychecker_html/make_html.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from os.path import realpath, dirname, join
2828
HERE = dirname(realpath(__file__))
2929

30-
import capi
30+
from . import capi
3131

3232
from lxml.html import (
3333
tostring, fragment_fromstring as parse, builder as E
@@ -37,6 +37,7 @@
3737
from pygments.lexers.compiled import CLexer
3838
from pygments.formatters.html import HtmlFormatter
3939

40+
import base64
4041
from copy import deepcopy
4142
from itertools import islice
4243

@@ -58,7 +59,7 @@ def __init__(self, codefile, data):
5859

5960
def __str__(self):
6061
html = tostring(self.__html__())
61-
return '<!DOCTYPE html>\n' + html
62+
return '<!DOCTYPE html>\n' + html.decode('utf-8')
6263

6364
def __html__(self):
6465
return E.HTML(self.head(), self.body())
@@ -271,8 +272,9 @@ def body(self):
271272
def data_uri(mimetype, filename):
272273
"""represent a file as a data uri"""
273274
data = open(join(HERE, filename), 'rb').read()
274-
data = data.encode('base64').replace('\n', '')
275-
return 'data:%s;base64,%s' % (mimetype, data)
275+
data = base64.encodestring(data)
276+
data = data.replace(b'\n', b'')
277+
return 'data:%s;base64,%s' % (mimetype, data.decode('ascii'))
276278

277279

278280
def file_contents(filename):

0 commit comments

Comments
 (0)