| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # This Source Code Form is subject to the terms of the Mozilla Public | 3 # This Source Code Form is subject to the terms of the Mozilla Public |
| 4 # License, v. 2.0. If a copy of the MPL was not distributed with this | 4 # License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 6 | 6 |
| 7 import sys | 7 import sys |
| 8 import os | 8 import os |
| 9 import posixpath | 9 import posixpath |
| 10 import re | 10 import re |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 345 resolved_revision = repo_types[type].get_revision_id(target, revisio n) | 345 resolved_revision = repo_types[type].get_revision_id(target, revisio n) |
| 346 if not resolved_revision: | 346 if not resolved_revision: |
| 347 raise Exception('Failed to resolve revision %s' % revision) | 347 raise Exception('Failed to resolve revision %s' % revision) |
| 348 | 348 |
| 349 logging.info('Updating repository %s to revision %s' % (target, resolved _revision)) | 349 logging.info('Updating repository %s to revision %s' % (target, resolved _revision)) |
| 350 repo_types[type].update(target, resolved_revision, revision) | 350 repo_types[type].update(target, resolved_revision, revision) |
| 351 return True | 351 return True |
| 352 return False | 352 return False |
| 353 | 353 |
| 354 | 354 |
| 355 def resolve_deps(repodir, repotype, level=0, self_update=True, overrideroots=Non e, skipdependencies=set()): | 355 def resolve_deps(repodir, repotype, level=0, self_update=True, |
|
tlucas
2018/08/29 21:19:14
Nit: please break after 79, when touching this any
Sebastian Noack
2018/08/30 00:42:33
Done.
| |
| 356 overrideroots=None, skipdependencies=set()): | |
| 356 config = read_deps(repodir) | 357 config = read_deps(repodir) |
| 357 if config is None: | 358 if config is None: |
| 358 if level == 0: | 359 if level == 0: |
| 359 logging.warning('No dependencies file in directory %s, nothing to do ...\n%s' % (repodir, USAGE)) | 360 logging.warning('No dependencies file in directory %s, nothing to do ...\n%s' % (repodir, USAGE)) |
| 360 return | 361 return |
| 361 if level >= 10: | 362 if level >= 10: |
| 362 logging.warning('Too much subrepository nesting, ignoring %s' % repo) | 363 logging.warning('Too much subrepository nesting, ignoring %s' % repo) |
| 363 return | 364 return |
| 364 | 365 |
| 365 if overrideroots is not None: | 366 if overrideroots is not None: |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 383 logging.warning('No valid source / revision found to create %s' % ta rget) | 384 logging.warning('No valid source / revision found to create %s' % ta rget) |
| 384 continue | 385 continue |
| 385 | 386 |
| 386 repo_cloned = ensure_repo(repodir, parenttype, target, vcs, | 387 repo_cloned = ensure_repo(repodir, parenttype, target, vcs, |
| 387 _root.get(vcs, ''), source) | 388 _root.get(vcs, ''), source) |
| 388 if repo_types[vcs].istype(target): | 389 if repo_types[vcs].istype(target): |
| 389 repo_updated = update_repo(target, vcs, rev) | 390 repo_updated = update_repo(target, vcs, rev) |
| 390 npm_outdated = repo_cloned or repo_updated | 391 npm_outdated = repo_cloned or repo_updated |
| 391 else: | 392 else: |
| 392 vcs = None | 393 vcs = None |
| 393 npm_outdated = not os.path.exists(os.path.join(target, 'node_modules ')) | 394 npm_outdated = not os.path.exists( |
|
tlucas
2018/08/29 21:19:14
Nit: Please break after 79 characters.
Sebastian Noack
2018/08/30 00:42:33
Done.
| |
| 395 os.path.join(target, 'node_modules') | |
| 396 ) | |
| 394 | 397 |
| 395 recent_npm_failed = os.path.exists(os.path.join(target, NPM_LOCKFILE)) | 398 recent_npm_failed = os.path.exists(os.path.join(target, NPM_LOCKFILE)) |
| 396 if npm_outdated or recent_npm_failed: | 399 if npm_outdated or recent_npm_failed: |
| 397 resolve_npm_dependencies(target, vcs) | 400 resolve_npm_dependencies(target, vcs) |
| 398 | 401 |
| 399 resolve_deps(target, vcs, level + 1, self_update=False, | 402 resolve_deps(target, vcs, level + 1, self_update=False, |
| 400 overrideroots=overrideroots, skipdependencies=skipdependenc ies) | 403 overrideroots=overrideroots, skipdependencies=skipdependenc ies) |
| 401 | 404 |
| 402 if self_update and '_self' in config and '*' in config['_self']: | 405 if self_update and '_self' in config and '*' in config['_self']: |
| 403 source = safe_join(repodir, config['_self']['*']) | 406 source = safe_join(repodir, config['_self']['*']) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 446 args = parser.parse_args() | 449 args = parser.parse_args() |
| 447 | 450 |
| 448 if args.quiet: | 451 if args.quiet: |
| 449 logging.disable(logging.INFO) | 452 logging.disable(logging.INFO) |
| 450 | 453 |
| 451 repos = args.repos | 454 repos = args.repos |
| 452 if not len(repos): | 455 if not len(repos): |
| 453 repos = [os.path.dirname(__file__)] | 456 repos = [os.path.dirname(__file__)] |
| 454 for repo in repos: | 457 for repo in repos: |
| 455 resolve_deps(repo, get_repo_type(repo)) | 458 resolve_deps(repo, get_repo_type(repo)) |
| LEFT | RIGHT |