/stdhome

To get this branch, use:
bzr branch http://bzr.ed.am/stdhome

« back to all changes in this revision

Viewing changes to lib/stdhome/walker/copy_base.py

  • Committer: Tim Marston
  • Date: 2016-02-28 18:26:06 UTC
  • Revision ID: tim@ed.am-20160228182606-7jjvu9mbxppjlqjq
check directories for (permission) changes in copy base walker

Show diffs side-by-side

added added

removed removed

21
21
 
22
22
import filecmp, os, shutil
23
23
from walker import Walker
24
 
import stdhome.the as the
 
24
from stdhome import the
 
25
from stdhome import util
25
26
 
26
27
 
27
28
class CopyBaseWalker( Walker ):
61
62
                        # if dst entity is a directory, copy permissions, as required (and
62
63
                        # recurse)
63
64
                        elif dst.type == 'd':
64
 
                                # TODO: should check permission and only do as necessary
65
 
                                self.print_op( rel_file, 'd', '*', 'd' )
66
 
                                shutil.copystat( src.file, dst.file )
 
65
                                if os.stat( src.file ).st_mode != os.stat( dst.file ).st_mode:
 
66
                                        self.print_op( rel_file, 'd', '*', 'd' )
 
67
                                        shutil.copystat( src.file, dst.file )
 
68
                                else:
 
69
                                        self.print_op( rel_file, 'd', '=', 'd' )
67
70
                                return True
68
71
 
69
72
                        # if dst entity is a symlink to a directory, and this is an