From 12620694b30f93a1ce0fd2b03bd5d8f03e924609 Mon Sep 17 00:00:00 2001 From: Augusto Monteiro 'Sparky Date: Mon, 3 Apr 2017 11:18:56 -0700 Subject: [PATCH 1/4] #630 - Fixing SkillInstaller, using text to match instead of exit code --- mycroft/skills/skill_installer/__init__.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mycroft/skills/skill_installer/__init__.py b/mycroft/skills/skill_installer/__init__.py index bef0f6d759..712110238f 100644 --- a/mycroft/skills/skill_installer/__init__.py +++ b/mycroft/skills/skill_installer/__init__.py @@ -50,16 +50,15 @@ class SkillInstallerSkill(MycroftSkill): [BIN, "install", skill.strip().replace(" ", "-")], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - text = p.stdout.read() - status = p.wait() - if status == 0: - self.speak_dialog("installed", data={'skill': skill}) - elif status == 2: + text, err = p.communicate() + if text.splitlines()[1] == "Your search has multiple choices": stdout = text.splitlines() del stdout[0:3] 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}) + elif text.splitlines()[2] == "Skill installed!": + self.speak_dialog("installed", data={'skill': skill}) def stop(self): pass From 4d8f7f6e13cf63cbdffc0c3257159aaf4704fab7 Mon Sep 17 00:00:00 2001 From: Augusto Monteiro 'Sparky Date: Mon, 3 Apr 2017 11:45:26 -0700 Subject: [PATCH 2/4] #630 - Updating msm install script --- scripts/install-msm.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/install-msm.sh b/scripts/install-msm.sh index 10c427af15..fe5f904153 100755 --- a/scripts/install-msm.sh +++ b/scripts/install-msm.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash # exit on any error set -Ee - +rm -rf msm git clone https://github.com/MycroftAI/msm.git msm chmod +x msm/msm +sudo mkdir -p /opt/mycroft/skills +sudo chown $USER:$USER /opt/mycroft/skills From c8c3b3d67ff12330d488ef7d90f1b8dcffc50355 Mon Sep 17 00:00:00 2001 From: Arron Atchison Date: Mon, 3 Apr 2017 12:30:47 -0700 Subject: [PATCH 3/4] checking to see if opt/mycroft/skills exists and is writable --- scripts/install-msm.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/install-msm.sh b/scripts/install-msm.sh index fe5f904153..44ae7e3dbc 100755 --- a/scripts/install-msm.sh +++ b/scripts/install-msm.sh @@ -1,8 +1,17 @@ #!/usr/bin/env bash + +SKILLS_DIR='/opt/mycroft/skills' # exit on any error set -Ee rm -rf msm git clone https://github.com/MycroftAI/msm.git msm chmod +x msm/msm -sudo mkdir -p /opt/mycroft/skills -sudo chown $USER:$USER /opt/mycroft/skills + +if [ ! -d ${SKILLS_DIR} ]; then + sudo chown $USER:$USER ${SKILLS_DIR} +fi + +if [ ! -w ${SKILLS_DIR} ]; then + sudo mkdir -p ${SKILLS_DIR} +fi + From ff01f929eb28071fa89dce4c5cfdf90f5dacd528 Mon Sep 17 00:00:00 2001 From: Arron Atchison Date: Mon, 3 Apr 2017 13:33:28 -0700 Subject: [PATCH 4/4] Added variable in travis.yml and a check in install-msm.sh to disable creating opt/mycroft/skills --- .travis.yml | 2 ++ scripts/install-msm.sh | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index d60c38cbbc..cf00f19019 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,3 +15,5 @@ install: script: - pep8 mycroft test # - ./start.sh unittest --fail-on-error +env: + - IS_TRAVIS=true \ No newline at end of file diff --git a/scripts/install-msm.sh b/scripts/install-msm.sh index 44ae7e3dbc..8f29de6d2c 100755 --- a/scripts/install-msm.sh +++ b/scripts/install-msm.sh @@ -7,11 +7,13 @@ rm -rf msm git clone https://github.com/MycroftAI/msm.git msm chmod +x msm/msm -if [ ! -d ${SKILLS_DIR} ]; then - sudo chown $USER:$USER ${SKILLS_DIR} -fi +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} + if [ ! -w ${SKILLS_DIR} ]; then + sudo mkdir -p ${SKILLS_DIR} + fi fi -