Merge pull request #631 from MycroftAI/feature/issue-630
#630 - Fixing SkillInstaller, using text to match instead of exit codepull/637/head release/v0.8.8
commit
02cccc1c8a
|
@ -15,3 +15,5 @@ install:
|
||||||
script:
|
script:
|
||||||
- pep8 mycroft test
|
- pep8 mycroft test
|
||||||
# - ./start.sh unittest --fail-on-error
|
# - ./start.sh unittest --fail-on-error
|
||||||
|
env:
|
||||||
|
- IS_TRAVIS=true
|
|
@ -50,16 +50,15 @@ class SkillInstallerSkill(MycroftSkill):
|
||||||
[BIN, "install", skill.strip().replace(" ", "-")],
|
[BIN, "install", skill.strip().replace(" ", "-")],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
text = p.stdout.read()
|
text, err = p.communicate()
|
||||||
status = p.wait()
|
if text.splitlines()[1] == "Your search has multiple choices":
|
||||||
if status == 0:
|
|
||||||
self.speak_dialog("installed", data={'skill': skill})
|
|
||||||
elif status == 2:
|
|
||||||
stdout = text.splitlines()
|
stdout = text.splitlines()
|
||||||
del stdout[0:3]
|
del stdout[0:3]
|
||||||
self.speak_dialog("choose", data={'skills': ", ".join(stdout)})
|
self.speak_dialog("choose", data={'skills': ", ".join(stdout)})
|
||||||
elif status == 3:
|
elif text.splitlines()[1] == "Skill not found" or skill == "":
|
||||||
self.speak_dialog("not.found", data={'skill': skill})
|
self.speak_dialog("not.found", data={'skill': skill})
|
||||||
|
elif text.splitlines()[2] == "Skill installed!":
|
||||||
|
self.speak_dialog("installed", data={'skill': skill})
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -1,6 +1,19 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
SKILLS_DIR='/opt/mycroft/skills'
|
||||||
# exit on any error
|
# exit on any error
|
||||||
set -Ee
|
set -Ee
|
||||||
|
rm -rf msm
|
||||||
git clone https://github.com/MycroftAI/msm.git msm
|
git clone https://github.com/MycroftAI/msm.git msm
|
||||||
chmod +x msm/msm
|
chmod +x msm/msm
|
||||||
|
|
||||||
|
if [[ ${IS_TRAVIS} != true ]]; then
|
||||||
|
echo "Create /opt/mycroft/skills if it doesn't exist"
|
||||||
|
if [ ! -d ${SKILLS_DIR} ]; then
|
||||||
|
sudo chown $USER:$USER ${SKILLS_DIR}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -w ${SKILLS_DIR} ]; then
|
||||||
|
sudo mkdir -p ${SKILLS_DIR}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue