Exemple #1
0
    def main(self, package):
        """Run the command.

        Args:
            package (unicode):
                The name of the package to install.

        Raises:
            rbtools.commands.CommandError:
                An error occurred during installation.
        """
        try:
            url = self.package_urls[package]
        except KeyError:
            err = 'Package "%s" not found. Available packages are:\n' % package
            err += '\n'.join(
                '    %s' % package_name
                for package_name in self.package_urls.keys()
            )

            raise CommandError(err)

        label = 'Downloading %s' % package

        zip_filename = self.download_file(url, label=label)

        try:
            self.check_download(url, zip_filename)
            self.unzip(
                zip_filename,
                os.path.join(user_data_dir('rbtools'), 'packages', package))
        finally:
            os.unlink(zip_filename)
Exemple #2
0
    def main(self, package):
        """Run the command.

        Args:
            package (unicode):
                The name of the package to install.

        Raises:
            rbtools.commands.CommandError:
                An error occurred during installation.
        """
        try:
            url = self.package_urls[package]
        except KeyError:
            err = 'Package "%s" not found. Available packages are:\n' % package
            err += '\n'.join('    %s' % package_name
                             for package_name in self.package_urls.keys())

            raise CommandError(err)

        label = 'Downloading %s' % package

        zip_filename = self.download_file(url, label=label)

        try:
            self.check_download(url, zip_filename)
            self.unzip(
                zip_filename,
                os.path.join(user_data_dir('rbtools'), 'packages', package))
        finally:
            os.unlink(zip_filename)
Exemple #3
0
    def __init__(self, config=None, options=None):
        """Initialize the client.

        Args:
            config (dict, optional):
                The loaded configuration.

            options (argparse.Namespace, optional):
                The command-line options.
        """
        super(TFSClient, self).__init__(config, options)

        # There are three different backends that can be used to access the
        # underlying TFS repository. We try them in this order:
        #     - VS2017+ tf.exe
        #     - Our custom rb-tfs wrapper, built on the TFS Java SDK
        #     - Team Explorer Everywhere's tf command
        try:
            tf_vc_output = execute(['tf', 'vc', 'help'], ignore_errors=True,
                                   none_on_ignored_error=True)
        except OSError:
            tf_vc_output = None

        helper_path = os.path.join(user_data_dir('rbtools'), 'packages', 'tfs',
                                   'rb-tfs.jar')

        if tf_vc_output is not None:
            self.tf_wrapper = TFExeWrapper(config, options)
        elif os.path.exists(helper_path):
            self.tf_wrapper = TFHelperWrapper(helper_path, config, options)
        else:
            self.tf_wrapper = TEEWrapper(config, options)
Exemple #4
0
    def __init__(self, config=None, options=None):
        """Initialize the client.

        Args:
            config (dict, optional):
                The loaded configuration.

            options (argparse.Namespace, optional):
                The command-line options.
        """
        super(TFSClient, self).__init__(config, options)

        helper_path = os.path.join(user_data_dir('rbtools'), 'packages', 'tfs',
                                   'rb-tfs.jar')

        if os.path.exists(helper_path):
            self.tf_wrapper = TFHelperWrapper(helper_path, config, options)
        else:
            self.tf_wrapper = TEEWrapper(config, options)
Exemple #5
0
    def __init__(self, config=None, options=None):
        """Initialize the client.

        Args:
            config (dict, optional):
                The loaded configuration.

            options (argparse.Namespace, optional):
                The command-line options.
        """
        super(TFSClient, self).__init__(config, options)

        helper_path = os.path.join(user_data_dir('rbtools'), 'packages', 'tfs',
                                   'rb-tfs.jar')

        if os.path.exists(helper_path):
            self.tf_wrapper = TFHelperWrapper(helper_path, config, options)
        else:
            self.tf_wrapper = TEEWrapper(config, options)
Exemple #6
0
    def __init__(self, config=None, options=None):
        """Initialize the client.

        Args:
            config (dict, optional):
                The loaded configuration.

            options (argparse.Namespace, optional):
                The command line options.
        """
        super(TFSClient, self).__init__(config, options)

        # There are three different backends that can be used to access the
        # underlying TFS repository. We try them in this order:
        #     - VS2017+ tf.exe
        #     - Our custom rb-tfs wrapper, built on the TFS Java SDK
        #     - Team Explorer Everywhere's tf command
        use_tf_exe = False

        try:
            tf_vc_output = execute(['tf', 'vc', 'help'], ignore_errors=True,
                                   none_on_ignored_error=True)

            # VS2015 has a tf.exe but it's not good enough.
            if (tf_vc_output and
                'Version Control Tool, Version 15' in tf_vc_output):
                use_tf_exe = True
        except OSError:
            pass

        helper_path = os.path.join(user_data_dir('rbtools'), 'packages', 'tfs',
                                   'rb-tfs.jar')

        if use_tf_exe:
            self.tf_wrapper = TFExeWrapper(config, options)
        elif os.path.exists(helper_path):
            self.tf_wrapper = TFHelperWrapper(helper_path, config, options)
        else:
            self.tf_wrapper = TEEWrapper(config, options)