Codebase list rastertosag-gdi / 6f9fb25
Initialize git-dpm Didier Raboud 6 years ago
5 changed file(s) with 121 addition(s) and 104 deletion(s). Raw diff Collapse all Expand all
0 # see git-dpm(1) from git-dpm package
1 1a2f7443498a2826502d77e017ada2b31e0e8df3
2 1a2f7443498a2826502d77e017ada2b31e0e8df3
3 944f9616e6f42bbf40d130c5c865bd8a557ca756
4 944f9616e6f42bbf40d130c5c865bd8a557ca756
5 rastertosag-gdi_0.1.orig.tar.gz
6 2e103cf8460ef5955ee1ad1957ad9cec744969f4
7 7573
0 From 1a2f7443498a2826502d77e017ada2b31e0e8df3 Mon Sep 17 00:00:00 2001
1 From: Didier Raboud <odyx@debian.org>
2 Date: Sat, 10 Feb 2018 17:03:12 +0100
3 Subject: rastertosag-gdi-python3
4
5 ---
6 rastertosag-gdi | 24 ++++++++++++------------
7 1 file changed, 12 insertions(+), 12 deletions(-)
8
9 diff --git a/rastertosag-gdi b/rastertosag-gdi
10 index 52b08d7..28f8606 100755
11 --- a/rastertosag-gdi
12 +++ b/rastertosag-gdi
13 @@ -1,4 +1,4 @@
14 -#!/usr/bin/python -u
15 +#!/usr/bin/python3 -u
16 #coding=utf8
17
18 # CUPS raster filter for Ricoh Aficio SP1000s
19 @@ -26,10 +26,10 @@ filename='-'
20 if len(sys.argv)>6:
21 filename=sys.argv[6]
22 if filename=='.' or filename=='-':
23 - input=sys.stdin
24 + input=sys.stdin.buffer
25 else:
26 - input = open(sys.argv[6],'r')
27 -output = sys.stdout
28 + input = open(sys.argv[6],'rb')
29 +output = sys.stdout.buffer
30
31 def print_stderr(s,newline=True):
32 sys.stderr.write(str(s)+('\n' if newline else ''))
33 @@ -39,7 +39,7 @@ def print_stderr(s,newline=True):
34 cups = input.read() # Read all bytes from stdin
35
36 sync_word=cups[0:4] # length of sync-word is 4 bytes: "3SaR"
37 -version=int(cups[0])
38 +version=cups[0]-48
39 cups=cups[4:]
40
41 dtype={
42 @@ -55,7 +55,7 @@ header_length={ # length of page header
43 }
44
45 def make_unpack_format(format,begin,end,split_count=1):
46 - return '<'+(str((end-begin+1)/dtype[format]['size']/split_count)+dtype[format]['b'])*split_count
47 + return '<'+(str((end-begin+1)//dtype[format]['size']//split_count)+dtype[format]['b'])*split_count
48
49 hdr={
50 1: {}, # version 1 header
51 @@ -159,10 +159,10 @@ def get_cups_line(y):
52 line=unpack('<'+str(numbytes)+'B',page_data[y*numbytes:(y+1)*numbytes])
53 ret=[]
54 extend=ret.extend
55 - for x in range(0,w/8):
56 + for x in range(0,w//8):
57 extend(bytes[line[x]])
58 if w%8:
59 - extend(bytes[line[w/8]][:w%8])
60 + extend(bytes[line[w//8]][:w%8])
61 return ret
62
63 FORMAT_WIDTH=0
64 @@ -185,7 +185,7 @@ formats = {
65 def begin_document():
66 output.write(pack(
67 '>76sbbHHI',
68 - ') SAG-GDI RL;0;0;Comment Copyright Sagem Communication 2005. Version 1.0.0.0',
69 + b') SAG-GDI RL;0;0;Comment Copyright Sagem Communication 2005. Version 1.0.0.0',
70 0x0D,0x0A,
71 0x1000,0x0200,
72 0
73 @@ -217,7 +217,7 @@ current_block_data=''
74 current_line_length=0
75 def begin_block():
76 global current_block_data
77 - current_block_data=''
78 + current_block_data=b''
79
80 def get_block_size():
81 return len(current_block_data)
82 @@ -232,7 +232,7 @@ def write_px_data(col,length):
83 color = 1 if col else 0
84 color_bit = color << 6
85 first_byte = length%64
86 - second_byte = length/64
87 + second_byte = length//64
88 two_bytes_bit = 0b10000000 if second_byte else 0b00000000
89
90 px_data=pack('>B', two_bytes_bit | color_bit | first_byte)
91 @@ -257,7 +257,7 @@ def write_cups():
92 w,h=min(hdr[1]['cupsWidth'],formats[format][FORMAT_WIDTH]),min(hdr[1]['cupsHeight'],formats[format][FORMAT_HEIGHT])
93 t=time()
94 for y in range(h):
95 - if y%(h/15)==0:
96 + if y%(h//15)==0:
97 print_stderr('%d%% '%(int(float(y)/h*100),),False)
98
99 yline=get_cups_line(y)
+0
-91
debian/patches/rastertosag-gdi-python3.patch less more
0 Index: rastertosag-gdi-0.1/rastertosag-gdi
1 ===================================================================
2 --- rastertosag-gdi-0.1.orig/rastertosag-gdi
3 +++ rastertosag-gdi-0.1/rastertosag-gdi
4 @@ -1,4 +1,4 @@
5 -#!/usr/bin/python -u
6 +#!/usr/bin/python3 -u
7 #coding=utf8
8
9 # CUPS raster filter for Ricoh Aficio SP1000s
10 @@ -26,10 +26,10 @@ filename='-'
11 if len(sys.argv)>6:
12 filename=sys.argv[6]
13 if filename=='.' or filename=='-':
14 - input=sys.stdin
15 + input=sys.stdin.buffer
16 else:
17 - input = open(sys.argv[6],'r')
18 -output = sys.stdout
19 + input = open(sys.argv[6],'rb')
20 +output = sys.stdout.buffer
21
22 def print_stderr(s,newline=True):
23 sys.stderr.write(str(s)+('\n' if newline else ''))
24 @@ -39,7 +39,7 @@ def print_stderr(s,newline=True):
25 cups = input.read() # Read all bytes from stdin
26
27 sync_word=cups[0:4] # length of sync-word is 4 bytes: "3SaR"
28 -version=int(cups[0])
29 +version=cups[0]-48
30 cups=cups[4:]
31
32 dtype={
33 @@ -55,7 +55,7 @@ header_length={ # length of page header
34 }
35
36 def make_unpack_format(format,begin,end,split_count=1):
37 - return '<'+(str((end-begin+1)/dtype[format]['size']/split_count)+dtype[format]['b'])*split_count
38 + return '<'+(str((end-begin+1)//dtype[format]['size']//split_count)+dtype[format]['b'])*split_count
39
40 hdr={
41 1: {}, # version 1 header
42 @@ -159,10 +159,10 @@ def get_cups_line(y):
43 line=unpack('<'+str(numbytes)+'B',page_data[y*numbytes:(y+1)*numbytes])
44 ret=[]
45 extend=ret.extend
46 - for x in range(0,w/8):
47 + for x in range(0,w//8):
48 extend(bytes[line[x]])
49 if w%8:
50 - extend(bytes[line[w/8]][:w%8])
51 + extend(bytes[line[w//8]][:w%8])
52 return ret
53
54 FORMAT_WIDTH=0
55 @@ -185,7 +185,7 @@ formats = {
56 def begin_document():
57 output.write(pack(
58 '>76sbbHHI',
59 - ') SAG-GDI RL;0;0;Comment Copyright Sagem Communication 2005. Version 1.0.0.0',
60 + b') SAG-GDI RL;0;0;Comment Copyright Sagem Communication 2005. Version 1.0.0.0',
61 0x0D,0x0A,
62 0x1000,0x0200,
63 0
64 @@ -217,7 +217,7 @@ current_block_data=''
65 current_line_length=0
66 def begin_block():
67 global current_block_data
68 - current_block_data=''
69 + current_block_data=b''
70
71 def get_block_size():
72 return len(current_block_data)
73 @@ -232,7 +232,7 @@ def write_px_data(col,length):
74 color = 1 if col else 0
75 color_bit = color << 6
76 first_byte = length%64
77 - second_byte = length/64
78 + second_byte = length//64
79 two_bytes_bit = 0b10000000 if second_byte else 0b00000000
80
81 px_data=pack('>B', two_bytes_bit | color_bit | first_byte)
82 @@ -257,7 +257,7 @@ def write_cups():
83 w,h=min(hdr[1]['cupsWidth'],formats[format][FORMAT_WIDTH]),min(hdr[1]['cupsHeight'],formats[format][FORMAT_HEIGHT])
84 t=time()
85 for y in range(h):
86 - if y%(h/15)==0:
87 + if y%(h//15)==0:
88 print_stderr('%d%% '%(int(float(y)/h*100),),False)
89
90 yline=get_cups_line(y)
0 rastertosag-gdi-python3.patch
0 0001-rastertosag-gdi-python3.patch
0 #!/usr/bin/python -u
0 #!/usr/bin/python3 -u
11 #coding=utf8
22
33 # CUPS raster filter for Ricoh Aficio SP1000s
2525 if len(sys.argv)>6:
2626 filename=sys.argv[6]
2727 if filename=='.' or filename=='-':
28 input=sys.stdin
28 input=sys.stdin.buffer
2929 else:
30 input = open(sys.argv[6],'r')
31 output = sys.stdout
30 input = open(sys.argv[6],'rb')
31 output = sys.stdout.buffer
3232
3333 def print_stderr(s,newline=True):
3434 sys.stderr.write(str(s)+('\n' if newline else ''))
3838 cups = input.read() # Read all bytes from stdin
3939
4040 sync_word=cups[0:4] # length of sync-word is 4 bytes: "3SaR"
41 version=int(cups[0])
41 version=cups[0]-48
4242 cups=cups[4:]
4343
4444 dtype={
5454 }
5555
5656 def make_unpack_format(format,begin,end,split_count=1):
57 return '<'+(str((end-begin+1)/dtype[format]['size']/split_count)+dtype[format]['b'])*split_count
57 return '<'+(str((end-begin+1)//dtype[format]['size']//split_count)+dtype[format]['b'])*split_count
5858
5959 hdr={
6060 1: {}, # version 1 header
158158 line=unpack('<'+str(numbytes)+'B',page_data[y*numbytes:(y+1)*numbytes])
159159 ret=[]
160160 extend=ret.extend
161 for x in range(0,w/8):
161 for x in range(0,w//8):
162162 extend(bytes[line[x]])
163163 if w%8:
164 extend(bytes[line[w/8]][:w%8])
164 extend(bytes[line[w//8]][:w%8])
165165 return ret
166166
167167 FORMAT_WIDTH=0
184184 def begin_document():
185185 output.write(pack(
186186 '>76sbbHHI',
187 ') SAG-GDI RL;0;0;Comment Copyright Sagem Communication 2005. Version 1.0.0.0',
187 b') SAG-GDI RL;0;0;Comment Copyright Sagem Communication 2005. Version 1.0.0.0',
188188 0x0D,0x0A,
189189 0x1000,0x0200,
190190 0
216216 current_line_length=0
217217 def begin_block():
218218 global current_block_data
219 current_block_data=''
219 current_block_data=b''
220220
221221 def get_block_size():
222222 return len(current_block_data)
231231 color = 1 if col else 0
232232 color_bit = color << 6
233233 first_byte = length%64
234 second_byte = length/64
234 second_byte = length//64
235235 two_bytes_bit = 0b10000000 if second_byte else 0b00000000
236236
237237 px_data=pack('>B', two_bytes_bit | color_bit | first_byte)
256256 w,h=min(hdr[1]['cupsWidth'],formats[format][FORMAT_WIDTH]),min(hdr[1]['cupsHeight'],formats[format][FORMAT_HEIGHT])
257257 t=time()
258258 for y in range(h):
259 if y%(h/15)==0:
259 if y%(h//15)==0:
260260 print_stderr('%d%% '%(int(float(y)/h*100),),False)
261261
262262 yline=get_cups_line(y)