FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Development

 
 
LinkBack Thread Tools
 
Old 03-11-2009, 10:57 AM
Martin Gracik
 
Default Fixed the format modules import

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

diff --git a/storage/formats/__init__.py b/storage/formats/__init__.py
index 2b6acae..3cdc908 100644
--- a/storage/formats/__init__.py
+++ b/storage/formats/__init__.py
@@ -102,11 +102,12 @@ def collect_device_format_classes():
"""
dir = os.path.dirname(__file__)
for module_file in os.listdir(dir):
- if module_file.endswith(".py"):
+ # make sure we're not importing this module
+ if module_file.endswith(".py") and module_file != __file__:
mod_name = module_file[:-3]
- # FIXME: use imputils here instead of exec
+ # imputil is deprecated in python 2.6
try:
- exec("import %s" % mod_name)
+ globals()[mod_name] = __import__(mod_name)
except ImportError, e:
log.debug("import of device format module '%s' failed" % mod_name)

--
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-12-2009, 03:38 AM
David Lehman
 
Default Fixed the format modules import

Looks good to me.

On Wed, 2009-03-11 at 12:57 +0100, Martin Gracik wrote:
> ---
> storage/formats/__init__.py | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/storage/formats/__init__.py b/storage/formats/__init__.py
> index 2b6acae..3cdc908 100644
> --- a/storage/formats/__init__.py
> +++ b/storage/formats/__init__.py
> @@ -102,11 +102,12 @@ def collect_device_format_classes():
> """
> dir = os.path.dirname(__file__)
> for module_file in os.listdir(dir):
> - if module_file.endswith(".py"):
> + # make sure we're not importing this module
> + if module_file.endswith(".py") and module_file != __file__:
> mod_name = module_file[:-3]
> - # FIXME: use imputils here instead of exec
> + # imputil is deprecated in python 2.6
> try:
> - exec("import %s" % mod_name)
> + globals()[mod_name] = __import__(mod_name)
> 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
 

Thread Tools




All times are GMT. The time now is 08:52 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org