Debian Codegraph @

debian/patches/revert-bitarray-bump.patch

raw
1 Description: Revert the bitarray 3 bump
2 Author: Keir Fraser <[email protected]>
3 Forwarded: not-needed
4
5 This reverts 6d806059ad7a9323435fdfef0d711bb2b38d2dd0.
6
7 diff --git c/setup.py i/setup.py
8 index 9013214..155b53a 100644
9 --- c/setup.py
10 +++ i/setup.py
11 @@ -18,7 +18,7 @@ setup(name = 'greaseweazle',
12 version = version(),
13 install_requires = [
14 'crcmod',
15 - 'bitarray>=3',
16 + 'bitarray<3',
17 'pyserial',
18 'requests'
19 ],
20 diff --git c/src/greaseweazle/codec/amiga/amigados.py i/src/greaseweazle/codec/amiga/amigados.py
21 index 7c8e3f9..69784dc 100644
22 --- c/src/greaseweazle/codec/amiga/amigados.py
23 +++ i/src/greaseweazle/codec/amiga/amigados.py
24 @@ -84,7 +84,7 @@ class AmigaDOS(codec.Codec):
25 clock = self.clock, data = track, pll = pll)
26 bits, _ = raw.get_all_data()
27
28 - for offs in bits.search(sync):
29 + for offs in bits.itersearch(sync):
30
31 if self.nr_missing() == 0:
32 break
33 diff --git c/src/greaseweazle/codec/apple2/apple2_gcr.py i/src/greaseweazle/codec/apple2/apple2_gcr.py
34 index e660e57..7c3913c 100644
35 --- c/src/greaseweazle/codec/apple2/apple2_gcr.py
36 +++ i/src/greaseweazle/codec/apple2/apple2_gcr.py
37 @@ -98,7 +98,7 @@ class Apple2GCR(codec.Codec):
38 lowpass_thresh = 2.5e-6)
39 bits, _ = raw.get_all_data()
40
41 - for offs in bits.search(addr_sync):
42 + for offs in bits.itersearch(addr_sync):
43
44 if self.nr_missing() == 0:
45 break
46 @@ -131,7 +131,7 @@ class Apple2GCR(codec.Codec):
47
48 # Find data
49 offs += 8*8
50 - dat_offs = list(bits[offs:offs+100*8].search(data_sync))
51 + dat_offs = bits[offs:offs+100*8].search(data_sync)
52 if len(dat_offs) != 1:
53 continue
54 offs += dat_offs[0]
55 diff --git c/src/greaseweazle/codec/commodore/c64_gcr.py i/src/greaseweazle/codec/commodore/c64_gcr.py
56 index d40a9ce..9402bb0 100644
57 --- c/src/greaseweazle/codec/commodore/c64_gcr.py
58 +++ i/src/greaseweazle/codec/commodore/c64_gcr.py
59 @@ -94,7 +94,7 @@ class C64GCR(codec.Codec):
60 lowpass_thresh = 2.5e-6)
61 bits, _ = raw.get_all_data()
62
63 - for offs in bits.search(sector_sync):
64 + for offs in bits.itersearch(sector_sync):
65
66 if self.nr_missing() == 0:
67 break
68 @@ -128,7 +128,7 @@ class C64GCR(codec.Codec):
69
70 # Find data
71 offs += 8*8
72 - dat_offs = list(bits[offs:offs+100*8].search(data_sync))
73 + dat_offs = bits[offs:offs+100*8].search(data_sync)
74 if len(dat_offs) != 1:
75 continue
76 offs += dat_offs[0]
77 diff --git c/src/greaseweazle/codec/hp/hp_mmfm.py i/src/greaseweazle/codec/hp/hp_mmfm.py
78 index 63fdc13..c875dde 100644
79 --- c/src/greaseweazle/codec/hp/hp_mmfm.py
80 +++ i/src/greaseweazle/codec/hp/hp_mmfm.py
81 @@ -136,7 +136,7 @@ class HPMMFM(codec.Codec):
82 clock = self.clock, data = track, pll = pll)
83 bits, _ = raw.get_all_data()
84
85 - for offs in bits.search(sector_sync):
86 + for offs in bits.itersearch(sector_sync):
87
88 if self.nr_missing() == 0:
89 break
90 @@ -160,7 +160,7 @@ class HPMMFM(codec.Codec):
91
92 # Find data
93 offs += 8*16
94 - dat_offs = list(bits[offs:offs+50*16].search(data_sync))
95 + dat_offs = bits[offs:offs+50*16].search(data_sync)
96 if len(dat_offs) != 1:
97 continue
98 offs += dat_offs[0] + 2*16
99 diff --git c/src/greaseweazle/codec/ibm/ibm.py i/src/greaseweazle/codec/ibm/ibm.py
100 index 2d8dab7..019e9f1 100644
101 --- c/src/greaseweazle/codec/ibm/ibm.py
102 +++ i/src/greaseweazle/codec/ibm/ibm.py
103 @@ -241,11 +241,11 @@ class DEC_MMFM:
104 pre_bits.frombytes(pre)
105 post_bits = bitarray(endian='big')
106 post_bits.frombytes(mfm_encode(encode(pre)))
107 - for x in pre_bits.search(self.encode_search):
108 + for x in pre_bits.itersearch(self.encode_search):
109 post_bits[x*2+1:x*2+12] = self.encode_replace
110 return post_bits.tobytes()
111 def decode(self, bits: bitarray) -> bytes:
112 - for x in bits.search(self.decode_search):
113 + for x in bits.itersearch(self.decode_search):
114 if x&1 != 0: # Only matches starting on a data bit
115 bits[x:x+3] = self.decode_replace
116 return decode(bits.tobytes())
117 @@ -448,14 +448,14 @@ class IBMTrack(codec.Codec):
118
119 ## 1. Calculate offsets within dump
120
121 - for offs in bits.search(mfm_iam_sync):
122 + for offs in bits.itersearch(mfm_iam_sync):
123 if len(bits) < offs+4*16:
124 continue
125 mark = decode(bits[offs+3*16:offs+4*16].tobytes())[0]
126 if mark == Mark.IAM:
127 areas.append(IAM(offs, offs+4*16))
128
129 - for offs in bits.search(mfm_sync):
130 + for offs in bits.itersearch(mfm_sync):
131
132 if len(bits) < offs+4*16:
133 continue
134 @@ -515,18 +515,18 @@ class IBMTrack(codec.Codec):
135
136 if mmfm_raw is not None:
137 mmfm_bits, mmfm_times = mmfm_raw.get_all_data()
138 - mmfm_iter = mmfm_bits.search(dec_mmfm.sync_prefix)
139 + mmfm_iter = mmfm_bits.itersearch(dec_mmfm.sync_prefix)
140 mmfm_offs = next(mmfm_iter, None)
141 fm_time, prev_fm_offs = 0.0, 0
142 mmfm_time, prev_mmfm_offs = 0.0, 0
143
144 ## 1. Calculate offsets within dump
145
146 - for offs in bits.search(fm_iam_sync):
147 + for offs in bits.itersearch(fm_iam_sync):
148 offs += 16
149 areas.append(IAM(offs, offs+1*16))
150
151 - for offs in bits.search(fm_sync_prefix):
152 + for offs in bits.itersearch(fm_sync_prefix):
153
154 # DEC MMFM track: Ensure this looks like an FM mark even at
155 # double rate. This also finds the equivalent point in the
156 diff --git c/src/greaseweazle/codec/macintosh/mac_gcr.py i/src/greaseweazle/codec/macintosh/mac_gcr.py
157 index 51d09ee..f6448fe 100644
158 --- c/src/greaseweazle/codec/macintosh/mac_gcr.py
159 +++ i/src/greaseweazle/codec/macintosh/mac_gcr.py
160 @@ -101,7 +101,7 @@ class MacGCR(codec.Codec):
161 clock = self.clock, data = track, pll = pll)
162 bits, _ = raw.get_all_data()
163
164 - for offs in bits.search(sector_sync):
165 + for offs in bits.itersearch(sector_sync):
166
167 if self.nr_missing() == 0:
168 break
169 @@ -130,7 +130,7 @@ class MacGCR(codec.Codec):
170
171 # Find data
172 offs += 5*8
173 - dat_offs = list(bits[offs:offs+100*8].search(data_sync))
174 + dat_offs = bits[offs:offs+100*8].search(data_sync)
175 if len(dat_offs) != 1:
176 continue
177 offs += dat_offs[0]
178 diff --git c/src/greaseweazle/codec/northstar/northstar.py i/src/greaseweazle/codec/northstar/northstar.py
179 index 4cbcb37..28970fb 100644
180 --- c/src/greaseweazle/codec/northstar/northstar.py
181 +++ i/src/greaseweazle/codec/northstar/northstar.py
182 @@ -132,9 +132,9 @@ class NorthStar(codec.Codec):
183
184 s, e = hardsector_bits[sec_id], hardsector_bits[sec_id+1]
185 offs = bits[s:e].search(self.sync)
186 - if (off := next(offs, None)) is None:
187 + if len(offs) == 0:
188 continue
189 - off += (1 + self.sync_bytes) * 16
190 + off = offs[0] + (1 + self.sync_bytes) * 16
191 data = decode(bits[s+off:s+off+(self.bps+1)*16].tobytes())
192 if csum(data[:-1]) == data[-1]:
193 self.add(sec_id, data[:-1])
194 diff --git c/src/greaseweazle/image/caps.py i/src/greaseweazle/image/caps.py
195 index e1871c3..928e356 100644
196 --- c/src/greaseweazle/image/caps.py
197 +++ i/src/greaseweazle/image/caps.py
198 @@ -283,7 +283,7 @@ class IPFTrack(MasterTrack):
199 raw_area = raw_bits[max(self.splice + s - self.tolerance, 0)
200 : self.splice + s + l + self.tolerance]
201 # All we care about is at least one match (this is a bit fuzzy)
202 - if next(raw_area.search(sector), None) is None:
203 + if next(raw_area.itersearch(sector), None) is None:
204 return False
205 return True
206
207 diff --git c/src/greaseweazle/image/edsk.py i/src/greaseweazle/image/edsk.py
208 index c78d995..937006c 100644
209 --- c/src/greaseweazle/image/edsk.py
210 +++ i/src/greaseweazle/image/edsk.py
211 @@ -117,8 +117,8 @@ class EDSKTrack:
212 track.verify = self
213 return track
214
215 - def _find_sync(self, bits: bitarray, sync, start) -> Optional[int]:
216 - for offs in bits.search(sync):
217 + def _find_sync(self, bits, sync, start) -> Optional[int]:
218 + for offs in bits.itersearch(sync):
219 if offs >= start:
220 return offs
221 return None
222 diff --git c/src/greaseweazle/track.py i/src/greaseweazle/track.py
223 index cbe7fdd..330488c 100644
224 --- c/src/greaseweazle/track.py
225 +++ i/src/greaseweazle/track.py
226 @@ -59,20 +59,20 @@ class Precomp:
227 scale: float) -> None:
228 t = self.ns * scale
229 if self.type == Precomp.MFM:
230 - for i in bits.search(bitarray('10100', endian='big')):
231 + for i in bits.itersearch(bitarray('10100', endian='big')):
232 bit_ticks[i+2] -= t
233 bit_ticks[i+3] += t
234 - for i in bits.search(bitarray('00101', endian='big')):
235 + for i in bits.itersearch(bitarray('00101', endian='big')):
236 bit_ticks[i+2] += t
237 bit_ticks[i+3] -= t
238 # This is primarily for GCR and FM which permit adjacent 1s (and
239 # have correspondingly slower bit times). However it may be useful
240 # for illegal MFM sequences too, especially on Amiga (custom syncwords,
241 # 4us-bitcell tracks). Normal MFM should not trigger these patterns.
242 - for i in bits.search(bitarray('110', endian='big')):
243 + for i in bits.itersearch(bitarray('110', endian='big')):
244 bit_ticks[i+1] -= t
245 bit_ticks[i+2] += t
246 - for i in bits.search(bitarray('011', endian='big')):
247 + for i in bits.itersearch(bitarray('011', endian='big')):
248 bit_ticks[i+1] += t
249 bit_ticks[i+2] -= t
250