nkjnm

Dependencies:   MAX44000 nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Committer:
nexpaq
Date:
Sat Sep 17 16:32:05 2016 +0000
Revision:
1:55a6170b404f
checking in for sharing

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nexpaq 1:55a6170b404f 1 """
nexpaq 1:55a6170b404f 2 mbed SDK
nexpaq 1:55a6170b404f 3 Copyright (c) 2011-2013 ARM Limited
nexpaq 1:55a6170b404f 4
nexpaq 1:55a6170b404f 5 Licensed under the Apache License, Version 2.0 (the "License");
nexpaq 1:55a6170b404f 6 you may not use this file except in compliance with the License.
nexpaq 1:55a6170b404f 7 You may obtain a copy of the License at
nexpaq 1:55a6170b404f 8
nexpaq 1:55a6170b404f 9 http://www.apache.org/licenses/LICENSE-2.0
nexpaq 1:55a6170b404f 10
nexpaq 1:55a6170b404f 11 Unless required by applicable law or agreed to in writing, software
nexpaq 1:55a6170b404f 12 distributed under the License is distributed on an "AS IS" BASIS,
nexpaq 1:55a6170b404f 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
nexpaq 1:55a6170b404f 14 See the License for the specific language governing permissions and
nexpaq 1:55a6170b404f 15 limitations under the License.
nexpaq 1:55a6170b404f 16
nexpaq 1:55a6170b404f 17
nexpaq 1:55a6170b404f 18 One repository to update them all
nexpaq 1:55a6170b404f 19 On mbed.org the mbed SDK is split up in multiple repositories, this script takes
nexpaq 1:55a6170b404f 20 care of updating them all.
nexpaq 1:55a6170b404f 21 """
nexpaq 1:55a6170b404f 22 import sys
nexpaq 1:55a6170b404f 23 from copy import copy
nexpaq 1:55a6170b404f 24 from os import walk, remove, makedirs
nexpaq 1:55a6170b404f 25 from os.path import join, abspath, dirname, relpath, exists, isfile
nexpaq 1:55a6170b404f 26 from shutil import copyfile
nexpaq 1:55a6170b404f 27 from optparse import OptionParser
nexpaq 1:55a6170b404f 28 import re
nexpaq 1:55a6170b404f 29 import string
nexpaq 1:55a6170b404f 30
nexpaq 1:55a6170b404f 31 ROOT = abspath(join(dirname(__file__), ".."))
nexpaq 1:55a6170b404f 32 sys.path.insert(0, ROOT)
nexpaq 1:55a6170b404f 33
nexpaq 1:55a6170b404f 34 from tools.settings import MBED_ORG_PATH, MBED_ORG_USER, BUILD_DIR
nexpaq 1:55a6170b404f 35 from tools.paths import *
nexpaq 1:55a6170b404f 36 from tools.utils import run_cmd
nexpaq 1:55a6170b404f 37
nexpaq 1:55a6170b404f 38 MBED_URL = "mbed.org"
nexpaq 1:55a6170b404f 39 MBED_USER = "mbed_official"
nexpaq 1:55a6170b404f 40
nexpaq 1:55a6170b404f 41 changed = []
nexpaq 1:55a6170b404f 42 push_remote = True
nexpaq 1:55a6170b404f 43 quiet = False
nexpaq 1:55a6170b404f 44 commit_msg = ''
nexpaq 1:55a6170b404f 45
nexpaq 1:55a6170b404f 46 # Code that does have a mirror in the mbed SDK
nexpaq 1:55a6170b404f 47 # Tuple data: (repo_name, list_of_code_dirs, [team])
nexpaq 1:55a6170b404f 48 # team is optional - if not specified, the code is published under mbed_official
nexpaq 1:55a6170b404f 49 OFFICIAL_CODE = (
nexpaq 1:55a6170b404f 50 ("mbed-dev" , MBED_BASE),
nexpaq 1:55a6170b404f 51 ("mbed-rtos", RTOS),
nexpaq 1:55a6170b404f 52 ("mbed-dsp" , DSP),
nexpaq 1:55a6170b404f 53 ("mbed-rpc" , MBED_RPC),
nexpaq 1:55a6170b404f 54
nexpaq 1:55a6170b404f 55 ("lwip" , LWIP_SOURCES+"/lwip"),
nexpaq 1:55a6170b404f 56 ("lwip-sys", LWIP_SOURCES+"/lwip-sys"),
nexpaq 1:55a6170b404f 57 ("Socket" , LWIP_SOURCES+"/Socket"),
nexpaq 1:55a6170b404f 58
nexpaq 1:55a6170b404f 59 ("lwip-eth" , ETH_SOURCES+"/lwip-eth"),
nexpaq 1:55a6170b404f 60 ("EthernetInterface", ETH_SOURCES+"/EthernetInterface"),
nexpaq 1:55a6170b404f 61
nexpaq 1:55a6170b404f 62 ("USBDevice", USB),
nexpaq 1:55a6170b404f 63 ("USBHost" , USB_HOST),
nexpaq 1:55a6170b404f 64
nexpaq 1:55a6170b404f 65 ("CellularModem", CELLULAR_SOURCES),
nexpaq 1:55a6170b404f 66 ("CellularUSBModem", CELLULAR_USB_SOURCES),
nexpaq 1:55a6170b404f 67 ("UbloxUSBModem", UBLOX_SOURCES),
nexpaq 1:55a6170b404f 68 ("UbloxModemHTTPClientTest", [TEST_DIR+"/net/cellular/http/common", TEST_DIR+"/net/cellular/http/ubloxusb"]),
nexpaq 1:55a6170b404f 69 ("UbloxModemSMSTest", [TEST_DIR+"/net/cellular/sms/common", TEST_DIR+"/net/cellular/sms/ubloxusb"]),
nexpaq 1:55a6170b404f 70 ("FATFileSystem", FAT_FS, "mbed-official"),
nexpaq 1:55a6170b404f 71 )
nexpaq 1:55a6170b404f 72
nexpaq 1:55a6170b404f 73
nexpaq 1:55a6170b404f 74 # Code that does have dependencies to libraries should point to
nexpaq 1:55a6170b404f 75 # the latest revision. By default, they point to a specific revision.
nexpaq 1:55a6170b404f 76 CODE_WITH_DEPENDENCIES = (
nexpaq 1:55a6170b404f 77 # Libraries
nexpaq 1:55a6170b404f 78 "EthernetInterface",
nexpaq 1:55a6170b404f 79
nexpaq 1:55a6170b404f 80 # RTOS Examples
nexpaq 1:55a6170b404f 81 "rtos_basic",
nexpaq 1:55a6170b404f 82 "rtos_isr",
nexpaq 1:55a6170b404f 83 "rtos_mail",
nexpaq 1:55a6170b404f 84 "rtos_mutex",
nexpaq 1:55a6170b404f 85 "rtos_queue",
nexpaq 1:55a6170b404f 86 "rtos_semaphore",
nexpaq 1:55a6170b404f 87 "rtos_signals",
nexpaq 1:55a6170b404f 88 "rtos_timer",
nexpaq 1:55a6170b404f 89
nexpaq 1:55a6170b404f 90 # Net Examples
nexpaq 1:55a6170b404f 91 "TCPEchoClient",
nexpaq 1:55a6170b404f 92 "TCPEchoServer",
nexpaq 1:55a6170b404f 93 "TCPSocket_HelloWorld",
nexpaq 1:55a6170b404f 94 "UDPSocket_HelloWorld",
nexpaq 1:55a6170b404f 95 "UDPEchoClient",
nexpaq 1:55a6170b404f 96 "UDPEchoServer",
nexpaq 1:55a6170b404f 97 "BroadcastReceive",
nexpaq 1:55a6170b404f 98 "BroadcastSend",
nexpaq 1:55a6170b404f 99
nexpaq 1:55a6170b404f 100 # mbed sources
nexpaq 1:55a6170b404f 101 "mbed-src-program",
nexpaq 1:55a6170b404f 102 )
nexpaq 1:55a6170b404f 103
nexpaq 1:55a6170b404f 104 # A list of regular expressions that will be checked against each directory
nexpaq 1:55a6170b404f 105 # name and skipped if they match.
nexpaq 1:55a6170b404f 106 IGNORE_DIRS = (
nexpaq 1:55a6170b404f 107 )
nexpaq 1:55a6170b404f 108
nexpaq 1:55a6170b404f 109 IGNORE_FILES = (
nexpaq 1:55a6170b404f 110 'COPYING',
nexpaq 1:55a6170b404f 111 '\.md',
nexpaq 1:55a6170b404f 112 "\.lib",
nexpaq 1:55a6170b404f 113 "\.bld"
nexpaq 1:55a6170b404f 114 )
nexpaq 1:55a6170b404f 115
nexpaq 1:55a6170b404f 116 def ignore_path(name, reg_exps):
nexpaq 1:55a6170b404f 117 for r in reg_exps:
nexpaq 1:55a6170b404f 118 if re.search(r, name):
nexpaq 1:55a6170b404f 119 return True
nexpaq 1:55a6170b404f 120 return False
nexpaq 1:55a6170b404f 121
nexpaq 1:55a6170b404f 122 class MbedRepository:
nexpaq 1:55a6170b404f 123 @staticmethod
nexpaq 1:55a6170b404f 124 def run_and_print(command, cwd):
nexpaq 1:55a6170b404f 125 stdout, _, _ = run_cmd(command, work_dir=cwd, redirect=True)
nexpaq 1:55a6170b404f 126 print(stdout)
nexpaq 1:55a6170b404f 127
nexpaq 1:55a6170b404f 128 def __init__(self, name, team = None):
nexpaq 1:55a6170b404f 129 self.name = name
nexpaq 1:55a6170b404f 130 self.path = join(MBED_ORG_PATH, name)
nexpaq 1:55a6170b404f 131 if team is None:
nexpaq 1:55a6170b404f 132 self.url = "http://" + MBED_URL + "/users/" + MBED_USER + "/code/%s/"
nexpaq 1:55a6170b404f 133 else:
nexpaq 1:55a6170b404f 134 self.url = "http://" + MBED_URL + "/teams/" + team + "/code/%s/"
nexpaq 1:55a6170b404f 135 if not exists(self.path):
nexpaq 1:55a6170b404f 136 # Checkout code
nexpaq 1:55a6170b404f 137 if not exists(MBED_ORG_PATH):
nexpaq 1:55a6170b404f 138 makedirs(MBED_ORG_PATH)
nexpaq 1:55a6170b404f 139
nexpaq 1:55a6170b404f 140 self.run_and_print(['hg', 'clone', self.url % name], cwd=MBED_ORG_PATH)
nexpaq 1:55a6170b404f 141
nexpaq 1:55a6170b404f 142 else:
nexpaq 1:55a6170b404f 143 # Update
nexpaq 1:55a6170b404f 144 self.run_and_print(['hg', 'pull'], cwd=self.path)
nexpaq 1:55a6170b404f 145 self.run_and_print(['hg', 'update'], cwd=self.path)
nexpaq 1:55a6170b404f 146
nexpaq 1:55a6170b404f 147 def publish(self):
nexpaq 1:55a6170b404f 148 # The maintainer has to evaluate the changes first and explicitly accept them
nexpaq 1:55a6170b404f 149 self.run_and_print(['hg', 'addremove'], cwd=self.path)
nexpaq 1:55a6170b404f 150 stdout, _, _ = run_cmd(['hg', 'status'], work_dir=self.path)
nexpaq 1:55a6170b404f 151 if stdout == '':
nexpaq 1:55a6170b404f 152 print "No changes"
nexpaq 1:55a6170b404f 153 return False
nexpaq 1:55a6170b404f 154 print stdout
nexpaq 1:55a6170b404f 155 if quiet:
nexpaq 1:55a6170b404f 156 commit = 'Y'
nexpaq 1:55a6170b404f 157 else:
nexpaq 1:55a6170b404f 158 commit = raw_input(push_remote and "Do you want to commit and push? Y/N: " or "Do you want to commit? Y/N: ")
nexpaq 1:55a6170b404f 159 if commit == 'Y':
nexpaq 1:55a6170b404f 160 args = ['hg', 'commit', '-u', MBED_ORG_USER]
nexpaq 1:55a6170b404f 161 if commit_msg:
nexpaq 1:55a6170b404f 162 args = args + ['-m', commit_msg]
nexpaq 1:55a6170b404f 163 self.run_and_print(args, cwd=self.path)
nexpaq 1:55a6170b404f 164 if push_remote:
nexpaq 1:55a6170b404f 165 self.run_and_print(['hg', 'push'], cwd=self.path)
nexpaq 1:55a6170b404f 166 return True
nexpaq 1:55a6170b404f 167
nexpaq 1:55a6170b404f 168 # Check if a file is a text file or a binary file
nexpaq 1:55a6170b404f 169 # Taken from http://code.activestate.com/recipes/173220/
nexpaq 1:55a6170b404f 170 text_characters = "".join(map(chr, range(32, 127)) + list("\n\r\t\b"))
nexpaq 1:55a6170b404f 171 _null_trans = string.maketrans("", "")
nexpaq 1:55a6170b404f 172 def is_text_file(filename):
nexpaq 1:55a6170b404f 173 block_size = 1024
nexpaq 1:55a6170b404f 174 def istext(s):
nexpaq 1:55a6170b404f 175 if "\0" in s:
nexpaq 1:55a6170b404f 176 return 0
nexpaq 1:55a6170b404f 177
nexpaq 1:55a6170b404f 178 if not s: # Empty files are considered text
nexpaq 1:55a6170b404f 179 return 1
nexpaq 1:55a6170b404f 180
nexpaq 1:55a6170b404f 181 # Get the non-text characters (maps a character to itself then
nexpaq 1:55a6170b404f 182 # use the 'remove' option to get rid of the text characters.)
nexpaq 1:55a6170b404f 183 t = s.translate(_null_trans, text_characters)
nexpaq 1:55a6170b404f 184
nexpaq 1:55a6170b404f 185 # If more than 30% non-text characters, then
nexpaq 1:55a6170b404f 186 # this is considered a binary file
nexpaq 1:55a6170b404f 187 if float(len(t))/len(s) > 0.30:
nexpaq 1:55a6170b404f 188 return 0
nexpaq 1:55a6170b404f 189 return 1
nexpaq 1:55a6170b404f 190 with open(filename) as f:
nexpaq 1:55a6170b404f 191 res = istext(f.read(block_size))
nexpaq 1:55a6170b404f 192 return res
nexpaq 1:55a6170b404f 193
nexpaq 1:55a6170b404f 194 # Return the line ending type for the given file ('cr' or 'crlf')
nexpaq 1:55a6170b404f 195 def get_line_endings(f):
nexpaq 1:55a6170b404f 196 examine_size = 1024
nexpaq 1:55a6170b404f 197 try:
nexpaq 1:55a6170b404f 198 tf = open(f, "rb")
nexpaq 1:55a6170b404f 199 lines, ncrlf = tf.readlines(examine_size), 0
nexpaq 1:55a6170b404f 200 tf.close()
nexpaq 1:55a6170b404f 201 for l in lines:
nexpaq 1:55a6170b404f 202 if l.endswith("\r\n"):
nexpaq 1:55a6170b404f 203 ncrlf = ncrlf + 1
nexpaq 1:55a6170b404f 204 return 'crlf' if ncrlf > len(lines) >> 1 else 'cr'
nexpaq 1:55a6170b404f 205 except:
nexpaq 1:55a6170b404f 206 return 'cr'
nexpaq 1:55a6170b404f 207
nexpaq 1:55a6170b404f 208 # Copy file to destination, but preserve destination line endings if possible
nexpaq 1:55a6170b404f 209 # This prevents very annoying issues with huge diffs that appear because of
nexpaq 1:55a6170b404f 210 # differences in line endings
nexpaq 1:55a6170b404f 211 def copy_with_line_endings(sdk_file, repo_file):
nexpaq 1:55a6170b404f 212 if not isfile(repo_file):
nexpaq 1:55a6170b404f 213 copyfile(sdk_file, repo_file)
nexpaq 1:55a6170b404f 214 return
nexpaq 1:55a6170b404f 215 is_text = is_text_file(repo_file)
nexpaq 1:55a6170b404f 216 if is_text:
nexpaq 1:55a6170b404f 217 sdk_le = get_line_endings(sdk_file)
nexpaq 1:55a6170b404f 218 repo_le = get_line_endings(repo_file)
nexpaq 1:55a6170b404f 219 if not is_text or sdk_le == repo_le:
nexpaq 1:55a6170b404f 220 copyfile(sdk_file, repo_file)
nexpaq 1:55a6170b404f 221 else:
nexpaq 1:55a6170b404f 222 print "Converting line endings in '%s' to '%s'" % (abspath(repo_file), repo_le)
nexpaq 1:55a6170b404f 223 f = open(sdk_file, "rb")
nexpaq 1:55a6170b404f 224 data = f.read()
nexpaq 1:55a6170b404f 225 f.close()
nexpaq 1:55a6170b404f 226 f = open(repo_file, "wb")
nexpaq 1:55a6170b404f 227 data = data.replace("\r\n", "\n") if repo_le == 'cr' else data.replace('\n','\r\n')
nexpaq 1:55a6170b404f 228 f.write(data)
nexpaq 1:55a6170b404f 229 f.close()
nexpaq 1:55a6170b404f 230
nexpaq 1:55a6170b404f 231 def visit_files(path, visit):
nexpaq 1:55a6170b404f 232 for root, dirs, files in walk(path):
nexpaq 1:55a6170b404f 233 # Ignore hidden directories
nexpaq 1:55a6170b404f 234 for d in copy(dirs):
nexpaq 1:55a6170b404f 235 full = join(root, d)
nexpaq 1:55a6170b404f 236 if d.startswith('.'):
nexpaq 1:55a6170b404f 237 dirs.remove(d)
nexpaq 1:55a6170b404f 238 if ignore_path(full, IGNORE_DIRS):
nexpaq 1:55a6170b404f 239 print "Skipping '%s'" % full
nexpaq 1:55a6170b404f 240 dirs.remove(d)
nexpaq 1:55a6170b404f 241
nexpaq 1:55a6170b404f 242 for file in files:
nexpaq 1:55a6170b404f 243 if ignore_path(file, IGNORE_FILES):
nexpaq 1:55a6170b404f 244 continue
nexpaq 1:55a6170b404f 245
nexpaq 1:55a6170b404f 246 visit(join(root, file))
nexpaq 1:55a6170b404f 247
nexpaq 1:55a6170b404f 248
nexpaq 1:55a6170b404f 249 def update_repo(repo_name, sdk_paths, team_name):
nexpaq 1:55a6170b404f 250 repo = MbedRepository(repo_name, team_name)
nexpaq 1:55a6170b404f 251 # copy files from mbed SDK to mbed_official repository
nexpaq 1:55a6170b404f 252 def visit_mbed_sdk(sdk_file):
nexpaq 1:55a6170b404f 253 repo_file = join(repo.path, relpath(sdk_file, sdk_path))
nexpaq 1:55a6170b404f 254
nexpaq 1:55a6170b404f 255 repo_dir = dirname(repo_file)
nexpaq 1:55a6170b404f 256 if not exists(repo_dir):
nexpaq 1:55a6170b404f 257 makedirs(repo_dir)
nexpaq 1:55a6170b404f 258
nexpaq 1:55a6170b404f 259 copy_with_line_endings(sdk_file, repo_file)
nexpaq 1:55a6170b404f 260 for sdk_path in sdk_paths:
nexpaq 1:55a6170b404f 261 visit_files(sdk_path, visit_mbed_sdk)
nexpaq 1:55a6170b404f 262
nexpaq 1:55a6170b404f 263 # remove repository files that do not exist in the mbed SDK
nexpaq 1:55a6170b404f 264 def visit_repo(repo_file):
nexpaq 1:55a6170b404f 265 for sdk_path in sdk_paths:
nexpaq 1:55a6170b404f 266 sdk_file = join(sdk_path, relpath(repo_file, repo.path))
nexpaq 1:55a6170b404f 267 if exists(sdk_file):
nexpaq 1:55a6170b404f 268 break
nexpaq 1:55a6170b404f 269 else:
nexpaq 1:55a6170b404f 270 remove(repo_file)
nexpaq 1:55a6170b404f 271 print "remove: %s" % repo_file
nexpaq 1:55a6170b404f 272 visit_files(repo.path, visit_repo)
nexpaq 1:55a6170b404f 273
nexpaq 1:55a6170b404f 274 if repo.publish():
nexpaq 1:55a6170b404f 275 changed.append(repo_name)
nexpaq 1:55a6170b404f 276
nexpaq 1:55a6170b404f 277
nexpaq 1:55a6170b404f 278 def update_code(repositories):
nexpaq 1:55a6170b404f 279 for r in repositories:
nexpaq 1:55a6170b404f 280 repo_name, sdk_dir = r[0], r[1]
nexpaq 1:55a6170b404f 281 team_name = r[2] if len(r) == 3 else None
nexpaq 1:55a6170b404f 282 print '\n=== Updating "%s" ===' % repo_name
nexpaq 1:55a6170b404f 283 sdk_dirs = [sdk_dir] if type(sdk_dir) != type([]) else sdk_dir
nexpaq 1:55a6170b404f 284 update_repo(repo_name, sdk_dirs, team_name)
nexpaq 1:55a6170b404f 285
nexpaq 1:55a6170b404f 286 def update_single_repo(repo):
nexpaq 1:55a6170b404f 287 repos = [r for r in OFFICIAL_CODE if r[0] == repo]
nexpaq 1:55a6170b404f 288 if not repos:
nexpaq 1:55a6170b404f 289 print "Repository '%s' not found" % repo
nexpaq 1:55a6170b404f 290 else:
nexpaq 1:55a6170b404f 291 update_code(repos)
nexpaq 1:55a6170b404f 292
nexpaq 1:55a6170b404f 293 def update_dependencies(repositories):
nexpaq 1:55a6170b404f 294 for repo_name in repositories:
nexpaq 1:55a6170b404f 295 print '\n=== Updating "%s" ===' % repo_name
nexpaq 1:55a6170b404f 296 repo = MbedRepository(repo_name)
nexpaq 1:55a6170b404f 297
nexpaq 1:55a6170b404f 298 # point to the latest libraries
nexpaq 1:55a6170b404f 299 def visit_repo(repo_file):
nexpaq 1:55a6170b404f 300 with open(repo_file, "r") as f:
nexpaq 1:55a6170b404f 301 url = f.read()
nexpaq 1:55a6170b404f 302 with open(repo_file, "w") as f:
nexpaq 1:55a6170b404f 303 f.write(url[:(url.rindex('/')+1)])
nexpaq 1:55a6170b404f 304 visit_files(repo.path, visit_repo, None, MBED_REPO_EXT)
nexpaq 1:55a6170b404f 305
nexpaq 1:55a6170b404f 306 if repo.publish():
nexpaq 1:55a6170b404f 307 changed.append(repo_name)
nexpaq 1:55a6170b404f 308
nexpaq 1:55a6170b404f 309
nexpaq 1:55a6170b404f 310 def update_mbed():
nexpaq 1:55a6170b404f 311 update_repo("mbed", [join(BUILD_DIR, "mbed")], None)
nexpaq 1:55a6170b404f 312
nexpaq 1:55a6170b404f 313 def do_sync(options):
nexpaq 1:55a6170b404f 314 global push_remote, quiet, commit_msg, changed
nexpaq 1:55a6170b404f 315
nexpaq 1:55a6170b404f 316 push_remote = not options.nopush
nexpaq 1:55a6170b404f 317 quiet = options.quiet
nexpaq 1:55a6170b404f 318 commit_msg = options.msg
nexpaq 1:55a6170b404f 319 chnaged = []
nexpaq 1:55a6170b404f 320
nexpaq 1:55a6170b404f 321 if options.code:
nexpaq 1:55a6170b404f 322 update_code(OFFICIAL_CODE)
nexpaq 1:55a6170b404f 323
nexpaq 1:55a6170b404f 324 if options.dependencies:
nexpaq 1:55a6170b404f 325 update_dependencies(CODE_WITH_DEPENDENCIES)
nexpaq 1:55a6170b404f 326
nexpaq 1:55a6170b404f 327 if options.mbed:
nexpaq 1:55a6170b404f 328 update_mbed()
nexpaq 1:55a6170b404f 329
nexpaq 1:55a6170b404f 330 if options.repo:
nexpaq 1:55a6170b404f 331 update_single_repo(options.repo)
nexpaq 1:55a6170b404f 332
nexpaq 1:55a6170b404f 333 if changed:
nexpaq 1:55a6170b404f 334 print "Repositories with changes:", changed
nexpaq 1:55a6170b404f 335
nexpaq 1:55a6170b404f 336 return changed
nexpaq 1:55a6170b404f 337
nexpaq 1:55a6170b404f 338 if __name__ == '__main__':
nexpaq 1:55a6170b404f 339 parser = OptionParser()
nexpaq 1:55a6170b404f 340
nexpaq 1:55a6170b404f 341 parser.add_option("-c", "--code",
nexpaq 1:55a6170b404f 342 action="store_true", default=False,
nexpaq 1:55a6170b404f 343 help="Update the mbed_official code")
nexpaq 1:55a6170b404f 344
nexpaq 1:55a6170b404f 345 parser.add_option("-d", "--dependencies",
nexpaq 1:55a6170b404f 346 action="store_true", default=False,
nexpaq 1:55a6170b404f 347 help="Update the mbed_official code dependencies")
nexpaq 1:55a6170b404f 348
nexpaq 1:55a6170b404f 349 parser.add_option("-m", "--mbed",
nexpaq 1:55a6170b404f 350 action="store_true", default=False,
nexpaq 1:55a6170b404f 351 help="Release a build of the mbed library")
nexpaq 1:55a6170b404f 352
nexpaq 1:55a6170b404f 353 parser.add_option("-n", "--nopush",
nexpaq 1:55a6170b404f 354 action="store_true", default=False,
nexpaq 1:55a6170b404f 355 help="Commit the changes locally only, don't push them")
nexpaq 1:55a6170b404f 356
nexpaq 1:55a6170b404f 357 parser.add_option("", "--commit_message",
nexpaq 1:55a6170b404f 358 action="store", type="string", default='', dest='msg',
nexpaq 1:55a6170b404f 359 help="Commit message to use for all the commits")
nexpaq 1:55a6170b404f 360
nexpaq 1:55a6170b404f 361 parser.add_option("-r", "--repository",
nexpaq 1:55a6170b404f 362 action="store", type="string", default='', dest='repo',
nexpaq 1:55a6170b404f 363 help="Synchronize only the given repository")
nexpaq 1:55a6170b404f 364
nexpaq 1:55a6170b404f 365 parser.add_option("-q", "--quiet",
nexpaq 1:55a6170b404f 366 action="store_true", default=False,
nexpaq 1:55a6170b404f 367 help="Don't ask for confirmation before commiting or pushing")
nexpaq 1:55a6170b404f 368
nexpaq 1:55a6170b404f 369 (options, args) = parser.parse_args()
nexpaq 1:55a6170b404f 370
nexpaq 1:55a6170b404f 371 do_sync(options)
nexpaq 1:55a6170b404f 372