Skip to content
This repository was archived by the owner on Jan 15, 2021. It is now read-only.

Commit 86982a3

Browse files
committed
Merge pull request #310 from autopulated/master
never try to install over the top of linked modules
2 parents c6bbd85 + 3a648bb commit 86982a3

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

yotta/lib/component.py

+18
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,24 @@ def provider(
482482
if r:
483483
r.setTestDependency(dspec.is_test_dependency)
484484
return r
485+
# before resorting to install this module, check if we have an
486+
# existing linked module (which wasn't picked up because it didn't
487+
# match the version specification) - if we do, then we shouldn't
488+
# try to install, but should return that anyway:
489+
default_path = os.path.join(self.modulesPath(), dspec.name)
490+
if fsutils.isLink(default_path):
491+
r = Component(
492+
default_path,
493+
test_dependency = dspec.is_test_dependency,
494+
installed_linked = fsutils.isLink(default_path)
495+
)
496+
if r:
497+
assert(r.installedLinked())
498+
return r
499+
else:
500+
logger.error('linked module %s is invalid: %s', dspec.name, r.getError())
501+
return r
502+
485503
r = access.satisfyVersionByInstalling(dspec.name, dspec.version_req, self.modulesPath())
486504
if not r:
487505
logger.error('could not install %s' % name)

yotta/lib/pack.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ def __init__(
139139
raise Exception('missing "version"')
140140
except Exception as e:
141141
self.description = OrderedDict()
142+
self.error = "Description invalid %s: %s" % (description_file, e);
142143
logger.debug(self.error)
143-
raise InvalidDescription("Description invalid %s: %s" % (description_file, e))
144+
raise InvalidDescription(self.error)
144145
else:
145146
self.error = "No %s file." % description_filename
146147
self.description = OrderedDict()

yotta/list.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ def format(
120120
indent=u'',
121121
tee=u'',
122122
installed_at=u'',
123-
test_dep=False
123+
test_dep=False,
124+
spec=None
124125
):
125126
r = u''
126127

@@ -169,7 +170,9 @@ def shouldDisplay(x):
169170

170171

171172
line = indent[:-2] + tee + component.getName() + u' ' + DIM + str(component.getVersion()) + RESET
172-
173+
174+
if spec and not spec.match(component.getVersion()):
175+
line += u' ' + RESET + BRIGHT + RED + str(spec) + RESET
173176
if test_dep:
174177
line += u' ' + DIM + u'(test dependency)' + RESET
175178
if len(installed_at):
@@ -220,7 +223,8 @@ def shouldDisplay(x):
220223
processed,
221224
next_indent,
222225
next_tee,
223-
test_dep = isTestOnly(name)
226+
test_dep = isTestOnly(name),
227+
spec = spec
224228
)
225229
else:
226230
r += self.format(
@@ -229,7 +233,8 @@ def shouldDisplay(x):
229233
next_indent,
230234
next_tee,
231235
installed_at = relpathIfSubdir(dep.path),
232-
test_dep = isTestOnly(name)
236+
test_dep = isTestOnly(name),
237+
spec = spec
233238
)
234239
else:
235240
r += indent + tee + DIM + name + spec_descr + RESET + '\n'

0 commit comments

Comments
 (0)