/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: 2018-06-17 11:15:04 UTC
  • mto: (6973.12.2 python3-k)
  • mto: This revision was merged to the branch mainline in revision 7003.
  • Revision ID: jelmer@jelmer.uk-20180617111504-i2eqvqbtfj5bp0t3
s/file/open.

Show diffs side-by-side

added added

removed removed

Lines of Context:
159
159
    if start_brz:
160
160
        fname = os.path.join(brz_dir, "start_brz.bat")
161
161
        if os.path.isfile(fname):
162
 
            with file(fname, "r") as f:
 
162
            with open(fname, "r") as f:
163
163
                content = f.readlines()
164
164
        else:
165
165
            content = ["brz.exe help\n"]
181
181
            print("*** File content:")
182
182
            print(''.join(content))
183
183
        else:
184
 
            with file(fname, 'w') as f:
 
184
            with open(fname, 'w') as f:
185
185
                f.write(''.join(content))
186
186
 
187
187
    if (add_path or delete_path) and winver == 'Windows NT':
266
266
        pattern = 'SET PATH=%PATH%;' + brz_dir_8_3
267
267
 
268
268
        # search pattern
269
 
        with file(abat, 'r') as f:
 
269
        with open(abat, 'r') as f:
270
270
            lines = f.readlines()
271
271
        found = False
272
272
        for i in lines:
277
277
        if delete_path and found:
278
278
            backup_autoexec_bat(abat, abak, dry_run)
279
279
            if not dry_run:
280
 
                with file(abat, 'w') as f:
 
280
                with open(abat, 'w') as f:
281
281
                    for i in lines:
282
282
                        if i.rstrip('\r\n') != pattern:
283
283
                            f.write(i)
287
287
        elif add_path and not found:
288
288
            backup_autoexec_bat(abat, abak, dry_run)
289
289
            if not dry_run:
290
 
                with file(abat, 'a') as f:
 
290
                with open(abat, 'a') as f:
291
291
                    f.write(pattern)
292
292
                    f.write('\n')
293
293
            else: