/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to tools/win32/brz_postinstall.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-22 00:56:52 UTC
  • mfrom: (6621.2.26 py3_pokes)
  • Revision ID: jelmer@jelmer.uk-20170522005652-yjahcr9hwmjkno7n
Merge Python3 porting work ('py3 pokes')

Show diffs side-by-side

added added

removed removed

Lines of Context:
119
119
 
120
120
        for o, a in opts:
121
121
            if o in ("-h", "--help"):
122
 
                print USAGE
 
122
                print(USAGE)
123
123
                return OK
124
124
            elif o in ("-v", "--version"):
125
 
                print VERSION_FORMAT % (USAGE.splitlines()[0], VERSION)
 
125
                print(VERSION_FORMAT % (USAGE.splitlines()[0], VERSION))
126
126
                return OK
127
127
 
128
128
            elif o in ('-n', "--dry-run"):
143
143
            elif o == "--check-mfc71":
144
144
                check_mfc71 = True
145
145
 
146
 
    except getopt.GetoptError, msg:
147
 
        print str(msg)
148
 
        print USAGE
 
146
    except getopt.GetoptError as msg:
 
147
        print(str(msg))
 
148
        print(USAGE)
149
149
        return ERROR
150
150
 
151
151
    # message box from Win32API
178
178
                                        brz_dir)
179
179
 
180
180
        if dry_run:
181
 
            print "*** Write file: start_brz.bat"
182
 
            print "*** File content:"
183
 
            print ''.join(content)
 
181
            print("*** Write file: start_brz.bat")
 
182
            print("*** File content:")
 
183
            print(''.join(content))
184
184
        else:
185
185
            f = file(fname, 'w')
186
186
            f.write(''.join(content))
214
214
            break
215
215
 
216
216
        if hkey is None:
217
 
            print "Cannot find appropriate registry key for PATH"
 
217
            print("Cannot find appropriate registry key for PATH")
218
218
        else:
219
219
            path_list = [i for i in path_u.split(os.pathsep) if i != '']
220
220
            f_change = False
224
224
                        del path_list[ix]
225
225
                        f_change = True
226
226
                    elif add_path:
227
 
                        print "*** Brz already in PATH"
 
227
                        print("*** brz already in PATH")
228
228
                    break
229
229
            else:
230
230
                if add_path and not delete_path:
234
234
            if f_change:
235
235
                path_u = os.pathsep.join(path_list)
236
236
                if dry_run:
237
 
                    print "*** Registry key %s\\%s" % (hkey_str[key], subkey)
238
 
                    print "*** Modify PATH variable. New value:"
239
 
                    print path_u
 
237
                    print("*** Registry key %s\\%s" % (hkey_str[key], subkey))
 
238
                    print("*** Modify PATH variable. New value:")
 
239
                    print(path_u)
240
240
                else:
241
241
                    _winreg.SetValueEx(hkey, 'Path', 0, type_, path_u)
242
242
                    _winreg.FlushKey(hkey)
257
257
                if not dry_run:
258
258
                    shutil.copyfile(name, backupname)
259
259
                else:
260
 
                    print '*** backup copy of autoexec.bat created'
 
260
                    print('*** backup copy of autoexec.bat created')
261
261
 
262
262
        GetShortPathName = ctypes.windll.kernel32.GetShortPathNameA
263
263
        buf = ctypes.create_string_buffer(260)
286
286
                        f.write(i)
287
287
                f.close()
288
288
            else:
289
 
                print '*** Remove line <%s> from autoexec.bat' % pattern
 
289
                print('*** Remove line <%s> from autoexec.bat' % pattern)
290
290
                    
291
291
        elif add_path and not found:
292
292
            backup_autoexec_bat(abat, abak, dry_run)
296
296
                f.write('\n')
297
297
                f.close()
298
298
            else:
299
 
                print '*** Add line <%s> to autoexec.bat' % pattern
 
299
                print('*** Add line <%s> to autoexec.bat' % pattern)
300
300
 
301
301
    if add_shell_menu and not delete_shell_menu:
302
302
        hkey = None