예제 #1
0
파일: install.py 프로젝트: clach04/rbtools
    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)
예제 #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)
예제 #3
0
파일: tfs.py 프로젝트: totoroliu/rbtools
    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)
예제 #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)
예제 #5
0
파일: tfs.py 프로젝트: abaelhe/rbtools
    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)
예제 #6
0
파일: tfs.py 프로젝트: reviewboard/rbtools
    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)