commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r11373 - gnuradio/trunk/debian


From: jcorgan
Subject: [Commit-gnuradio] r11373 - gnuradio/trunk/debian
Date: Mon, 6 Jul 2009 16:36:54 -0600 (MDT)

Author: jcorgan
Date: 2009-07-06 16:36:54 -0600 (Mon, 06 Jul 2009)
New Revision: 11373

Added:
   gnuradio/trunk/debian/prefs.py
Modified:
   gnuradio/trunk/debian/changelog
   gnuradio/trunk/debian/rules
Log:
Temporary binary packaging update (3.3svn-1) to deal with prefs.py not handling 
--prefix=/usr correctly.

Modified: gnuradio/trunk/debian/changelog
===================================================================
--- gnuradio/trunk/debian/changelog     2009-07-06 09:06:06 UTC (rev 11372)
+++ gnuradio/trunk/debian/changelog     2009-07-06 22:36:54 UTC (rev 11373)
@@ -1,6 +1,12 @@
+gnuradio (3.3svn-1) unstable; urgency=high
+
+  * Fix broken prefs.py when installed in --prefix=/usr
+
+ -- Johnathan Corgan <address@hidden>  Sun,  06 Jul 2009 16:00:00 -0800
+
 gnuradio (3.3svn) unstable; urgency=low
 
-  * Development trunk updates as of packaging date
+  * Development trunk updates as of revision 11370
   * See http://gnuradio.org/trac
 
  -- Johnathan Corgan <address@hidden>  Sun,  05 Jul 2009 18:00:00 -0800

Copied: gnuradio/trunk/debian/prefs.py (from rev 11361, 
gnuradio/trunk/gnuradio-core/src/python/gnuradio/gr/prefs.py)
===================================================================
--- gnuradio/trunk/debian/prefs.py                              (rev 0)
+++ gnuradio/trunk/debian/prefs.py      2009-07-06 22:36:54 UTC (rev 11373)
@@ -0,0 +1,126 @@
+#
+# Copyright 2006,2009 Free Software Foundation, Inc.
+# 
+# This file is part of GNU Radio
+# 
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+# 
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+# 
+
+import gnuradio_swig_python as gsp
+_prefs_base = gsp.gr_prefs
+
+
+import ConfigParser
+import os
+import os.path
+import sys
+
+
+def _user_prefs_filename():
+    return os.path.expanduser('~/.gnuradio/config.conf')
+        
+def _sys_prefs_dirname():
+    return '/etc/gnuradio/conf.d'
+
+def _bool(x):
+    """
+    Try to coerce obj to a True or False
+    """
+    if isinstance(x, bool):
+        return x
+    if isinstance(x, (float, int)):
+        return bool(x)
+    raise TypeError, x
+        
+
+class _prefs(_prefs_base):
+    """
+    Derive our 'real class' from the stubbed out base class that has support
+    for SWIG directors.  This allows C++ code to magically and transparently
+    invoke the methods in this python class.
+    """
+    def __init__(self):
+       _prefs_base.__init__(self)
+       self.cp = ConfigParser.RawConfigParser()
+       self.__getattr__ = lambda self, name: getattr(self.cp, name)
+
+    def _sys_prefs_filenames(self):
+        dir = _sys_prefs_dirname()
+        try:
+            fnames = os.listdir(dir)
+        except (IOError, OSError):
+            return []
+        fnames.sort()
+        return [os.path.join(dir, f) for f in fnames]
+
+    def _read_files(self):
+        filenames = self._sys_prefs_filenames()
+        filenames.append(_user_prefs_filename())
+        #print "filenames: ", filenames
+        self.cp.read(filenames)
+
+    # ----------------------------------------------------------------
+    # These methods override the C++ virtual methods of the same name
+    # ----------------------------------------------------------------
+    def has_section(self, section):
+        return self.cp.has_section(section)
+
+    def has_option(self, section, option):
+        return self.cp.has_option(section, option)
+
+    def get_string(self, section, option, default_val):
+        try:
+            return self.cp.get(section, option)
+        except:
+            return default_val
+
+    def get_bool(self, section, option, default_val):
+        try:
+            return self.cp.getboolean(section, option)
+        except:
+            return default_val
+
+    def get_long(self, section, option, default_val):
+        try:
+            return self.cp.getint(section, option)
+        except:
+            return default_val
+        
+    def get_double(self, section, option, default_val):
+        try:
+            return self.cp.getfloat(section, option)
+        except:
+            return default_val
+    # ----------------------------------------------------------------
+    #              End override of C++ virtual methods
+    # ----------------------------------------------------------------
+
+
+_prefs_db = _prefs()
+
+# if GR_DONT_LOAD_PREFS is set, don't load them.
+# (make check uses this to avoid interactions.)
+if os.getenv("GR_DONT_LOAD_PREFS", None) is None:
+    _prefs_db._read_files()
+    
+
+_prefs_base.set_singleton(_prefs_db)    # tell C++ what instance to use
+
+def prefs():
+    """
+    Return the global preference data base
+    """
+    return _prefs_db


