Skip to content
This repository was archived by the owner on Sep 8, 2024. It is now read-only.

Commit 02cccc1

Browse files
Merge pull request #631 from MycroftAI/feature/issue-630
#630 - Fixing SkillInstaller, using text to match instead of exit code
2 parents 729401f + ff01f92 commit 02cccc1

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ install:
1515
script:
1616
- pep8 mycroft test
1717
# - ./start.sh unittest --fail-on-error
18+
env:
19+
- IS_TRAVIS=true

mycroft/skills/skill_installer/__init__.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,15 @@ def install(self, message):
5050
[BIN, "install", skill.strip().replace(" ", "-")],
5151
stdout=subprocess.PIPE,
5252
stderr=subprocess.PIPE)
53-
text = p.stdout.read()
54-
status = p.wait()
55-
if status == 0:
56-
self.speak_dialog("installed", data={'skill': skill})
57-
elif status == 2:
53+
text, err = p.communicate()
54+
if text.splitlines()[1] == "Your search has multiple choices":
5855
stdout = text.splitlines()
5956
del stdout[0:3]
6057
self.speak_dialog("choose", data={'skills': ", ".join(stdout)})
61-
elif status == 3:
58+
elif text.splitlines()[1] == "Skill not found" or skill == "":
6259
self.speak_dialog("not.found", data={'skill': skill})
60+
elif text.splitlines()[2] == "Skill installed!":
61+
self.speak_dialog("installed", data={'skill': skill})
6362

6463
def stop(self):
6564
pass

scripts/install-msm.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
#!/usr/bin/env bash
2+
3+
SKILLS_DIR='/opt/mycroft/skills'
24
# exit on any error
35
set -Ee
4-
6+
rm -rf msm
57
git clone https://github.com/MycroftAI/msm.git msm
68
chmod +x msm/msm
9+
10+
if [[ ${IS_TRAVIS} != true ]]; then
11+
echo "Create /opt/mycroft/skills if it doesn't exist"
12+
if [ ! -d ${SKILLS_DIR} ]; then
13+
sudo chown $USER:$USER ${SKILLS_DIR}
14+
fi
15+
16+
if [ ! -w ${SKILLS_DIR} ]; then
17+
sudo mkdir -p ${SKILLS_DIR}
18+
fi
19+
fi

0 commit comments

Comments
 (0)