Package: owfs / 3.2p3+dfsg1-2

for-upstream-python3-support.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
Fix python syntax to be compatible with python3
--- a/module/swig/python/setup.py.in
+++ b/module/swig/python/setup.py.in
@@ -21,6 +21,9 @@
 project.
 """
 
+# allows one to use the python3 syntax for print()
+from __future__ import print_function
+
 import os
 # platform doesn't exist for python 2.2
 #import platform
@@ -59,15 +62,15 @@
                         runtime_library_dirs,extra_objects):    
     #Write the compilation configuration into a file
     out=open('configuration.log','w')
-    print >> out, "Current configuration"
-    print >> out, "libraries", libraries
-    print >> out, "library_dirs", library_dirs
-    print >> out, "include_dirs", include_dirs
-    print >> out, "define_macros", define_macros
-    print >> out, "extra_link_args", extra_link_args
-    print >> out, "extra_compile_args", extra_compile_args
-    print >> out, "runtime_library_dirs", runtime_library_dirs
-    print >> out, "extra_objects", extra_objects
+    print("Current configuration", file=out)
+    print("libraries", libraries, file=out)
+    print("library_dirs", library_dirs, file=out)
+    print("include_dirs", include_dirs, file=out)
+    print("define_macros", define_macros, file=out)
+    print("extra_link_args", extra_link_args, file=out)
+    print("extra_compile_args", extra_compile_args, file=out)
+    print("runtime_library_dirs", runtime_library_dirs, file=out)
+    print("extra_objects", extra_objects, file=out)
     out.close()
 
 have_darwin = '@HAVE_DARWIN@'
--- a/module/ownet/python/ownet/__init__.py
+++ b/module/ownet/python/ownet/__init__.py
@@ -248,7 +248,7 @@
             #print 'Sensor.__getattr__(%s)' % name
             attr = self._connection.read(object.__getattribute__(self, '_attrs')[name])
         except:
-            raise AttributeError, name
+            raise AttributeError(name)
 
         return attr
 
@@ -379,7 +379,7 @@
                         # print 'branch_entry(%s)' % str(branch_entry)
                         try:
                             self._connection.read(branch_entry + '/type')
-                        except exUnknownSensor, ex:
+                        except exUnknownSensor as ex:
                             continue
                         yield Sensor(branch_entry, connection=self._connection)
 
--- a/module/ownet/python/ownet/connection.py
+++ b/module/ownet/python/ownet/connection.py
@@ -224,7 +224,7 @@
 
         #print 'Connection.unpack("%s")' % msg
         if len(msg) is not 24:
-            raise exInvalidMessage, msg
+            raise exInvalidMessage(msg)
 
         val          = struct.unpack('iiiiii', msg)
         version      = socket.ntohl(val[0])
--- a/module/ownet/ruby/sensor.rb
+++ b/module/ownet/ruby/sensor.rb
@@ -51,17 +51,17 @@
         if @attrs.include? name
           @connection.read(@attrs[name])
         else
-          raise AttributeError, name
+          raise AttributeError(name)
         end
       elsif name[-1] == "="[0] and args.size == 1
         name = name.to_s[0..-2]
         if @attrs.include? name
           @connection.write(@attrs[name], args[0])
         else
-          raise AttributeError, name
+          raise AttributeError(name)
         end
       else
-        raise NoMethodError, "undefined method \"#{name}\" for #{self}:#{self.class}"
+        raise NoMethodError("undefined method \"#{name}\" for #{self}:#{self.class}")
       end
     end
     
--- a/module/swig/python/ow/__init__.py
+++ b/module/swig/python/ow/__init__.py
@@ -343,7 +343,7 @@
         try:
             return owfs_get(object.__getattribute__(self, '_attrs')[name])
         except KeyError:
-            raise AttributeError, name
+            raise AttributeError(name)
 
 
     def __setattr__( self, name, value ):
@@ -424,7 +424,7 @@
             for entry in list.split( ',' ):
                 try:
                     owfs_get(entry + 'type')
-                except exUnknownSensor, ex:
+                except exUnknownSensor as ex:
                     yield entry.split( '/' )[ 0 ]
 
 
@@ -464,14 +464,14 @@
                 path = self._usePath + '/' + branch
                 try:
                     list = owfs_get( path )
-                except exUnknownSensor, ex:
+                except exUnknownSensor as ex:
                     continue
                 if list:
                     for branch_entry in list.split( ',' ):
                         branch_path = self._usePath + '/' + branch + '/' + branch_entry.split( '/' )[ 0 ]
                         try:
                             owfs_get( branch_path + '/type' )
-                        except exUnknownSensor, ex:
+                        except exUnknownSensor as ex:
                             continue
                         yield Sensor( branch_path )
 
@@ -481,7 +481,7 @@
                 for branch_entry in list.split( ',' ):
                     try:
                         owfs_get( branch_entry + 'type' )
-                    except exUnknownSensor, ex:
+                    except exUnknownSensor as ex:
                         continue
                     path = self._usePath + '/' + branch_entry.split( '/' )[ 0 ]
                     if path[ :2 ] == '//':
--- a/module/swig/python/unittest/ds1420.py
+++ b/module/swig/python/unittest/ds1420.py
@@ -35,7 +35,7 @@
 __version__ = '0.0'
 
 if not os.path.exists( 'owtest.ini' ):
-    raise IOError, 'owtest.ini'
+    raise IOError('owtest.ini')
 
 config = ConfigParser.ConfigParser( )
 config.read( 'owtest.ini' )
--- a/module/swig/python/unittest/ds2408.py
+++ b/module/swig/python/unittest/ds2408.py
@@ -43,7 +43,7 @@
 
 
 if not os.path.exists( 'owtest.ini' ):
-    raise IOError, 'owtest.ini'
+    raise IOError('owtest.ini')
 
 config = ConfigParser.ConfigParser( )
 config.read( 'owtest.ini' )
--- a/module/swig/python/unittest/ds2409.py
+++ b/module/swig/python/unittest/ds2409.py
@@ -36,7 +36,7 @@
 __version__ = '0.0'
 
 if not os.path.exists( 'owtest.ini' ):
-    raise IOError, 'owtest.ini'
+    raise IOError('owtest.ini')
 
 config = ConfigParser.ConfigParser( )
 config.read( 'owtest.ini' )
--- a/module/swig/python/unittest/owload.py
+++ b/module/swig/python/unittest/owload.py
@@ -37,7 +37,7 @@
 class OWLoad( unittest.TestCase ):
     def setUp( self ):
         if not os.path.exists( 'owtest.ini' ):
-            raise IOError, 'owtest.ini'
+            raise IOError('owtest.ini')
 
         self.config = ConfigParser.ConfigParser( )
         self.config.read( 'owtest.ini' )
--- a/module/swig/python/unittest/owsensors.py
+++ b/module/swig/python/unittest/owsensors.py
@@ -38,7 +38,7 @@
     def setUp( self ):
         #print 'OWSensors.setup'
         if not os.path.exists( 'owtest.ini' ):
-            raise IOError, 'owtest.ini'
+            raise IOError('owtest.ini')
 
         self.config = ConfigParser.ConfigParser( )
         self.config.read( 'owtest.ini' )
--- a/module/ownet/python/examples/check_ow.py
+++ b/module/ownet/python/examples/check_ow.py
@@ -41,10 +41,10 @@
 
 try:
     s = ownet.Sensor(path, server=server, port=port)
-except ownet.exUnknownSensor, ex:
+except ownet.exUnknownSensor as ex:
     print 'OW ' + nagios.unknown[1] + ' - unknown sensor ' + str(ex)
     sys.exit(nagios.unknown[0])
-except socket.error, ex:
+except socket.error as ex:
     print 'OW ' + nagios.unknown[1] + ' - communication error ' + str(ex)
     sys.exit(nagios.unknown[0])
 
--- a/module/swig/python/examples/check_ow.py
+++ b/module/swig/python/examples/check_ow.py
@@ -59,7 +59,7 @@
 try:
     ow.error_print(ow.error_print.suppressed) # needed to exclude debug output which confuses nagios
     ow.init(init)
-except ow.exUnknownSensor, ex:
+except ow.exUnknownSensor as ex:
     exit(nagios.unknown[0], 'unable to initialize sensor adapter ' + str(ex))
 
 
@@ -72,7 +72,7 @@
 
 try:
     s = ow.Sensor(sensor)
-except ow.exUnknownSensor, ex:
+except ow.exUnknownSensor as ex:
     exit(nagios.unknown, 'unknown sensor ' + str(ex))