Index: ensure_dependencies.py |
=================================================================== |
--- a/ensure_dependencies.py |
+++ b/ensure_dependencies.py |
@@ -246,7 +246,7 @@ |
for name, repotype in repo_types.iteritems(): |
if repotype.istype(repo): |
return name |
- return 'hg' |
+ return None |
def resolve_npm_dependencies(target, vcs): |
@@ -291,8 +291,9 @@ |
'--no-package-lock', '--no-optional'] |
subprocess.check_output(cmd, cwd=target) |
- repo_types[vcs].ignore(os.path.join(target, NPM_LOCKFILE), target) |
- repo_types[vcs].ignore(os.path.join(target, 'node_modules'), target) |
+ if vcs: |
+ repo_types[vcs].ignore(os.path.join(target, NPM_LOCKFILE), target) |
+ repo_types[vcs].ignore(os.path.join(target, 'node_modules'), target) |
os.remove(lockfile_path) |
except OSError as e: |
@@ -351,7 +352,7 @@ |
return False |
-def resolve_deps(repodir, level=0, self_update=True, overrideroots=None, skipdependencies=set()): |
+def resolve_deps(repodir, repotype, level=0, self_update=True, overrideroots=None, skipdependencies=set()): |
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.
|
config = read_deps(repodir) |
if config is None: |
if level == 0: |
@@ -370,7 +371,7 @@ |
continue |
target = safe_join(repodir, dir) |
- parenttype = get_repo_type(repodir) |
+ parenttype = repotype or 'hg' |
_root = config.get('_root', {}) |
for key in sources.keys() + _root.keys(): |
@@ -384,11 +385,18 @@ |
repo_cloned = ensure_repo(repodir, parenttype, target, vcs, |
_root.get(vcs, ''), source) |
- repo_updated = update_repo(target, vcs, rev) |
+ if repo_types[vcs].istype(target): |
+ repo_updated = update_repo(target, vcs, rev) |
+ npm_outdated = repo_cloned or repo_updated |
+ else: |
+ vcs = None |
+ npm_outdated = not os.path.exists(os.path.join(target, 'node_modules')) |
tlucas
2018/08/29 21:19:14
Nit: Please break after 79 characters.
Sebastian Noack
2018/08/30 00:42:33
Done.
|
+ |
recent_npm_failed = os.path.exists(os.path.join(target, NPM_LOCKFILE)) |
- if repo_cloned or repo_updated or recent_npm_failed: |
+ if npm_outdated or recent_npm_failed: |
resolve_npm_dependencies(target, vcs) |
- resolve_deps(target, level + 1, self_update=False, |
+ |
+ resolve_deps(target, vcs, level + 1, self_update=False, |
overrideroots=overrideroots, skipdependencies=skipdependencies) |
if self_update and '_self' in config and '*' in config['_self']: |
@@ -444,4 +452,4 @@ |
if not len(repos): |
repos = [os.path.dirname(__file__)] |
for repo in repos: |
- resolve_deps(repo) |
+ resolve_deps(repo, get_repo_type(repo)) |