Bug#569730: agtl: please make the package usable with Python 2.6

2010-02-14 Thread Heiko Stübner
Am Samstag 13 Februar 2010 22:46:31 schrieben Sie:
 * Heiko Stübner he...@sntech.de, 2010-02-13, 22:31:
 Do you have ideas what causes this?
 
 Wild guess: you have python-json installed?
You're right :-). Didn't remember I installed it from the time I tried to 
follow these simplejson - json changes and wrongly found python-json first.

Without python-json agtl starts again.

But how do we solve this python-json problem?
At first glance a conflicts python-json seems bad to me, are there other - 
better solutions?

Heiko



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/201002141310.26782.he...@sntech.de



Bug#569730: agtl: please make the package usable with Python 2.6

2010-02-14 Thread Jakub Wilk

* Heiko Stübner he...@sntech.de, 2010-02-14, 13:10:

Do you have ideas what causes this?

Wild guess: you have python-json installed?

You're right :-). Didn't remember I installed it from the time I tried to
follow these simplejson - json changes and wrongly found python-json first.

Without python-json agtl starts again.

But how do we solve this python-json problem?
At first glance a conflicts python-json seems bad to me, are there other -
better solutions?


The following snippet should work:

try:
import json
json.dumps
except (ImportError, AttributeError):
import simplejson as json


Anyway, this a more general problem:
http://lists.debian.org/debian-python/2010/02/msg00013.html

--
Jakub Wilk


signature.asc
Description: Digital signature


Bug#569730: agtl: please make the package usable with Python 2.6

2010-02-14 Thread Heiko Stübner
Am Sonntag 14 Februar 2010 15:02:07 schrieben Sie:
 The following snippet should work:
 
 try:
  import json
  json.dumps
 except (ImportError, AttributeError):
  import simplejson as json
cool ... works like a charm :-)

New agtl-version which fixes both of your bugs will be up in a minute.

Thanks for your help.

Heiko



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/201002141623.26750.he...@sntech.de



Bug#569730: agtl: please make the package usable with Python 2.6

2010-02-13 Thread Jakub Wilk

Package: agtl
Version: 0.5.1-1
Severity: important
User: debian-pyt...@lists.debian.org
Usertags: python2.6

Hello,

Your package harcodes 2.5 as the Python version. However, we expect 
Python 2.6 to be the default version in Debian soon. The attached, not 
very well tested patch, seems to fix this problem.


--
Jakub Wilk
diff -u agtl-0.5.1/debian/control agtl-0.5.1/debian/control
--- agtl-0.5.1/debian/control
+++ agtl-0.5.1/debian/control
@@ -3,7 +3,7 @@
 Priority: extra
 Maintainer: Heiko Stuebner he...@sntech.de
 DM-Upload-Allowed: yes
-Build-Depends: debhelper (= 5.0.38), cdbs (= 0.4.49), python2.5-dev (= 2.3.5-11), python-support (= 0.5.3), python-setuptools, cython
+Build-Depends: debhelper (= 5.0.38), cdbs (= 0.4.49), python (= 2.5), python-support (= 0.5.3), python-setuptools, cython
 Standards-Version: 3.8.3
 Homepage: http://wiki.openmoko.org/wiki/Advanced_Geocaching_Tool_for_Linux
 Vcs-git: git://git.debian.org/pkg-fso/advancedcaching.git
@@ -12,7 +12,7 @@
 XB-Python-Version: ${python:Versions}
 Provides: ${python:Provides}
 Architecture: all
-Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, python-gtk2, python-simplejson
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, python-gtk2, python (= 2.6) | python-simplejson
 Description: Tool for paperless geocaching
  AGTL downloads cache locations in the area visible on the map
  including their description, hints, difficulty levels and images.
