(self)
Write changed .pth file back to disk
Write changed .pth file back to disk
Write changed . pth file back to disk
def save(self):
        """Write changed .pth file back to disk"""
        if not self.dirty:
            return

        rel_paths = list(map(self.make_relative, self.paths))
        if rel_paths:
            log.debug("Saving %s", self.filename)
            lines = self._wrap_lines(rel_paths)
            data = '\n'.join(lines) + '\n'

            if os.path.islink(self.filename):
                os.unlink(self.filename)
            with open(self.filename, 'wt') as f:
                f.write(data)

        elif os.path.exists(self.filename):
            log.debug("Deleting empty %s", self.filename)
            os.unlink(self.filename)

        self.dirty = False
def save ( self ) : if not self . dirty : return rel_paths = list ( map ( self . make_relative , self . paths ) ) if rel_paths : log . debug ( "Saving %s" , self . filename ) lines = self . _wrap_lines ( rel_paths ) data = '\n' . join ( lines ) + '\n' if os . path . islink ( self . filename ) : os . unlink ( self . filename ) with open ( self . filename , 'wt' ) as f : f . write ( data ) elif os . path . exists ( self . filename ) : log . debug ( "Deleting empty %s" , self . filename ) os . unlink ( self . filename ) self . dirty = False