Property changes on: gnuradio/trunk/debian/prefs.py
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:mergeinfo
   + 
/gnuradio/branches/developers/eb/t348/gnuradio-core/src/python/gnuradio/gr/prefs.py:10638-10648
/gnuradio/branches/developers/eb/t364/gnuradio-core/src/python/gnuradio/gr/prefs.py:11016-11017
/gnuradio/branches/developers/eb/t367/gnuradio-core/src/python/gnuradio/gr/prefs.py:11021-11025
/gnuradio/branches/developers/eb/t371/gnuradio-core/src/python/gnuradio/gr/prefs.py:10958-10971
/gnuradio/branches/developers/eb/t378/gnuradio-core/src/python/gnuradio/gr/prefs.py:10683-10688
/gnuradio/branches/developers/jblum/grc/gnuradio-core/src/python/gnuradio/gr/prefs.py:10680-10938,11187-11273,11310-11357
/gnuradio/branches/developers/jblum/gui_guts/gnuradio-core/src/python/gnuradio/gr/prefs.py:10464-10658
/gnuradio/branches/developers/jblum/vlen/gnuradio-core/src/python/gnuradio/gr/prefs.py:10667-10677
/gnuradio/branches/developers/jblum/wxgui/gnuradio-core/src/python/gnuradio/gr/prefs.py:11125-11183
/gnuradio/branches/developers/jcorgan/cpphier/gnuradio-core/src/python/gnuradio/gr/prefs.py:10818-10858
/gnuradio/branches/developers/jcorgan/deb/gnuradio-core/src/python/gnuradio/gr/prefs.py:10949-10959,11013-11022,11046-11059,11075-11077
/gnuradio/branches/developers/jcorgan/fw-optimize/gnuradio-core/src/python/gnuradio/gr/prefs.py:10428-10429
/gnuradio/branches/developers/jcorgan/gpio2/gnuradio-core/src/python/gnuradio/gr/prefs.py:10713-10765
/gnuradio/branches/developers/jcorgan/iad2/gnuradio-core/src/python/gnuradio/gr/prefs.py:10771-10887
/gnuradio/branches/developers/jcorgan/np/gnuradio-core/src/python/gnuradio/gr/prefs.py:11124-11148
/gnuradio/branches/developers/jcorgan/t161/gnuradio-core/src/python/gnuradio/gr/prefs.py:10876-10880
/gnuradio/branches/developers/michaelld/am_swig_4/gnuradio-core/src/python/gnuradio/gr/prefs.py:10555-10595
/gnuradio/branches/developers/michaelld/two_mods/gnuradio-core/src/python/gnuradio/gr/prefs.py:10540-10546
/gnuradio/branches/developers/trondeau/qt/gnuradio-core/src/python/gnuradio/gr/prefs.py:11235-11360
Added: svn:eol-style
   + native

Modified: gnuradio/trunk/debian/rules
===================================================================
--- gnuradio/trunk/debian/rules 2009-07-06 09:06:06 UTC (rev 11372)
+++ gnuradio/trunk/debian/rules 2009-07-06 22:36:54 UTC (rev 11373)
@@ -90,10 +90,15 @@
        install -m 0644 -D debian/grc.conf \
                debian/tmp/etc/gnuradio/conf.d/grc.conf
 
+       : # Install custom prefs.py FIXME
+       install -m 0644 -D debian/prefs.py \
+               debian/tmp/usr/lib/python2.6/dist-packages/gnuradio/gr/prefs.py
+
        dh_install --sourcedir=debian/tmp
        touch $@
 
 
+
 # Must not depend on anything. This is to be called by
 # binary-arch/binary-indep
 # in another 'make' thread.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]