~longsleep/snapcraft/snapcraft-debs-plugin

« back to all changes in this revision

Viewing changes to snapcraft/plugins/copy.py

  • Committer: Snappy Tarmac
  • Author(s): Sergio Schvezov
  • Date: 2015-10-26 15:25:06 UTC
  • mfrom: (250.2.4 work)
  • Revision ID: snappy_tarmac-20151026152506-7hqsn1kftvqcuncl
Plugins raise exception instead of true/false by sergiusens approved by elopio

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
        }
40
40
 
41
41
    def build(self):
42
 
        res = True
43
42
        for src in sorted(self.options.files):
44
43
            dst = self.options.files[src]
45
44
            if not os.path.lexists(src):
46
 
                logger.warning("WARNING: file '%s' missing", src)
47
 
                res = False
48
 
                continue
 
45
                raise EnvironmentError('file "{}" missing'.format(src))
49
46
            dst = os.path.join(self.installdir, dst)
50
 
            dst_dir = os.path.dirname(dst)
51
 
            if not os.path.exists(dst_dir):
52
 
                os.makedirs(dst_dir)
53
 
            res &= self.run(["cp", "--preserve=all", "-R", src, dst],
54
 
                            cwd=os.getcwd())
55
 
        return res
 
47
            os.makedirs(os.path.dirname(dst), exist_ok=True)
 
48
            self.run(["cp", "--preserve=all", "-R", src, dst],
 
49
                     cwd=os.getcwd())