Skip to content

Commit

Permalink
Merge pull request #473 from kylelaker/fix-finch-paths
Browse files Browse the repository at this point in the history
Cleanup Finch Python installation
  • Loading branch information
ripleymj committed Aug 29, 2021
2 parents 38f871f + c407ee6 commit ac2447b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 30 deletions.
63 changes: 33 additions & 30 deletions roles/finch/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
Expand All @@ -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
3 changes: 3 additions & 0 deletions roles/finch/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

0 comments on commit ac2447b

Please sign in to comment.