[Pkg-running-devel] [garmin-forerunner-tools] 02/06: Really add python_dir_from_upstream.patch

Christian Perrier bubulle at moszumanska.debian.org
Sat Sep 20 07:52:03 UTC 2014


This is an automated email from the git hooks/post-receive script.

bubulle pushed a commit to branch master
in repository garmin-forerunner-tools.

commit f45efcdcb838efb0e3a7bf6b864b8bd3bc0c03b0
Author: Christian Perrier <bubulle at debian.org>
Date:   Sat Sep 20 09:30:04 2014 +0200

    Really add python_dir_from_upstream.patch
---
 debian/patches/python_dir_from_upstream.patch | 752 ++++++++++++++++++++++++++
 1 file changed, 752 insertions(+)

diff --git a/debian/patches/python_dir_from_upstream.patch b/debian/patches/python_dir_from_upstream.patch
new file mode 100644
index 0000000..e259435
--- /dev/null
+++ b/debian/patches/python_dir_from_upstream.patch
@@ -0,0 +1,752 @@
+--- /dev/null
++++ garmin-forerunner-tools-0.10repacked/python/Makefile.am
+@@ -0,0 +1,12 @@
++
++EXTRA_DIST = setup.py garmintools
++
++clean:
++	rm -rf build
++
++all:
++	python setup.py build --usb_libs="@USB_LIBS@" --usb_cflags="@USB_CFLAGS@" --libdir=$(libdir)
++
++install-exec-hook:
++	python setup.py install --prefix=$(DESTDIR)/$(prefix)
++
+--- /dev/null
++++ garmin-forerunner-tools-0.10repacked/python/Makefile.in
+@@ -0,0 +1,339 @@
++# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# @configure_input@
++
++# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
++# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
++# This Makefile.in is free software; the Free Software Foundation
++# gives unlimited permission to copy and/or distribute it,
++# with or without modifications, as long as this notice is preserved.
++
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
++# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
++# PARTICULAR PURPOSE.
++
++ at SET_MAKE@
++VPATH = @srcdir@
++pkgdatadir = $(datadir)/@PACKAGE@
++pkglibdir = $(libdir)/@PACKAGE@
++pkgincludedir = $(includedir)/@PACKAGE@
++am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
++install_sh_DATA = $(install_sh) -c -m 644
++install_sh_PROGRAM = $(install_sh) -c
++install_sh_SCRIPT = $(install_sh) -c
++INSTALL_HEADER = $(INSTALL_DATA)
++transform = $(program_transform_name)
++NORMAL_INSTALL = :
++PRE_INSTALL = :
++POST_INSTALL = :
++NORMAL_UNINSTALL = :
++PRE_UNINSTALL = :
++POST_UNINSTALL = :
++build_triplet = @build@
++host_triplet = @host@
++subdir = python
++DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
++ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
++am__aclocal_m4_deps = $(top_srcdir)/configure.ac
++am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
++	$(ACLOCAL_M4)
++mkinstalldirs = $(install_sh) -d
++CONFIG_HEADER = $(top_builddir)/src/config.h
++CONFIG_CLEAN_FILES =
++SOURCES =
++DIST_SOURCES =
++DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
++ACLOCAL = @ACLOCAL@
++AMTAR = @AMTAR@
++AR = @AR@
++AUTOCONF = @AUTOCONF@
++AUTOHEADER = @AUTOHEADER@
++AUTOMAKE = @AUTOMAKE@
++AWK = @AWK@
++CC = @CC@
++CCDEPMODE = @CCDEPMODE@
++CFLAGS = @CFLAGS@
++CPP = @CPP@
++CPPFLAGS = @CPPFLAGS@
++CXX = @CXX@
++CXXCPP = @CXXCPP@
++CXXDEPMODE = @CXXDEPMODE@
++CXXFLAGS = @CXXFLAGS@
++CYGPATH_W = @CYGPATH_W@
++DEFS = @DEFS@
++DEPDIR = @DEPDIR@
++DSYMUTIL = @DSYMUTIL@
++ECHO = @ECHO@
++ECHO_C = @ECHO_C@
++ECHO_N = @ECHO_N@
++ECHO_T = @ECHO_T@
++EGREP = @EGREP@
++EXEEXT = @EXEEXT@
++F77 = @F77@
++FFLAGS = @FFLAGS@
++GREP = @GREP@
++HAVE_PYTHON = @HAVE_PYTHON@
++INSTALL = @INSTALL@
++INSTALL_DATA = @INSTALL_DATA@
++INSTALL_PROGRAM = @INSTALL_PROGRAM@
++INSTALL_SCRIPT = @INSTALL_SCRIPT@
++INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
++LDFLAGS = @LDFLAGS@
++LIBOBJS = @LIBOBJS@
++LIBS = @LIBS@
++LIBTOOL = @LIBTOOL@
++LIBUSB_CONFIG = @LIBUSB_CONFIG@
++LN_S = @LN_S@
++LTLIBOBJS = @LTLIBOBJS@
++MAKEINFO = @MAKEINFO@
++MKDIR_P = @MKDIR_P@
++NMEDIT = @NMEDIT@
++OBJEXT = @OBJEXT@
++PACKAGE = @PACKAGE@
++PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
++PACKAGE_NAME = @PACKAGE_NAME@
++PACKAGE_STRING = @PACKAGE_STRING@
++PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_VERSION = @PACKAGE_VERSION@
++PATH_SEPARATOR = @PATH_SEPARATOR@
++PROG_LIBS = @PROG_LIBS@
++PYTHON_SUBDIRS = @PYTHON_SUBDIRS@
++RANLIB = @RANLIB@
++SED = @SED@
++SET_MAKE = @SET_MAKE@
++SHELL = @SHELL@
++STRIP = @STRIP@
++USB_CFLAGS = @USB_CFLAGS@
++USB_LIBS = @USB_LIBS@
++VERSION = @VERSION@
++abs_builddir = @abs_builddir@
++abs_srcdir = @abs_srcdir@
++abs_top_builddir = @abs_top_builddir@
++abs_top_srcdir = @abs_top_srcdir@
++ac_ct_CC = @ac_ct_CC@
++ac_ct_CXX = @ac_ct_CXX@
++ac_ct_F77 = @ac_ct_F77@
++am__include = @am__include@
++am__leading_dot = @am__leading_dot@
++am__quote = @am__quote@
++am__tar = @am__tar@
++am__untar = @am__untar@
++bindir = @bindir@
++build = @build@
++build_alias = @build_alias@
++build_cpu = @build_cpu@
++build_os = @build_os@
++build_vendor = @build_vendor@
++builddir = @builddir@
++datadir = @datadir@
++datarootdir = @datarootdir@
++docdir = @docdir@
++dvidir = @dvidir@
++exec_prefix = @exec_prefix@
++host = @host@
++host_alias = @host_alias@
++host_cpu = @host_cpu@
++host_os = @host_os@
++host_vendor = @host_vendor@
++htmldir = @htmldir@
++includedir = @includedir@
++infodir = @infodir@
++install_sh = @install_sh@
++libdir = @libdir@
++libexecdir = @libexecdir@
++localedir = @localedir@
++localstatedir = @localstatedir@
++mandir = @mandir@
++mkdir_p = @mkdir_p@
++oldincludedir = @oldincludedir@
++pdfdir = @pdfdir@
++prefix = @prefix@
++program_transform_name = @program_transform_name@
++psdir = @psdir@
++sbindir = @sbindir@
++sharedstatedir = @sharedstatedir@
++srcdir = @srcdir@
++sysconfdir = @sysconfdir@
++target_alias = @target_alias@
++top_builddir = @top_builddir@
++top_srcdir = @top_srcdir@
++EXTRA_DIST = setup.py garmintools
++all: all-am
++
++.SUFFIXES:
++$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
++	@for dep in $?; do \
++	  case '$(am__configure_deps)' in \
++	    *$$dep*) \
++	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
++		&& exit 0; \
++	      exit 1;; \
++	  esac; \
++	done; \
++	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  python/Makefile'; \
++	cd $(top_srcdir) && \
++	  $(AUTOMAKE) --gnu  python/Makefile
++.PRECIOUS: Makefile
++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
++	@case '$?' in \
++	  *config.status*) \
++	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
++	  *) \
++	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
++	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
++	esac;
++
++$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
++	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
++
++$(top_srcdir)/configure:  $(am__configure_deps)
++	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
++$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
++	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
++
++mostlyclean-libtool:
++	-rm -f *.lo
++
++clean-libtool:
++	-rm -rf .libs _libs
++tags: TAGS
++TAGS:
++
++ctags: CTAGS
++CTAGS:
++
++
++distdir: $(DISTFILES)
++	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
++	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
++	list='$(DISTFILES)'; \
++	  dist_files=`for file in $$list; do echo $$file; done | \
++	  sed -e "s|^$$srcdirstrip/||;t" \
++	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
++	case $$dist_files in \
++	  */*) $(MKDIR_P) `echo "$$dist_files" | \
++			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
++			   sort -u` ;; \
++	esac; \
++	for file in $$dist_files; do \
++	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
++	  if test -d $$d/$$file; then \
++	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
++	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
++	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
++	    fi; \
++	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
++	  else \
++	    test -f $(distdir)/$$file \
++	    || cp -p $$d/$$file $(distdir)/$$file \
++	    || exit 1; \
++	  fi; \
++	done
++check-am: all-am
++check: check-am
++all-am: Makefile
++installdirs:
++install: install-am
++install-exec: install-exec-am
++install-data: install-data-am
++uninstall: uninstall-am
++
++install-am: all-am
++	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
++
++installcheck: installcheck-am
++install-strip:
++	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
++	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
++	  `test -z '$(STRIP)' || \
++	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
++mostlyclean-generic:
++
++clean-generic:
++
++distclean-generic:
++	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
++
++maintainer-clean-generic:
++	@echo "This command is intended for maintainers to use"
++	@echo "it deletes files that may require special tools to rebuild."
++clean-am: clean-generic clean-libtool mostlyclean-am
++
++distclean: distclean-am
++	-rm -f Makefile
++distclean-am: clean-am distclean-generic
++
++dvi: dvi-am
++
++dvi-am:
++
++html: html-am
++
++info: info-am
++
++info-am:
++
++install-data-am:
++
++install-dvi: install-dvi-am
++
++install-exec-am:
++	@$(NORMAL_INSTALL)
++	$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
++
++install-html: install-html-am
++
++install-info: install-info-am
++
++install-man:
++
++install-pdf: install-pdf-am
++
++install-ps: install-ps-am
++
++installcheck-am:
++
++maintainer-clean: maintainer-clean-am
++	-rm -f Makefile
++maintainer-clean-am: distclean-am maintainer-clean-generic
++
++mostlyclean: mostlyclean-am
++
++mostlyclean-am: mostlyclean-generic mostlyclean-libtool
++
++pdf: pdf-am
++
++pdf-am:
++
++ps: ps-am
++
++ps-am:
++
++uninstall-am:
++
++.MAKE: install-am install-exec-am install-strip
++
++.PHONY: all all-am check check-am clean clean-generic clean-libtool \
++	distclean distclean-generic distclean-libtool distdir dvi \
++	dvi-am html html-am info info-am install install-am \
++	install-data install-data-am install-dvi install-dvi-am \
++	install-exec install-exec-am install-exec-hook install-html \
++	install-html-am install-info install-info-am install-man \
++	install-pdf install-pdf-am install-ps install-ps-am \
++	install-strip installcheck installcheck-am installdirs \
++	maintainer-clean maintainer-clean-generic mostlyclean \
++	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
++	uninstall uninstall-am
++
++
++clean:
++	rm -rf build
++
++all:
++	python setup.py build --usb_libs="@USB_LIBS@" --usb_cflags="@USB_CFLAGS@" --libdir=$(libdir)
++
++install-exec-hook:
++	python setup.py install --prefix=$(DESTDIR)/$(prefix)
++# Tell versions [3.59,3.63) of GNU make to not export all variables.
++# Otherwise a system limit (for SysV at least) may be exceeded.
++.NOEXPORT:
+--- /dev/null
++++ garmin-forerunner-tools-0.10repacked/python/garmintools/__init__.py
+@@ -0,0 +1,5 @@
++
++from pygarmin import *
++
++
++
+--- /dev/null
++++ garmin-forerunner-tools-0.10repacked/python/pygarmin.c
+@@ -0,0 +1,332 @@
++#include <Python.h>
++#include <stdio.h>
++#include "garmin.h"
++
++
++int verbose = 0;
++
++
++/* Toggle the state of the verbose flag and return the new value */
++
++static PyObject* toggle_verbose(PyObject* obj, PyObject* args)
++{
++  verbose = (int) ! verbose;
++  return PyBool_FromLong(verbose);
++}
++
++
++/* Return the current state of the verbose flag */
++
++static PyObject* get_verbose(PyObject* obj, PyObject* args)
++{
++  return PyBool_FromLong(verbose);
++}
++
++
++/* Initialize the garmin unit and hanlde errors */
++
++bool initialize_garmin(garmin_unit* garmin)
++{
++  int init_code = garmin_init(garmin, verbose);
++
++  switch (init_code)
++  {
++    case 0 :
++      PyErr_SetString(PyExc_RuntimeError, "Garmin unit could not be opened.");
++      return 0;
++    
++    default:
++      return 1;
++  }
++}
++
++
++/* Return information about the attached garmin unit */
++
++static PyObject* get_info(PyObject* obj, PyObject* args)
++{
++  garmin_unit garmin;
++
++  if (!initialize_garmin(&garmin))
++      return NULL;
++      
++  PyObject* dict = PyDict_New();
++    
++  uint32 unit_id = garmin.id;
++  PyDict_SetItem(dict, PyString_FromString("unit_id"), PyLong_FromUnsignedLong(unit_id));
++
++  uint16 product_id = garmin.product.product_id;
++  PyDict_SetItem(dict, PyString_FromString("product_id"), PyInt_FromLong(product_id));
++
++  double software_version = garmin.product.software_version / 100.0;
++  PyDict_SetItem(dict, PyString_FromString("software_version"), PyFloat_FromDouble(software_version));
++    
++  char* product_description = garmin.product.product_description; 
++  PyDict_SetItem(dict, PyString_FromString("description"), PyString_FromString(product_description));
++
++  garmin_close(&garmin);
++
++  return Py_BuildValue("N", dict);
++}
++
++
++/* Return all run data from the attached garmin unit as python dictionary */
++
++static PyObject* get_runs(PyObject* obj, PyObject* args)
++{
++  garmin_unit garmin;
++
++  if (!initialize_garmin(&garmin))
++    return NULL;
++  
++  garmin_data * data;
++
++  if ( (data = garmin_get(&garmin, GET_RUNS)) == NULL )
++  {
++    PyErr_SetString(PyExc_RuntimeError, "Unable to extract any data.");
++    return NULL;
++  }
++
++  /*
++    We should have a list with three elements:
++    1) The runs (which identify the track and lap indices)
++    2) The laps (which are related to the runs)
++    3) The tracks (which are related to the runs)
++  */
++
++  garmin_data * tmpdata;
++  garmin_list * runs    = NULL;
++  garmin_list * laps    = NULL;
++  garmin_list * tracks  = NULL;
++
++  tmpdata = garmin_list_data(data, 0);
++  if ( tmpdata == NULL )
++  {
++    PyErr_SetString(PyExc_RuntimeError, "Toplevel data missing element 0 (runs)");
++    return NULL;
++  }
++
++  runs = tmpdata->data;
++  if ( runs == NULL )
++  {
++    PyErr_SetString(PyExc_RuntimeError, "No runs extracted.");
++    return NULL;
++  }
++    
++  tmpdata = garmin_list_data(data, 1);
++  if ( tmpdata == NULL )
++  {
++    PyErr_SetString(PyExc_RuntimeError, "Toplevel data missing element 1 (laps)");
++    return NULL;
++  }
++
++  laps = tmpdata->data;
++  if ( laps == NULL )
++  {
++    PyErr_SetString(PyExc_RuntimeError, "No laps extracted.");
++    return NULL;
++  }
++  
++  tmpdata = garmin_list_data(data, 2);
++  if ( tmpdata == NULL )
++  {
++    PyErr_SetString(PyExc_RuntimeError, "Toplevel data missing element 2 (tracks)");
++    return NULL;
++  }
++  
++  tracks = tmpdata->data;
++  if ( tracks == NULL )
++  {
++    PyErr_SetString(PyExc_RuntimeError, "No tracks extracted.");
++    return NULL;
++  }
++
++  garmin_list_node * n;
++  garmin_list_node * m;
++  garmin_list_node * o;
++  uint32             trk;
++  uint32             f_lap;
++  uint32             l_lap;
++  uint32             l_idx;
++  time_type          start;
++
++  /* Print some debug output if requested. */
++  if ( verbose != 0 )
++  {
++    for ( m = laps->head; m != NULL; m = m->next )
++    {
++      if ( get_lap_index(m->data,&l_idx) != 0 )
++        printf("[garmin] lap: index [%d]\n", l_idx);
++      else
++        printf("[garmin] lap: index [??]\n");
++    }
++  }
++    
++  /* For each run, get its laps and track points. */
++  
++  PyObject* dict = PyDict_New();
++
++  for ( n = runs->head; n != NULL; n = n->next )
++  {      
++    if ( get_run_track_lap_info(n->data, &trk, &f_lap, &l_lap) != 0 )
++    {
++      time_type f_lap_start = 0;
++      
++      PyObject* run = PyDict_New();
++      PyObject* rlaps = PyDict_New();
++
++      PyDict_SetItem(run, PyString_FromString("track"), Py_BuildValue("i", trk));
++      PyDict_SetItem(run, PyString_FromString("first_lap"), Py_BuildValue("i", f_lap));
++      PyDict_SetItem(run, PyString_FromString("last_lap"), Py_BuildValue("i", l_lap));
++      PyDict_SetItem(run, PyString_FromString("type"), Py_BuildValue("i", (int)n->data->type));
++
++      /* TODO:
++         Implement something similar for the other run types, D1000 and D1010
++         See src/run.c get_run_track_lap_info() for more information
++       */
++      
++      if (n->data->type == data_D1009)
++      {
++        D1009 * d1009;
++        d1009 = n->data->data;
++        PyDict_SetItem(run, PyString_FromString("multisport"), PyBool_FromLong(d1009->multisport));
++        switch (d1009->sport_type)
++        {
++          case D1000_running:
++            PyDict_SetItem(run, PyString_FromString("sport"), PyString_FromString("running"));
++            break;
++          case D1000_biking:
++            PyDict_SetItem(run, PyString_FromString("sport"), PyString_FromString("biking"));
++            break;
++          case D1000_other:
++            PyDict_SetItem(run, PyString_FromString("sport"), PyString_FromString("other"));
++            break;            
++        }
++      }
++
++      if (verbose != 0)
++        printf("[garmin] run: track [%d], laps [%d:%d]\n",trk,f_lap,l_lap);
++      
++      for ( m = laps->head; m != NULL; m = m->next )
++      {
++        if ( get_lap_index(m->data, &l_idx) != 0 )
++        {
++          if ( l_idx >= f_lap && l_idx <= l_lap )
++          {
++            PyObject* lap = PyDict_New();
++            
++            if (verbose != 0)
++              printf("[garmin] lap [%d] falls within laps [%d:%d]\n", l_idx,f_lap,l_lap);
++            
++            start = 0;
++            get_lap_start_time(m->data, &start);
++
++            if (start != 0)
++            {
++              if (l_idx == f_lap)
++                  f_lap_start = start;
++
++              PyDict_SetItem(lap, PyString_FromString("start_time"), Py_BuildValue("i", (int)start));
++              PyDict_SetItem(lap, PyString_FromString("type"), Py_BuildValue("i", (int)m->data->type));
++
++              if (m->data->type == data_D1015)
++              {
++                D1015 * d1015;
++                d1015 = m->data->data;
++                PyDict_SetItem(lap, PyString_FromString("duration"), Py_BuildValue("i", d1015->total_time));
++                PyDict_SetItem(lap, PyString_FromString("distance"), Py_BuildValue("f", d1015->total_dist));
++                PyDict_SetItem(lap, PyString_FromString("max_speed"), Py_BuildValue("f", d1015->max_speed));
++              }
++
++              PyObject * points = PyList_New(0);
++              
++              bool have_track = 0;
++              bool done = 0;
++                
++              for ( o = tracks->head; o != NULL; o = o->next )
++              {
++                if ( o->data != NULL )
++                {
++                  if (o->data->type == data_D311)
++                  {
++                    if ( ! have_track )
++                    {
++                      D311 * d311;
++                      d311 = o->data->data;
++                      if (  d311->index == trk )
++                          have_track = 1;
++                    }
++                    else /* We've reached the end of the track */
++                        done = 1;
++                  }
++                  
++                  else if (o->data->type == data_D304 && have_track)
++                  {
++                    D304 * d304;
++                    d304 = o->data->data;
++                    PyObject* point = PyDict_New();
++                    
++                    if (d304->posn.lat != 2147483647 && d304->posn.lon != 2147483647)
++                    {
++                      PyDict_SetItem(point, PyString_FromString("position"), Py_BuildValue("(ff)", SEMI2DEG(d304->posn.lat), SEMI2DEG(d304->posn.lon)));
++                      PyDict_SetItem(point, PyString_FromString("type"), Py_BuildValue("i", (int)o->data->type));
++                      PyDict_SetItem(point, PyString_FromString("time"), Py_BuildValue("f", (float)(d304->time + TIME_OFFSET)));
++                      PyDict_SetItem(point, PyString_FromString("distance"), Py_BuildValue("f", d304->distance));
++                      PyDict_SetItem(point, PyString_FromString("altitude"), Py_BuildValue("f", d304->alt));
++                      PyDict_SetItem(point, PyString_FromString("heart_rate"), Py_BuildValue("i", d304->heart_rate));
++                      
++                      if (d304->cadence != 255)
++                          PyDict_SetItem(point, PyString_FromString("cadence"), Py_BuildValue("i", d304->cadence));
++                      
++                      PyList_Append(points, Py_BuildValue("N", point));
++                    }
++                  }
++                  
++                  else if (have_track)
++                      printf("get_track: point type %d invalid!\n",o->data->type);
++                  }
++
++                if ( done ) break;
++              }
++              PyDict_SetItem(lap, PyString_FromString("points"), Py_BuildValue("N", points));
++            }
++            else
++                PyErr_Warn(PyExc_Warning, "Start time of first lap not found.");
++            
++            PyDict_SetItem(rlaps, PyString_FromFormat("%d", (int)l_idx), Py_BuildValue("N", lap));
++          }
++        }  
++      }
++      PyDict_SetItem(run, PyString_FromString("laps"), Py_BuildValue("N", rlaps));
++      PyDict_SetItem(dict, PyString_FromFormat("%d", (int)f_lap_start), Py_BuildValue("N", run));
++    }
++  }
++
++  garmin_free_data(data);
++  garmin_close(&garmin);
++
++  return Py_BuildValue("N", dict);  
++}
++
++
++/* Assign python names to the exported functions */
++
++static PyMethodDef MethodTable[] = {
++  {"toggle_verbose", toggle_verbose, METH_VARARGS, "Toggle verbose flag and return its new state, True if turned on, False else."},
++  {"get_verbose", get_verbose, METH_VARARGS, "Return the current state of the verbose flag, True if turned on, False else."},
++  {"get_info", get_info, METH_VARARGS, "Return a dictionary with information about the attached unit."},
++  {"get_runs", get_runs, METH_VARARGS, "Return a dictionary with all runs stored on the attached unit."},
++  {NULL, NULL, 0, NULL}
++};
++
++
++/* Initialize pygarmin as python extension */
++
++PyMODINIT_FUNC initpygarmin(void)
++{
++  PyObject* module = 0;
++  module = Py_InitModule3("pygarmin", MethodTable, "Python bindings for garmintools");
++
++  if (module == 0)
++    PyErr_SetString(PyExc_RuntimeError, "Failure on Py_InitModule3.");
++}
+--- /dev/null
++++ garmin-forerunner-tools-0.10repacked/python/setup.py
+@@ -0,0 +1,49 @@
++#! /usr/bin/env python
++
++import sys
++
++sources = ['pygarmin.c']
++include_dirs = ['../src']
++library_dirs = []
++libraries = ['garmin']
++
++argv = []
++
++for arg in sys.argv :
++
++    usb_libs = arg.split('--usb_libs=')
++    if len(usb_libs) == 2 and usb_libs[0] == '' and usb_libs[1] != '' :
++        for lib in usb_libs[1].split(' ') :
++            if lib[1] == 'L' :
++                library_dirs.append(lib.replace('-L', ''))
++            if lib[1] == 'l' :
++                libraries.append(lib.replace('-l', ''))
++
++    usb_cflags = arg.split('--usb_cflags=')
++    if len(usb_cflags) == 2 and usb_cflags[0] == '' and usb_cflags[1] != '' :
++        for cflag in usb_cflags[1].split(' ') :
++            if cflag[1] == 'I' :
++                include_dirs.append(cflag.replace('-I', ''))
++
++    libdir = arg.split('--libdir=')
++    if len(libdir) == 2 and libdir[0] == '' and libdir[1] != '' :
++        library_dirs.append(libdir[1])
++
++    if arg.count("--prefix=") == 1 :
++        argv = [arg]
++
++sys.argv = sys.argv[0:2] + argv
++
++from distutils.core import setup, Extension
++
++extension = Extension('garmintools.pygarmin',
++                      include_dirs = include_dirs,
++                      libraries = libraries,
++                      library_dirs = library_dirs,
++                      sources = sources)
++
++setup (name = 'garmintools',
++       version = '0.1',
++       description = 'Python bindings for garmintools',
++       ext_modules = [extension],
++       packages = ['garmintools'])

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-running/garmin-forerunner-tools.git



More information about the Pkg-running-devel mailing list