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

jakob Arch Linux , , , , ,

5′er i blæsten.. 19:48

August 25th, 2010

Activity #194 (Running) on 25. August 2010 18:19:03
MapLapTimeDist.Avg. speedMax. speedEnergyAvg. hr.Max hr.
#hh:mm:ssmkm/hkm/hkJbpmbpm
10:03:36100016.6427.45301169185
20:03:50100015.6817.77314190194
30:04:15100014.1321.71331193196
40:04:10100014.416.7318185194
50:03:57100015.222.36322199202
60:00:016.6417.4416.82000
Total0:19:495006.6415.1627.451586187202


FacebookDeliciousTwitterDiggLinkedInGoogle BookmarksShare

jakob Running

Ikke så imponerende 5K i regnen.. 20:11..

August 23rd, 2010

Activity #193 (Running) on 23. August 2010 18:51:18
MapLapTimeDist.Avg. speedMax. speedEnergyAvg. hr.Max hr.
#hh:mm:ssmkm/hkm/hkJbpmbpm
10:03:53100015.4820.33322170183
20:03:49100015.720.78310185192
30:03:56100015.2819.11326195198
40:04:39100012.9117.67318188201
50:03:54100015.3622.28318197206
60:03:03732.0114.4318.42226187206
Total0:23:145732.0114.8122.281820187206


FacebookDeliciousTwitterDiggLinkedInGoogle BookmarksShare

jakob Running

Torsdagsløber i varmen

August 5th, 2010

Activity #192 (Running) on 5. August 2010 15:51:38
MapLapTimeDist.Avg. speedMax. speedEnergyAvg. hr.Max hr.
#hh:mm:ssmkm/hkm/hkJbpmbpm
10:03:49100015.724.78318164180
20:04:16100014.0717.81318175186
30:04:05100014.7216.36326191193
40:04:07100014.616.87305192199
50:04:34100013.1516.54310184196
60:04:13100014.2616.52314190198
70:04:22100013.7316.72310189197
80:04:46100012.617.67326191195
90:04:26100013.5216.67314193202
100:02:03500.8914.6321.38155202204
Total0:40:409500.8914.0224.782996186204


FacebookDeliciousTwitterDiggLinkedInGoogle BookmarksShare

jakob Running

Sun is shining, the weather is sweet.. :)

July 20th, 2010

Activity #191 (Running) on 20. July 2010 18:24:21
MapLapTimeDist.Avg. speedMax. speedEnergyAvg. hr.Max hr.
#hh:mm:ssmkm/hkm/hkJbpmbpm
10:03:42100016.2421.79318160175
20:03:58100015.1121.68335178184
30:03:57100015.219.99326189193
40:04:15100014.1319.26339187194
50:04:18100013.9717.33322188190
60:04:25100013.5915.55318189194
70:04:29100013.3716.19310180195
80:04:47100012.5314.34326182189
90:04:30100013.3115.18318189193
100:04:14998.9614.1518.81322195199
Total0:42:359998.9614.0921.793234184199


FacebookDeliciousTwitterDiggLinkedInGoogle BookmarksShare

jakob Running