/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 contrib/create_bzr_rollup.py

  • Committer: Jelmer Vernooij
  • Date: 2017-02-05 15:40:43 UTC
  • mto: (6621.2.1 py3)
  • mto: This revision was merged to the branch mainline in revision 6624.
  • Revision ID: jelmer@jelmer.uk-20170205154043-2myaqwz3s0m3jyxl
Apply 2to3 print fix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
        final_path = os.path.join(output_dir, out_name + '.tar.gz')
24
24
        if os.path.exists(final_path):
25
25
                if verbose:
26
 
                        print 'Output file already exists: %r' % final_path
 
26
                        print('Output file already exists: %r' % final_path)
27
27
                return
28
28
        fn, tmp_path=tempfile.mkstemp(suffix='.tar', prefix=out_name, dir=output_dir)
29
29
        os.close(fn)
30
30
        try:
31
31
                if verbose:
32
 
                        print 'Creating %r (%r)' % (final_path, tmp_path)
 
32
                        print('Creating %r (%r)' % (final_path, tmp_path))
33
33
                tar = tarfile.TarFile(name=tmp_path, mode='w')
34
34
                tar.add(local_dir, arcname=out_name, recursive=True)
35
35
                tar.close()
36
36
 
37
37
                if verbose:
38
 
                        print 'Compressing...'
 
38
                        print('Compressing...')
39
39
                if os.system('gzip "%s"' % tmp_path) != 0:
40
40
                        raise ValueError('Failed to compress')
41
41
                tmp_path += '.gz'
51
51
        final_path = os.path.join(output_dir, out_name + '.tar.bz2')
52
52
        if os.path.exists(final_path):
53
53
                if verbose:
54
 
                        print 'Output file already exists: %r' % final_path
 
54
                        print('Output file already exists: %r' % final_path)
55
55
                return
56
56
        fn, tmp_path=tempfile.mkstemp(suffix='.tar', prefix=out_name, dir=output_dir)
57
57
        os.close(fn)
58
58
        try:
59
59
                if verbose:
60
 
                        print 'Creating %r (%r)' % (final_path, tmp_path)
 
60
                        print('Creating %r (%r)' % (final_path, tmp_path))
61
61
                tar = tarfile.TarFile(name=tmp_path, mode='w')
62
62
                tar.add(local_dir, arcname=out_name, recursive=True)
63
63
                tar.close()
64
64
 
65
65
                if verbose:
66
 
                        print 'Compressing...'
 
66
                        print('Compressing...')
67
67
                if os.system('bzip2 "%s"' % tmp_path) != 0:
68
68
                        raise ValueError('Failed to compress')
69
69
                tmp_path += '.bz2'
79
79
        final_path = os.path.join(output_dir, out_name + '.zip')
80
80
        if os.path.exists(final_path):
81
81
                if verbose:
82
 
                        print 'Output file already exists: %r' % final_path
 
82
                        print('Output file already exists: %r' % final_path)
83
83
                return
84
84
        fn, tmp_path=tempfile.mkstemp(suffix='.zip', prefix=out_name, dir=output_dir)
85
85
        os.close(fn)
86
86
        try:
87
87
                if verbose:
88
 
                        print 'Creating %r (%r)' % (final_path, tmp_path)
 
88
                        print('Creating %r (%r)' % (final_path, tmp_path))
89
89
                zip = zipfile.ZipFile(file=tmp_path, mode='w')
90
90
                try:
91
91
                        for root, dirs, files in os.walk(local_dir):
153
153
        else:
154
154
                local = args[1]
155
155
        if len(args) > 2:
156
 
                print 'Invalid number of arguments, see --help for details.'
 
156
                print('Invalid number of arguments, see --help for details.')
157
157
 
158
158
        if not sync(remote, local, verbose=opts.verbose):
159
159
                if opts.verbose:
160
 
                        print '** rsync failed'
 
160
                        print('** rsync failed')
161
161
                return 1
162
162
        # Now we have the new update
163
163
        local_dir = get_local_dir(remote, local)