Author: dmeyer
Date: Fri Oct 27 19:09:55 2006
New Revision: 8489

Removed:
   trunk/ui/src/sysconfig.py
Modified:
   trunk/ui/src/application/childapp.py
   trunk/ui/src/application/eventhandler.py
   trunk/ui/src/audio/audiodiskitem.py
   trunk/ui/src/config/__init__.py
   trunk/ui/src/config/configfile.py
   trunk/ui/src/config/xine.py
   trunk/ui/src/gui/areas/handler.py
   trunk/ui/src/gui/fxdparser.py
   trunk/ui/src/gui/theme.py
   trunk/ui/src/menu/__init__.py
   trunk/ui/src/util/cache.py
   trunk/ui/src/video/database.py
   trunk/ui/src/video/plugins/bookmarker.py

Log:
remove sysconfig.py

Modified: trunk/ui/src/application/childapp.py
==============================================================================
--- trunk/ui/src/application/childapp.py        (original)
+++ trunk/ui/src/application/childapp.py        Fri Oct 27 19:09:55 2006
@@ -39,7 +39,7 @@
 import kaa.notifier
 
 # Freevo imports
-import sysconfig
+import freevo.conf
 import config
 import gui
 
@@ -106,7 +106,7 @@
         logname = cmd[0]
         if logname.rfind('/') > 0:
             logname = logname[ logname.rfind( '/' ) + 1 : ]
-        logname = sysconfig.logfile(logname)
+        logname = freevo.conf.logfile(logname)
         
        # create the process
         self.__child = kaa.notifier.Process(cmd, logname)

Modified: trunk/ui/src/application/eventhandler.py
==============================================================================
--- trunk/ui/src/application/eventhandler.py    (original)
+++ trunk/ui/src/application/eventhandler.py    Fri Oct 27 19:09:55 2006
@@ -52,7 +52,6 @@
 import kaa.notifier
 
 # freevo imports
-import sysconfig
 import config
 import plugin
 import input

Modified: trunk/ui/src/audio/audiodiskitem.py
==============================================================================
--- trunk/ui/src/audio/audiodiskitem.py (original)
+++ trunk/ui/src/audio/audiodiskitem.py Fri Oct 27 19:09:55 2006
@@ -38,7 +38,6 @@
 import os
 
 # Freevo imports
-import sysconfig
 import config
 
 from menu import Action, Menu

Modified: trunk/ui/src/config/__init__.py
==============================================================================
--- trunk/ui/src/config/__init__.py     (original)
+++ trunk/ui/src/config/__init__.py     Fri Oct 27 19:09:55 2006
@@ -47,14 +47,14 @@
 import os
 import re
 import pwd
-import __builtin__
 import logging
 import copy
 
+import kaa.strutils
+
 import freevo.conf
 
 # freevo imports
-import sysconfig
 import version
 
 # config imports
@@ -72,27 +72,48 @@
 # get logging object
 log = logging.getLogger('config')
 
-# set global app name
-app = os.path.splitext(os.path.basename(sys.argv[0]))[0]
-__builtin__.__dict__['__freevo_app__'] = app
-
-
-# XXX ************************************************************
-
-# XXX The following code will be removed before the next release
-# XXX Please do NOT use this varaibles anymore and fix code were it
-# XXX is used.
-
-# use sysconfig code
-FREEVO_CACHEDIR = sysconfig.CONF.cachedir
-
-# XXX ************************************************************
+# set app name
+freevo_app = os.path.splitext(os.path.basename(sys.argv[0]))[0]
 
 #
 # Default settings
 # These will be overwritten by the contents of 'freevo.conf'
 #
-CONF = sysconfig.CONF
+
+# Dummy class for the CONF
+class struct(object):
+    pass
+
+CONF = struct()
+
+CONF.cachedir = freevo.conf.CACHEDIR
+CONF.datadir  = freevo.conf.DATADIR
+CONF.logdir   = freevo.conf.LOGDIR
+
+CONFIGFILE = ''
+
+# read the config file, if no file is found, the default values
+# are used.
+for dirname in freevo.conf.cfgfilepath:
+    conffile = os.path.join(dirname, 'freevo.conf')
+    if os.path.isfile(conffile):
+        c = open(conffile)
+        for line in c.readlines():
+            if line.startswith('#'):
+                continue
+            if line.find('=') == -1:
+                continue
+            vals = line.strip().split('=')
+            if not len(vals) == 2:
+                print 'invalid config entry: %s' % line
+                continue
+            name, val = vals[0].strip(), vals[1].strip()
+            CONF.__dict__[name] = val
+
+        c.close()
+        CONFIGFILE = conffile
+        break
+
 if not hasattr(CONF, 'geometry'):
     CONF.geometry = '800x600'
 w, h = CONF.geometry.split('x')
