gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gfx/libutil myimport.py


From: Janne V. Kujala
Subject: [Gzz-commits] gzz/gfx/libutil myimport.py
Date: Mon, 07 Oct 2002 10:58:15 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/10/07 10:58:14

Modified files:
        gfx/libutil    : myimport.py 

Log message:
        Must reload unchanged files; otherwise module file dependencies would 
need to be tracked all the way to *.texture files

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libutil/myimport.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: gzz/gfx/libutil/myimport.py
diff -c gzz/gfx/libutil/myimport.py:1.2 gzz/gfx/libutil/myimport.py:1.3
*** gzz/gfx/libutil/myimport.py:1.2     Mon Oct  7 10:22:25 2002
--- gzz/gfx/libutil/myimport.py Mon Oct  7 10:58:14 2002
***************
*** 41,48 ****
              #print "Dependencies done\n"
  
  def my_import_dep(name):
!     """ Import the named module or reload if already imported
!         and the file has changed
      """
      global dependencies, import_times
  
--- 41,49 ----
              #print "Dependencies done\n"
  
  def my_import_dep(name):
!     """ Import the named module if not loaded.
!         If the module is already loaded, reload changed module file
!         or any dependencies that have changed on disk
      """
      global dependencies, import_times
  
***************
*** 66,76 ****
  
  
  def my_import_simple(name):
          print "Importing module", name
          mod = __import__(name)
          components = name.split('.')
          for comp in components[1:]:
              mod = getattr(mod, comp)
          sys.modules[name] = mod
  
! my_import = my_import_dep
--- 67,83 ----
  
  
  def my_import_simple(name):
+     """ Import the named module or reload if already imported
+     """
+     if not name in sys.modules.keys():
          print "Importing module", name
          mod = __import__(name)
          components = name.split('.')
          for comp in components[1:]:
              mod = getattr(mod, comp)
          sys.modules[name] = mod
+     else:
+         print "Reloading module", name
+         reload(sys.modules[name])
  
! my_import = my_import_simple




reply via email to

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