Esempio n. 1
0
    def run(self, args):
        """Run 'clone' subcommand."""
        optparser = CloneOptions(go_args=args, usage=self.usage_txt)
        if len(optparser.args) < 3:
            sys.stderr.write(self.usage())
            sys.exit(1)

        dist = optparser.args[1]
        output_dir = optparser.args[2]

        if os.path.exists(output_dir):
            sys.stderr.write('Error: Output directory exists: "%s"\n' % output_dir)
            sys.exit(1)

        try:
            dists_dir = hcc.resolve_dists_dir()
            src = os.path.join(dists_dir, dist)
            if not os.path.exists(src):
                sys.stderr.write('Error: Input dist not found: "%s".\n' % dist)
                sys.exit(1)
            shutil.copytree(src, output_dir)
            return 0
        except Exception as err:
            _log.error("Failed to copy dist: %s", str(err))
            _log.exception("hod clone failed")
            sys.exit(1)
Esempio n. 2
0
    def run(self, args):
        """Run 'clone' subcommand."""
        optparser = CloneOptions(go_args=args, usage=self.usage_txt)
        if len(optparser.args) < 3:
            sys.stderr.write(self.usage())
            sys.exit(1)

        dist = optparser.args[1]
        output_dir = optparser.args[2]

        if os.path.exists(output_dir):
            sys.stderr.write('Error: Output directory exists: "%s"\n' % output_dir)
            sys.exit(1)

        try:
            dists_dir = hcc.resolve_dists_dir()
            src = os.path.join(dists_dir, dist)
            if not os.path.exists(src):
                sys.stderr.write('Error: Input dist not found: "%s".\n' % dist)
                sys.exit(1)
            shutil.copytree(src, output_dir)
        except StandardError as err:
            self._log_and_raise(err)

        return 0
Esempio n. 3
0
    def run(self, args):
        """Run 'clone' subcommand."""
        optparser = CloneOptions(go_args=args, usage=self.usage_txt)
        if len(optparser.args) < 3:
            sys.stderr.write(self.usage())
            sys.exit(1)

        dist = optparser.args[1]
        output_dir = optparser.args[2]

        if os.path.exists(output_dir):
            sys.stderr.write('Error: Output directory exists: "%s"\n' %
                             output_dir)
            sys.exit(1)

        try:
            dists_dir = hcc.resolve_dists_dir()
            src = os.path.join(dists_dir, dist)
            if not os.path.exists(src):
                sys.stderr.write('Error: Input dist not found: "%s".\n' % dist)
                sys.exit(1)
            shutil.copytree(src, output_dir)
        except StandardError as err:
            self._log_and_raise(err)

        return 0
 def test_avail_dists(self):
     self.assertEqual(hcc.avail_dists(), sorted(os.listdir(hcc.resolve_dists_dir())))