@@ -132,7 +153,7 @@
 # fall back to x11 if display is mga or fb and DISPLAY ist set
 # or switch to fbdev if we have no DISPLAY and x11 or dga is used
 #
-if __freevo_app__ == 'main':
+if freevo_app == 'main':
     if os.environ.has_key('DISPLAY') and os.environ['DISPLAY']:
         if CONF.display in ('mga', 'fbdev'):
             print
@@ -205,7 +226,7 @@
             x.append(('Home', os.environ['HOME']))
         x.append(('Root', '/'))
         exec('%s = x' % n)
-        if __freevo_app__ == 'main' and plugin.is_active('mediamenu', type):
+        if freevo_app == 'main' and plugin.is_active('mediamenu', type):
             log.warning('%s not set, set it to Home directory' % n)
 
     elif type == 'games':
@@ -260,10 +281,10 @@
            '  Please set TV_RECORD_DIR to the directory, where recordings\n' +
            '  should be stored or remove the tv plugin. Autoset variable\n' +
            '  to %s.') % TV_RECORD_DIR
-    if __freevo_app__ == 'main' and plugin.is_active('tv'):
+    if freevo_app == 'main' and plugin.is_active('tv'):
         log.warning(msg)
         
-if not VIDEO_SHOW_DATA_DIR and __freevo_app__ == 'main':
+if not VIDEO_SHOW_DATA_DIR and freevo_app == 'main':
     log.warning('VIDEO_SHOW_DATA_DIR not found')
     
 
@@ -292,7 +313,7 @@
 
 try:
     LOCALE
-    log.critical('LOCALE is deprecated. Set encoding in freevo.conf.')
+    log.critical('LOCALE is deprecated.')
     sys.exit(0)
 except NameError, e:
     pass
@@ -304,14 +325,3 @@
     sys.exit(0)
 except NameError, e:
     pass
-
-
-# Please do not use the variables anymore
-encoding = LOCALE = sysconfig.CONF.encoding
-
-# Some warnings used in development
-REDESIGN_MAINLOOP = 'not working while mainloop redesign'
-REDESIGN_BROKEN   = 'not working while gui redesign'
-REDESIGN_FIXME    = 'not working since gui redesign, feel free to fix this'
-REDESIGN_UNKNOWN  = 'plugin may be broken after gui redesign, please check'
-

Modified: trunk/ui/src/config/configfile.py
==============================================================================
--- trunk/ui/src/config/configfile.py   (original)
+++ trunk/ui/src/config/configfile.py   Fri Oct 27 19:09:55 2006
@@ -70,7 +70,7 @@
 # Check if freevo.conf was found
 #
 
-if not sysconfig.CONFIGFILE:
+if not CONFIGFILE:
     log.critical('freevo.conf not found, please run \'freevo setup\'')
     sys.exit(1)
     

Modified: trunk/ui/src/config/xine.py
==============================================================================
--- trunk/ui/src/config/xine.py (original)
+++ trunk/ui/src/config/xine.py Fri Oct 27 19:09:55 2006
@@ -51,11 +51,11 @@
 import os
 import stat
 
-import sysconfig
+import freevo.conf
 import config
 import util.cache
 
-cache = util.cache.Cache(sysconfig.cachefile('xine', True), config, 1)
+cache = util.cache.Cache(freevo.conf.cachefile('xine', True), config, 1)
 
 if config.CONF.xine and os.path.exists(config.CONF.xine):
     timestamp = os.stat(config.CONF.xine)[stat.ST_MTIME]

Modified: trunk/ui/src/gui/areas/handler.py
==============================================================================
--- trunk/ui/src/gui/areas/handler.py   (original)
+++ trunk/ui/src/gui/areas/handler.py   Fri Oct 27 19:09:55 2006
@@ -46,6 +46,8 @@
 import traceback
 import time
 
+import freevo.conf
+
 import logging
 log = logging.getLogger('gui')
 
@@ -107,8 +109,7 @@
             # Use a weakref to avoid memory problems.
             a.set_screen(weakref(self))
             
-        self.storage_file = os.path.join(config.FREEVO_CACHEDIR,
-                                         'skin-%s' % os.getuid())
+        self.storage_file = freevo.conf.cachefile('skin', True)
         self.display_style['menu'] = 0
         if os.path.isfile(self.storage_file):
             self.storage = util.cache.load(self.storage_file)

Modified: trunk/ui/src/gui/fxdparser.py
==============================================================================
--- trunk/ui/src/gui/fxdparser.py       (original)
+++ trunk/ui/src/gui/fxdparser.py       Fri Oct 27 19:09:55 2006
@@ -42,9 +42,6 @@
 # xml support
 from xml.utils import qp_xml
 
