<commit_before>from __future__ import print_function, unicode_literals

import subprocess

from mach.decorators import (
    CommandArgument,
    CommandProvider,
    Command,
)

from servo.command_base import CommandBase


@CommandProvider
class MachCommands(CommandBase):
    @Command('cargo',
             description='Run Cargo',
             category='devenv',
             allow_all_args=True)
    @CommandArgument(
        'params', default=None, nargs='...',
        help="Command-line arguments to be passed through to Cargo")
    def cargo(self, params):
        return subprocess.call(["cargo"] + params,
                               env=self.build_env())

    @Command('rustc',
             description='Run the Rust compiler',
             category='devenv',
             allow_all_args=True)
    @CommandArgument(
        'params', default=None, nargs='...',
        help="Command-line arguments to be passed through to rustc")
    def rustc(self, params):
        return subprocess.call(["rustc"] + params, env=self.build_env())

    @Command('rust-root',
             description='Print the path to the root of the Rust compiler',
             category='devenv')
    def rust_root(self):
        print(self.config["tools"]["rust-root"])<commit_msg>auto merge of #4045 : mttr/servo/mach_update, r=jdm<commit_after>from __future__ import print_function, unicode_literals
from os import path

import subprocess

from mach.decorators import (
    CommandArgument,
    CommandProvider,
    Command,
)

from servo.command_base import CommandBase, cd


@CommandProvider
class MachCommands(CommandBase):
    @Command('cargo',
             description='Run Cargo',
             category='devenv',
             allow_all_args=True)
    @CommandArgument(
        'params', default=None, nargs='...',
        help="Command-line arguments to be passed through to Cargo")
    def cargo(self, params):
        return subprocess.call(["cargo"] + params,
                               env=self.build_env())

    @Command('update-cargo',
             description='Update Cargo dependencies',
             category='devenv',
             allow_all_args=True)
    @CommandArgument(
        'params', default=None, nargs='...',
        help='Command-line arguments to be passed through to cargo update')
    def update_cargo(self, params):
        cargo_paths = [path.join('.'),
                       path.join('ports', 'cef'),
                       path.join('ports', 'android', 'glut_app')]

        for cargo_path in cargo_paths:
            with cd(cargo_path):
                print(cargo_path)
                subprocess.call(["cargo", "update"] + params,
                                env=self.build_env())

    @Command('rustc',
             description='Run the Rust compiler',
             category='devenv',
             allow_all_args=True)
    @CommandArgument(
        'params', default=None, nargs='...',
        help="Command-line arguments to be passed through to rustc")
    def rustc(self, params):
        return subprocess.call(["rustc"] + params, env=self.build_env())

    @Command('rust-root',
             description='Print the path to the root of the Rust compiler',
             category='devenv')
    def rust_root(self):
        print(self.config["tools"]["rust-root"])
{'fraction_non_alphanumeric': 0.11814601635867919, 'fraction_numerical': 0.0012117540139351712, 'mean_word_length': 2.4111570247933884, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4602986', 'n_tokens_mistral': 909, 'n_tokens_neox': 898, 'n_words': 219}