[mirrorbrain-commits] r8291 - /trunk/mb/mb/geoip.py

From: <poeml_at_mirrorbrain.org>
Date: Wed, 02 May 2012 23:02:24 -0000
Author: poeml
Date: Thu May  3 01:02:24 2012
New Revision: 8291

URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=8291&view=rev
Log:
mb update:
- the geoiplookup and geoiplookup_city binaries are now also looked for
  in /usr/share/mirrorbrain. Helps for packaging cleanup issue #110.

Modified:
    trunk/mb/mb/geoip.py

Modified: trunk/mb/mb/geoip.py
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mb/mb/geoip.py?rev=8291&r1=8290&r2=8291&view=diff
==============================================================================
--- trunk/mb/mb/geoip.py	(original)
+++ trunk/mb/mb/geoip.py	Thu May  3 01:02:24 2012
_at_@ -2,6 +2,8 @@
 import os
 from subprocess import Popen, PIPE
 import errno
+
+ENV = {'PATH': ':'.join([os.getenv('PATH'), '/usr/share/mirrorbrain'])}
 
 # try different databases and different locations
 databases = ['/var/lib/GeoIP/GeoLiteCity.dat.updated', 
_at_@ -29,7 +31,7 @@
 
 
 def lookup_country_code(addr):
-    out = Popen(['geoiplookup', '-f', database, addr], stdout=PIPE).communicate()[0]
+    out = Popen(['geoiplookup', '-f', database, addr], env=ENV, stdout=PIPE).communicate()[0]
     out = out.split(':')[1].strip().split(',')[0]
 
     return out.lower()
_at_@ -37,7 +39,7 @@
 
 def lookup_region_code(addr):
     try:
-        out = Popen(['geoiplookup_continent', '-f', database, addr], stdout=PIPE).communicate()[0]
+        out = Popen(['geoiplookup_continent', '-f', database, addr], env=ENV, stdout=PIPE).communicate()[0]
     except OSError, e:
         if e.errno == errno.ENOENT:
             sys.exit('Error: The geoiplookup_continent binary could not be found.\n'
_at_@ -47,7 +49,7 @@
 
 def lookup_coordinates(addr):
     try:
-        out = Popen(['geoiplookup_city', '-f', database, addr], stdout=PIPE).communicate()[0]
+        out = Popen(['geoiplookup_city', '-f', database, addr], env=ENV, stdout=PIPE).communicate()[0]
     except OSError, e:
         if e.errno == errno.ENOENT:
             sys.exit('Error: The geoiplookup_city binary could not be found.\n'




_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Wed May 02 2012 - 23:02:24 GMT

This archive was generated by hypermail 2.3.0 : Wed May 02 2012 - 23:17:03 GMT