-# freevo utils
-import sysconfig
-
 class XMLnode(object):
     """
     One node for the FXDtree

Modified: trunk/ui/src/gui/theme.py
==============================================================================
--- trunk/ui/src/gui/theme.py   (original)
+++ trunk/ui/src/gui/theme.py   Fri Oct 27 19:09:55 2006
@@ -52,8 +52,10 @@
 
 # kaa imports
 import kaa.notifier
+import kaa.strutils
 
 # freevo imports
+import freevo.conf
 import config
 import util
 import plugin
@@ -226,7 +228,7 @@
             if node.attrs[('', attr)][:2] == '0x':
                 return long(node.attrs[('', attr)], 16)
             else:
-                return node.attrs[('', attr)].encode(config.LOCALE)
+                return node.attrs[('', attr)].encode(kaa.strutils.ENCODING)
     except ValueError:
         pass
     return default
@@ -239,7 +241,7 @@
     if node.attrs.has_key(('', attr)):
         if node.attrs[('', attr)] == "no":
             return ''
-        return node.attrs[('', attr)].encode(config.LOCALE)
+        return node.attrs[('', attr)].encode(kaa.strutils.ENCODING)
     return default
 
 
@@ -248,7 +250,7 @@
     return the attribute as string
     """
     if node.attrs.has_key(('', attr)):
-        return node.attrs[('', attr)].encode(config.LOCALE)
+        return node.attrs[('', attr)].encode(kaa.strutils.ENCODING)
     return default
 
 
@@ -1451,7 +1453,7 @@
     from the public functions at the top of this file
     """
     global current_theme
-    cachefile = os.path.join(config.FREEVO_CACHEDIR, 'skin-%s' % os.getuid())
+    cachefile = freevo.conf.cachefile('skin', True)
     storage = {}
     if os.path.isfile(cachefile):
         storage = util.cache.load(cachefile)

Modified: trunk/ui/src/menu/__init__.py
==============================================================================
--- trunk/ui/src/menu/__init__.py       (original)
+++ trunk/ui/src/menu/__init__.py       Fri Oct 27 19:09:55 2006
@@ -5,7 +5,7 @@
 # $Id$
 #
 # This module depends on the following parts of Freevo
-# sysconfig, config, util, event and plugin
+# config, util, event and plugin
 #
 # -----------------------------------------------------------------------------
 # Freevo - A Home Theater PC framework

Modified: trunk/ui/src/util/cache.py
==============================================================================
--- trunk/ui/src/util/cache.py  (original)
+++ trunk/ui/src/util/cache.py  Fri Oct 27 19:09:55 2006
@@ -103,7 +103,7 @@
 class Cache(object):
     """
     Class to cache data from a given module to a file. This is usefull when
-    using the freevo config or sysconfig module as 'module' to store data.
+    using the freevo config module as 'module' to store data.
     After loading, all key-value pairs added to this dict like class will
     also be added as variable to module in upper case.
     """

Modified: trunk/ui/src/video/database.py
==============================================================================
--- trunk/ui/src/video/database.py      (original)
+++ trunk/ui/src/video/database.py      Fri Oct 27 19:09:55 2006
@@ -39,7 +39,6 @@
 import copy
 
 # freevo imports
-import sysconfig
 import config
 import util
 
@@ -72,21 +71,6 @@
     discset      = {}
     tv_shows     = {}
 
-    rebuild_file = os.path.join(config.FREEVO_CACHEDIR,
-                                'freevo-rebuild-database')
-    if os.path.exists(rebuild_file):
-        try:
-            os.remove(rebuild_file)
-        except OSError:
-            print '*********************************************************'
-            print
-            print '*********************************************************'
-            print 'ERROR: unable to remove %s' % rebuild_file
-            print 'please fix permissions'
-            print '*********************************************************'
-            print
-            return 0
-
     log.info("Building the xml hash database...")
 
     files = []

Modified: trunk/ui/src/video/plugins/bookmarker.py
==============================================================================
--- trunk/ui/src/video/plugins/bookmarker.py    (original)
+++ trunk/ui/src/video/plugins/bookmarker.py    Fri Oct 27 19:09:55 2006
@@ -47,7 +47,7 @@
 import kaa.beacon
 
 # freevo imports
-import sysconfig
+import freevo.conf
 
 from menu import Action, Menu
 from plugin import ItemPlugin
@@ -76,7 +76,7 @@
         Get the bookmark file for the given filename.
         """
         myfile = os.path.basename(filename)
-        myfile = sysconfig.CACHEDIR + "/" + myfile + '.bookmark'
+        myfile = freevo.conf.cachefile(myfile + '.bookmark')
         return myfile
 
 

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to