mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Auto merge of #6136 - r0e:master, r=mbrubeck
Fixes issue #6112 update-cargo and cargo-update both require that the user specifies the "-p" flag along with a specified package OR specify the "-a" flag to update all packages. Let me know if this is not the right functionality. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6136) <!-- Reviewable:end -->
This commit is contained in:
commit
c981e9b2e3
1 changed files with 25 additions and 3 deletions
|
@ -2,6 +2,7 @@ from __future__ import print_function, unicode_literals
|
|||
from os import path, getcwd, listdir
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from mach.decorators import (
|
||||
CommandArgument,
|
||||
|
@ -37,8 +38,14 @@ class MachCommands(CommandBase):
|
|||
@CommandArgument(
|
||||
'params', default=None, nargs='...',
|
||||
help='Command-line arguments to be passed through to cargo update')
|
||||
def cargo_update(self, params=None):
|
||||
self.update_cargo(params)
|
||||
@CommandArgument(
|
||||
'--package', '-p', default=None,
|
||||
help='Updates selected package')
|
||||
@CommandArgument(
|
||||
'--all-packages','-a',action='store_true',
|
||||
help='Updates all packages')
|
||||
def cargo_update(self, params=None, package=None, all_packages=None):
|
||||
self.update_cargo(params, package, all_packages)
|
||||
|
||||
@Command('update-cargo',
|
||||
description='Update Cargo dependencies',
|
||||
|
@ -46,10 +53,25 @@ class MachCommands(CommandBase):
|
|||
@CommandArgument(
|
||||
'params', default=None, nargs='...',
|
||||
help='Command-line arguments to be passed through to cargo update')
|
||||
def update_cargo(self, params=None):
|
||||
@CommandArgument(
|
||||
'--package','-p',default=None,
|
||||
help='Updates selected package')
|
||||
@CommandArgument(
|
||||
'--all-packages','-a',action='store_true',
|
||||
help='Updates all packages')
|
||||
def update_cargo(self, params=None, package=None, all_packages=None):
|
||||
if not params:
|
||||
params = []
|
||||
|
||||
if package:
|
||||
params += ["-p", package]
|
||||
elif all_packages:
|
||||
params = []
|
||||
else:
|
||||
print("Please choose package to update with the --package (-p) ")
|
||||
print("flag or update all packages with --all-packages (-a) flag")
|
||||
sys.exit(1)
|
||||
|
||||
cargo_paths = [path.join('components', 'servo'),
|
||||
path.join('ports', 'cef'),
|
||||
path.join('ports', 'gonk')]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue