diff --git a/roles/finch/tasks/main.yml b/roles/finch/tasks/main.yml index a1a1c39a..a8159ab8 100644 --- a/roles/finch/tasks/main.yml +++ b/roles/finch/tasks/main.yml @@ -1,31 +1,34 @@ --- # tasks file for Finch -- name: Check Finch - stat: - path: '{{ finch.zip }}' - register: st -- block: - - name: Create Finch directory - file: - path: '{{ finch.install_path }}' - state: directory - owner: root - group: root - mode: "0755" - - name: Fetch Finch zip - get_url: - url: '{{ finch.url }}' - dest: '{{ finch.zip }}' - checksum: 'sha1:{{ finch.hash }}' - force: yes - - name: Unpack Finch zip - unarchive: - dest: '{{ finch.install_path }}' - src: '{{ finch.zip }}' - owner: root - group: root - mode: "0755" - when: st.stat.checksum|default("") != finch.hash +- name: Create Finch directory + file: + path: '{{ finch.install_path }}' + state: directory + owner: root + group: root + mode: "0755" +- name: Fetch Finch zip + get_url: + url: '{{ finch.url }}' + dest: '{{ finch.zip }}' + checksum: 'sha1:{{ finch.hash }}' + force: yes + register: download_finch +- name: Unpack Finch zip + unarchive: + dest: '{{ finch.install_path }}' + src: '{{ finch.zip }}' + owner: root + group: root + mode: "0755" + # noqa no-handler + when: download_finch.changed +# Recent versions of the Finch zip file have mistakenly included the +# __pycache__ directory +- name: Delete Finch pycache + file: + path: '{{ finch.extract_base }}/__pycache__' + state: absent - name: Install Finch udev rule copy: src: 55-finch.rules @@ -36,14 +39,14 @@ - name: Install Finch extra - dance2.py copy: src: dance2.py - dest: '{{ finch.install_path }}' + dest: '{{ finch.extract_base }}' owner: root group: root mode: "0644" - name: Install Finch extra - maze.py copy: src: maze.py - dest: '{{ finch.install_path }}' + dest: '{{ finch.extract_base }}' owner: root group: root mode: "0644" @@ -52,7 +55,7 @@ path: '{{ global_profile_path }}' marker: "## {mark} Finch profile entries ##" block: | - export HIDAPI_LIB_PATH={{ finch.install_path }} - export PYTHONPATH=$PYTHONPATH:{{ finch.install_path }} + export HIDAPI_LIB_PATH={{ finch.extract_base }} + export PYTHONPATH=$PYTHONPATH:{{ finch.extract_base }} notify: - Suggest restart diff --git a/roles/finch/vars/main.yml b/roles/finch/vars/main.yml index 8b2cfcdc..e1e8631c 100644 --- a/roles/finch/vars/main.yml +++ b/roles/finch/vars/main.yml @@ -5,3 +5,6 @@ finch: zip: '{{ global_base_path }}/FinchPython120.zip' hash: '841a7f7ca3a11678ecb6319e9983f87c57eb80da' install_path: '{{ global_base_path }}/FinchPython' + # The "root" of the zip file is a "FinchPython120" directory. This variable will + # need to be updated if the structure of the zip changes. + extract_base: '{{ global_base_path }}/FinchPython/FinchPython120'