Archive

Posts Tagged ‘garmin-sync’

Getting garmin-sync to work after Arch Linux switch to python 3

October 28th, 2010

As many Arch Linux users propably noticed, the Arch Linux team decided to move from python 2 to 3 as default (http://www.archlinux.org/news/python-is-now-python-3). Quite some people wasn’t too fond of this (http://juliank.wordpress.com/2010/10/22/arch-linux-python-3-and-users).

Well it affects quite a lot of third party applications written for Python 2.x. One of them being garmin-sync (https://launchpad.net/garmin-sync), which I use to pull data from my GPS running watch (Garmin Forerunner 305). So I decided to find a way to make it work again.

  1. Open a terminal and change to the folder where you have garmin-sync installed.
  2. Now we need to change the default interpreter of all python scripts belonging to garmin-sync:
    [jakob@jarch garmin]$ sed -i -e "s|env python$|env python2|" *.py
    [jakob@jarch garmin]$ sed -i -e "s|env python$|env python2|" garmin-sync
  3. As garmin-sync uses pyusb which is written for python 2.x, we need to make some adjustments to the PKGBUILD: Reinstall the package from AUR:
    [jakob@jarch garmin]$ yaourt -S pyusb
  4. When given the option to edit PKGBUILD press “Y”.
  5. Change “python” to “python2″ in depends-section and under build() as so:
    # Contributor: Jason Giangrande <jgiangrande@clarku.edu>
    pkgname=pyusb
    pkgver=0.4.3
    pkgrel=1
    pkgdesc="A native Python module written in C which provides USB access."
    arch=('i686' 'x86_64')
    url="http://pyusb.berlios.de/"
    license=('GPL')
    depends=('python2' 'libusb')
    source=(http://downloads.sourceforge.net/project/pyusb/PyUSB%200.x/$pkgver/pyusb-$pkgver.tar.gz)
    md5sums=('a1a43bc6407caccbc22073c56439aa06')
    
    build() {
            cd $startdir/src/$pkgname-$pkgver
            python2 setup.py install -f --root=$startdir/pkg || return 1
    }
    
  6. I have a script which unloads the garmin gps module (this is needed to run garmin-sync), and then runs garmin-sync as su, in this I also needed to change python to python2:
    #!/bin/bash
    
    # Unload garmin gps module
    sudo modprobe -r garmin_gps
    
    # Run sync as su
    sudo python2  garmin-sync
    
  7. Et voilá!
FacebookDeliciousTwitterDiggLinkedInGoogle BookmarksShare

Arch Linux , , , , ,