According to "pydoc string", the string module isn't normally used nowadays.
PEP 290 (http://www.python.org/dev/peps/pep-0290/#string-methods) also
recommends using string methods over the string module because
  i. the string module may be deprecated in future;
 ii. string methods are faster.

This patch converts the imgcreate code to use string methods instead of the
string module.

Note: This patch does not fix any bugs per se. I just thought it would be
good to follow the PEP guidelines... unless there is a need to support
Python 1.6 or earlier.

Signed-off-by: Tan Swee Heng <[EMAIL PROTECTED]>
According to "pydoc string", the string module isn't normally used nowadays.
PEP 290 (http://www.python.org/dev/peps/pep-0290/#string-methods) also
recommends using string methods over the string module because
  i. the string module may be deprecated in future;
 ii. string methods are faster.

This patch converts the imgcreate code to use string methods instead of the
string module.

Note: This patch does not fix any bugs per se. I just thought it would be
good to follow the PEP guidelines... unless there is a need to support
Python 1.6 or earlier.

Signed-off-by: Tan Swee Heng <[EMAIL PROTECTED]>
---
 imgcreate/fs.py        |    5 ++---
 imgcreate/kickstart.py |    5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/imgcreate/fs.py b/imgcreate/fs.py
index 03bb57f..91e03f3 100644
--- a/imgcreate/fs.py
+++ b/imgcreate/fs.py
@@ -24,7 +24,6 @@ import errno
 import stat
 import subprocess
 import random
-import string
 
 from imgcreate.errors import *
 
@@ -47,7 +46,7 @@ def mksquashfs(in_img, out_img):
     ret = subprocess.call(args)
     if ret != 0:
         raise SquashfsError("'%s' exited with error (%d)" %
-                            (string.join(args, " "), ret))
+                            (" ".join(args), ret))
 
 def resize2fs(fs, size):
     dev_null = os.open("/dev/null", os.O_WRONLY)
@@ -321,7 +320,7 @@ class DeviceMapperSnapshot(object):
             self.cowloop.cleanup()
             self.imgloop.cleanup()
             raise SnapshotError("Could not create snapshot device using: " +
-                                string.join(args, " "))
+                                " ".join(args))
 
         self.__created = True
 
diff --git a/imgcreate/kickstart.py b/imgcreate/kickstart.py
index 9717d9f..4e96643 100644
--- a/imgcreate/kickstart.py
+++ b/imgcreate/kickstart.py
@@ -19,7 +19,6 @@
 
 import os
 import os.path
-import string
 import subprocess
 import time
 
@@ -296,7 +295,7 @@ class NetworkConfig(KickstartConfig):
         localline = ""
         if hostname and hostname != "localhost.localdomain":
             localline += hostname + " "
-            l = string.split(hostname, ".")
+            l = hostname.split(".")
             if len(l) > 1:
                 localline += l[0] + " "
         localline += "localhost.localdomain localhost"
@@ -357,7 +356,7 @@ class NetworkConfig(KickstartConfig):
                 gateway = network.gateway
 
             if network.nameserver:
-                nameservers = string.split(network.nameserver, ",")
+                nameservers = network.nameserver.split(",")
 
         self.write_sysconfig(useipv6, hostname, gateway)
         self.write_hosts(hostname)
-- 
1.5.3.6

--
Fedora-livecd-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/fedora-livecd-list

Reply via email to