Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   CentOS Development (http://www.linux-archive.org/centos-development/)
-   -   Fix importing of format modules. (http://www.linux-archive.org/centos-development/261890-fix-importing-format-modules.html)

Radek Vykydal 03-12-2009 10:58 AM

Fix importing of format modules.
 
MartinG is going to use imp instead __import__ here, so this is only temporary
solution to make things works again
---
storage/formats/__init__.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/storage/formats/__init__.py b/storage/formats/__init__.py
index 3cdc908..4aab34d 100644
--- a/storage/formats/__init__.py
+++ b/storage/formats/__init__.py
@@ -107,7 +107,8 @@ def collect_device_format_classes():
mod_name = module_file[:-3]
# imputil is deprecated in python 2.6
try:
- globals()[mod_name] = __import__(mod_name)
+ globals()[mod_name] = __import__('storage.formats.'+mod_name,
+ fromlist='foo')
except ImportError, e:
log.debug("import of device format module '%s' failed" % mod_name)

--
1.5.4.3

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

Radek Vykydal 03-12-2009 11:09 AM

Fix importing of format modules.
 
Radek Vykydal wrote:

MartinG is going to use imp instead __import__ here, so this is only temporary
solution to make things works again


... obsoleted by MartinG's better patch

---
storage/formats/__init__.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/storage/formats/__init__.py b/storage/formats/__init__.py
index 3cdc908..4aab34d 100644
--- a/storage/formats/__init__.py
+++ b/storage/formats/__init__.py
@@ -107,7 +107,8 @@ def collect_device_format_classes():
mod_name = module_file[:-3]
# imputil is deprecated in python 2.6
try:
- globals()[mod_name] = __import__(mod_name)
+ globals()[mod_name] = __import__('storage.formats.'+mod_name,
+ fromlist='foo')
except ImportError, e:
log.debug("import of device format module '%s' failed" % mod_name)




_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 09:45 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.