File: py2to3.patch

package info (click to toggle)
boinc 8.2.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 104,688 kB
  • sloc: cpp: 172,875; php: 115,929; pascal: 56,058; xml: 17,863; python: 8,752; javascript: 6,538; sh: 5,343; objc: 2,322; ansic: 2,200; makefile: 2,166; perl: 1,843; sql: 831; java: 429; lisp: 47; csh: 30
file content (227 lines) | stat: -rw-r--r-- 8,121 bytes parent folder | 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
Index: boinc/sched/assimilator.py
===================================================================
--- boinc.orig/sched/assimilator.py
+++ boinc/sched/assimilator.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 '''
 Generic Assimilator framework
 '''
Index: boinc/sched/pymw_assimilator.py
===================================================================
--- boinc.orig/sched/pymw_assimilator.py
+++ boinc/sched/pymw_assimilator.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 
 import boinc_path_config
 from assimilator import *
Index: boinc/sched/start
===================================================================
--- boinc.orig/sched/start
+++ boinc/sched/start
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 
 '''
 A program to start/stop BOINC server daemons and run periodic tasks.
Index: boinc/tools/appmgr
===================================================================
--- boinc.orig/tools/appmgr
+++ boinc/tools/appmgr
@@ -1,4 +1,5 @@
-#! /usr/bin/env python
+#!/usr/bin/python3
+from __future__ import print_function
 #
 # Written by Gabor Gombas <gombasg@sztaki.hu>
 # Licensed under the same terms as the rest of BOINC.
@@ -44,7 +45,7 @@ def remove_app_directory(appver, config)
     """Remove files for an app version under <projectroot>/apps"""
 
     appdir = os.path.join(config.app_dir, appver.app.name)
-    for path in map(lambda file: os.path.join(appdir, file), os.listdir(appdir)):
+    for path in [os.path.join(appdir, file) for file in os.listdir(appdir)]:
         match = re.match('^[^.]+_([0-9]+)[.]([0-9]+)_([^.]+?(?:[0-9][0-9.]*[0-9])?)(?:__([^.])+)?(?:[.][a-zA-Z0-9\_\-]*)?$', os.path.basename(path))
         if not match:
             continue
@@ -96,7 +97,7 @@ def do_delete_app_version(appver):
 
     tmp = str(appver)
     appver.remove()
-    print "Removed " + tmp
+    print("Removed " + tmp)
 
 def add_platform(args):
     usage = """%prog add_platform <name> <user-friendly name>
@@ -113,7 +114,7 @@ Add a new platform definition to the dat
                                  user_friendly_name = extra_args[1],
                                  deprecated = 0)
     platform.commit()
-    print "Added " + str(platform)
+    print("Added " + str(platform))
 
 def del_platform(args):
     usage = """%prog delete_platform <name>
@@ -149,7 +150,7 @@ application version available for this p
     # The id is gone after .remove(), so we have to save the stringified form
     tmp = str(platform)
     platform.remove()
-    print "Deleted " + tmp
+    print("Deleted " + tmp)
 
 def update_platform(args):
     usage = """%prog update_platform <name> [options]
@@ -183,7 +184,7 @@ Update platform data."""
     if options.user_friendly_name:
         platform.user_friendly_name = options.user_friendly_name
     platform.commit()
-    print "Updated " + str(platform)
+    print("Updated " + str(platform))
 
 def list_platform(args):
     usage = """%prog list_platform
@@ -202,12 +203,12 @@ List all defined platforms."""
     database.Platforms.select_args = 'ORDER BY name'
     for platform in database.Platforms.find():
         if options.short:
-            print platform.name
+            print(platform.name)
         else:
             desc = platform.name + ": " + platform.user_friendly_name
             if platform.deprecated:
                 desc += " (Deprecated)"
-            print desc
+            print(desc)
 
 def add_standard_platforms(args):
     usage = """%prog add_standard_platforms
@@ -220,7 +221,7 @@ already exist they will not be modified.
     if extra_args:
         parser.error("Extra arguments on the command line")
 
-    for name in standard_platforms.keys():
+    for name in list(standard_platforms.keys()):
         if database.Platforms.find(name = name):
             continue
         platform = database.Platform(create_time = time.time(),
@@ -228,7 +229,7 @@ already exist they will not be modified.
                                      user_friendly_name = standard_platforms[name],
                                      deprecated = 0)
         platform.commit()
-        print "Added " + str(platform)
+        print("Added " + str(platform))
 
 def add_app(args):
     usage = """%prog add <name> <user-friendly name> [options]
@@ -239,7 +240,7 @@ Register a new application in the databa
 
     parser = OptionParser(usage = usage)
     parser.add_option("--hr",
-                      choices = hr_types.keys(),
+                      choices = list(hr_types.keys()),
                       default = "no",
                       metavar = "(no|fine|coarse)",
                       help = "set the homogeneous redundancy type")
@@ -275,11 +276,11 @@ Register a new application in the databa
                        target_nresults = options.target_nresults)
     try:
         app.commit()
-    except Exception, e:
-        print "Failed to add application"
+    except Exception as e:
+        print("Failed to add application")
         return
 
-    print "Added " + str(app)
+    print("Added " + str(app))
 
 def del_app(args):
     usage = """%prog delete <name> [options]
@@ -330,7 +331,7 @@ are deleted and the application is remov
     if not options.version and not options.platform and not options.plan_class:
         tmp = str(app)
         app.remove()
-        print "Removed " + tmp
+        print("Removed " + tmp)
 
 def update_app(args):
     usage = """%prog update <name> [options]
@@ -341,7 +342,7 @@ Update the properties of the given appli
 
     parser = OptionParser(usage = usage)
     parser.add_option("--hr",
-                      choices = hr_types.keys(),
+                      choices = list(hr_types.keys()),
                       default = "no",
                       metavar = "(no|fine|coarse)",
                       help = "set the homogeneous redundancy type")
@@ -405,7 +406,7 @@ Update the properties of the given appli
         app.deprecated = options.deprecated
 
     app.commit()
-    print "Updated " + str(app)
+    print("Updated " + str(app))
 
 def list_app(args):
     usage = """%prog list
@@ -430,8 +431,8 @@ List all applications and application ve
 
     for app in database.Apps.find():
         title = app.name + ": " + app.user_friendly_name
-        print title
-        print "-" * len(title)
+        print(title)
+        print("-" * len(title))
 
         props = []
         if app.deprecated:
@@ -445,13 +446,13 @@ List all applications and application ve
         props.append("Weight %g." % app.weight)
         if app.target_nresults:
             props.append(str(app.target_nresults) + " adaptive replicas.")
-        print string.join(props, ' ')
+        print(string.join(props, ' '))
 
         if options.no_versions:
-            print
+            print()
             continue
 
-        print "Versions:\n"
+        print("Versions:\n")
         for appver in database.AppVersions.find(app = app):
             desc = "\t%5.2f" % (float(appver.version_num) / 100)
             desc += " " + appver.platform.name
@@ -468,8 +469,8 @@ List all applications and application ve
                              (float(appver.max_core_version) / 100))
             if props:
                 desc += " (" + string.join(props, ' ') + ')'
-            print desc
-        print
+            print(desc)
+        print()
 
 def update_appver(args):
     usage = """%prog update_appver <name> [options]
@@ -534,7 +535,7 @@ then all versions for the given applicat
         if options.max_core_version is not None:
             appver.max_core_version = int(options.max_core_version * 100)
         appver.commit()
-        print "Updated " + str(appver)
+        print("Updated " + str(appver))
 
 command_table = {
     'add': add_app,
@@ -555,7 +556,7 @@ Available commands:
 %s
 
 Use "%%prog <command> --help" to get a description of the command.""" % \
-    string.join(map(lambda x: "\t" + x, sorted(command_table.keys())), "\n")
+    string.join(["\t" + x for x in sorted(command_table.keys())], "\n")
 
 parser = OptionParser(usage=usage)
 parser.disable_interspersed_args()