diff -u agtl-0.5.1/debian/changelog agtl-0.5.1/debian/changelog
--- agtl-0.5.1/debian/changelog
+++ agtl-0.5.1/debian/changelog
@@ -1,3 +1,10 @@
+agtl (0.5.1-1.1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * 
+
+ -- Jakub Wilk jw...@debian.org  Sat, 13 Feb 2010 20:30:34 +0100
+
 agtl (0.5.1-1) unstable; urgency=low
 
   * New upstream release
diff -u agtl-0.5.1/debian/pyversions agtl-0.5.1/debian/pyversions
--- agtl-0.5.1/debian/pyversions
+++ agtl-0.5.1/debian/pyversions
@@ -1 +1 @@
-2.5
+2.5-
diff -u agtl-0.5.1/debian/patches/0002-change-json-module-to-the-python2.5-equivalent-simpl.patch agtl-0.5.1/debian/patches/0002-change-json-module-to-the-python2.5-equivalent-simpl.patch
--- agtl-0.5.1/debian/patches/0002-change-json-module-to-the-python2.5-equivalent-simpl.patch
+++ agtl-0.5.1/debian/patches/0002-change-json-module-to-the-python2.5-equivalent-simpl.patch
@@ -6,135 +6,45 @@

- files/advancedcaching/core.py   |6 +++---
- files/advancedcaching/geocaching.py |   18 +-
- files/advancedcaching/geonames.py   |6 +++---
- 3 files changed, 15 insertions(+), 15 deletions(-)
-
-diff --git a/files/advancedcaching/core.py b/files/advancedcaching/core.py
-index 5eba559..8b665ce 100755
 a/files/advancedcaching/core.py
-+++ b/files/advancedcaching/core.py
-@@ -117,7 +117,7 @@ Just start the string with 'q:':
+diff -Nur -x '*.orig' -x '*~' agtl-0.5.1/files/advancedcaching/core.py agtl-0.5.1.new/files/advancedcaching/core.py
+--- agtl-0.5.1/files/advancedcaching/core.py	2010-02-13 20:34:56.0 +0100
 agtl-0.5.1.new/files/advancedcaching/core.py	2010-02-13 20:37:22.0 +0100
+@@ -117,7 +117,10 @@
  
  
  from geo import Coordinate
 -import json
-+import simplejson
++try:
++import json
++except ImportError:
++import simplejson as json
  import sys
  
  import downloader
-@@ -472,7 +472,7 @@ class Core():
- string = f.read()
- self.settings = {}
- if string != '':
--tmp_settings = json.loads(string)
-+tmp_settings = simplejson.loads(string)
- for k, v in self.DEFAULT_SETTINGS.items():
- if k in tmp_settings.keys() != None:
- self.settings[k] = tmp_settings[k]
-@@ -494,7 +494,7 @@ class Core():
- def __write_config(self):
- filename = os.path.join(self.SETTINGS_DIR, 'config')
- f = file(filename, 'w')
--f.write(json.dumps(self.settings, sort_keys=True, indent=4))
-+f.write(simplejson.dumps(self.settings, sort_keys=True, indent=4))
- 
- 
- def determine_path ():
-diff --git a/files/advancedcaching/geocaching.py b/files/advancedcaching/geocaching.py
-index 133e371..69ad67e 100644
 a/files/advancedcaching/geocaching.py
-+++ b/files/advancedcaching/geocaching.py
-@@ -18,7 +18,7 @@
+diff -Nur -x '*.orig' -x '*~' agtl-0.5.1/files/advancedcaching/geocaching.py agtl-0.5.1.new/files/advancedcaching/geocaching.py
+--- agtl-0.5.1/files/advancedcaching/geocaching.py	2010-02-13 20:34:56.0 +0100
 agtl-0.5.1.new/files/advancedcaching/geocaching.py	2010-02-13 20:37:05.0 +0100
+@@ -18,7 +18,10 @@
  #Author: Daniel Fett advancedcach...@fragcom.de
  #
  
 -import json
-+import simplejson
++try:
++import json
++except ImportError:
++import simplejson as json	 
  import math
  import geo
  import os
-@@ -166,26 +166,26 @@ class GeocacheCoordinate(geo.Coordinate):
- def get_waypoints(self):
- if self.waypoints == None or self.waypoints == '':
- 

Bug#569730: agtl: please make the package usable with Python 2.6

2010-02-13 Thread Jakub Wilk

* Heiko Stübner he...@sntech.de, 2010-02-13, 22:31:

Am Samstag 13 Februar 2010 21:11:05 schrieben Sie:

Package: agtl
Version: 0.5.1-1
Severity: important
User: debian-pyt...@lists.debian.org
Usertags: python2.6

Hello,

Your package harcodes 2.5 as the Python version. However, we expect
Python 2.6 to be the default version in Debian soon. The attached, not
very well tested patch, seems to fix this problem.


It seems not to be this easy :-)

The solution to wrap the json-import in a try-catch block seems nice but it
seems the access to the static methods doesn't work with the renamed module.

When starting agtl with your patch the result is as follows:

Traceback (most recent call last):
 File /usr/bin/agtl, line 4, in module
   advancedcaching.core.start ()
 File /usr/lib/pymodules/python2.5/advancedcaching/core.py, line 517, in
start
   Core(gui, determine_path())
 File /usr/lib/pymodules/python2.5/advancedcaching/core.py, line 227, in
__init__
   self.__read_config()
 File /usr/lib/pymodules/python2.5/advancedcaching/core.py, line 478, in
__read_config
   tmp_settings = json.loads(string)
AttributeError: 'module' object has no attribute 'loads'


Do you have ideas what causes this?


Wild guess: you have python-json installed?

--
Jakub Wilk


signature.asc
Description: Digital signature


Bug#569730: agtl: please make the package usable with Python 2.6

2010-02-13 Thread Heiko Stübner
Am Samstag 13 Februar 2010 21:11:05 schrieben Sie:
 Package: agtl
 Version: 0.5.1-1
 Severity: important
 User: debian-pyt...@lists.debian.org
 Usertags: python2.6
 
 Hello,
 
 Your package harcodes 2.5 as the Python version. However, we expect
 Python 2.6 to be the default version in Debian soon. The attached, not
 very well tested patch, seems to fix this problem.

It seems not to be this easy :-)

The solution to wrap the json-import in a try-catch block seems nice but it 
seems the access to the static methods doesn't work with the renamed module.

When starting agtl with your patch the result is as follows:

Traceback (most recent call last):
  File /usr/bin/agtl, line 4, in module
advancedcaching.core.start ()
  File /usr/lib/pymodules/python2.5/advancedcaching/core.py, line 517, in 
start
Core(gui, determine_path())
  File /usr/lib/pymodules/python2.5/advancedcaching/core.py, line 227, in 
__init__
self.__read_config()
  File /usr/lib/pymodules/python2.5/advancedcaching/core.py, line 478, in 
__read_config
tmp_settings = json.loads(string)
AttributeError: 'module' object has no attribute 'loads'


Do you have ideas what causes this?

Heiko



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org