[anaconda][master][Python 3][PATCH] Make octal literals Python 3 compatible
Samantha N. Bueno
sbueno+anaconda at redhat.com
Fri Jun 27 16:39:48 UTC 2014
On Fri, Jun 27, 2014 at 04:23:51PM +0200, Martin Kolman wrote:
> The 0o<number> syntax seems to work fine in both
> Python 2.7 & Python 3.
Looks good to me.
>
> Signed-off-by: Martin Kolman <mkolman at redhat.com>
> ---
> pyanaconda/anaconda.py | 2 +-
> pyanaconda/bootloader.py | 6 +++---
> pyanaconda/install.py | 2 +-
> pyanaconda/iutil.py | 4 ++--
> pyanaconda/kickstart.py | 6 +++---
> pyanaconda/packaging/livepayload.py | 2 +-
> 6 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/pyanaconda/anaconda.py b/pyanaconda/anaconda.py
> index 210f20a..de2ba04 100644
> --- a/pyanaconda/anaconda.py
> +++ b/pyanaconda/anaconda.py
> @@ -230,7 +230,7 @@ class Anaconda(object):
> if root is None:
> root = iutil.getSysroot()
> if not os.path.isdir("%s/etc/X11" %(root,)):
> - os.makedirs("%s/etc/X11" %(root,), mode=0755)
> + os.makedirs("%s/etc/X11" %(root,), mode=0o755)
> f = open("%s/etc/X11/xorg.conf" %(root,), 'w')
> f.write('Section "Device"\n\tIdentifier "Videocard0"\n\tDriver "%s"\nEndSection\n' % self.xdriver)
> f.close()
> diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
> index c0e34da..10292c7 100644
> --- a/pyanaconda/bootloader.py
> +++ b/pyanaconda/bootloader.py
> @@ -226,7 +226,7 @@ class BootLoader(object):
> name = "Generic Bootloader"
> packages = []
> config_file = None
> - config_file_mode = 0600
> + config_file_mode = 0o600
> can_dual_boot = False
> can_update = False
> image_label_attr = "label"
> @@ -1398,7 +1398,7 @@ class GRUB2(GRUB):
> packages = ["grub2"]
> _config_file = "grub.cfg"
> _config_dir = "grub2"
> - config_file_mode = 0600
> + config_file_mode = 0o600
> defaults_file = "/etc/default/grub"
> can_dual_boot = True
> can_update = True
> @@ -1542,7 +1542,7 @@ class GRUB2(GRUB):
> header.write("%s\n" % password_line)
> header.write("EOF\n")
> header.close()
> - os.chmod(users_file, 0700)
> + os.chmod(users_file, 0o700)
>
> def write_config(self):
> self.add_crash_args()
> diff --git a/pyanaconda/install.py b/pyanaconda/install.py
> index c205584..f136384 100644
> --- a/pyanaconda/install.py
> +++ b/pyanaconda/install.py
> @@ -48,7 +48,7 @@ def _writeKS(ksdata):
> f.write(str(ksdata))
>
> # Make it so only root can read - could have passwords
> - os.chmod(path, 0600)
> + os.chmod(path, 0o600)
>
> def doConfiguration(storage, payload, ksdata, instClass):
> from pyanaconda.kickstart import runPostScripts
> diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
> index f2b28a9..642e7b0 100644
> --- a/pyanaconda/iutil.py
> +++ b/pyanaconda/iutil.py
> @@ -326,7 +326,7 @@ def mkdirChain(directory):
> """
>
> try:
> - os.makedirs(directory, 0755)
> + os.makedirs(directory, 0o755)
> except OSError as e:
> try:
> if e.errno == errno.EEXIST and stat.S_ISDIR(os.stat(directory).st_mode):
> @@ -474,7 +474,7 @@ def dracut_eject(device):
>
> f.write("eject %s\n" % (device,))
> f.close()
> - os.chmod(DRACUT_SHUTDOWN_EJECT, 0755)
> + os.chmod(DRACUT_SHUTDOWN_EJECT, 0o755)
> log.info("Wrote dracut shutdown eject hook for %s", device)
> except (IOError, OSError) as e:
> log.error("Error writing dracut shutdown eject hook for %s: %s", device, e)
> diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
> index cbb48f0..97f0ab9 100644
> --- a/pyanaconda/kickstart.py
> +++ b/pyanaconda/kickstart.py
> @@ -98,7 +98,7 @@ class AnacondaKSScript(KSScript):
>
> os.write(fd, self.script)
> os.close(fd)
> - os.chmod(path, 0700)
> + os.chmod(path, 0o700)
>
> # Always log stdout/stderr from scripts. Using --log just lets you
> # pick where it goes. The script will also be logged to program.log
> @@ -1067,7 +1067,7 @@ class PartitionData(commands.partition.F18_PartData):
> ty = "macefi"
> else:
> ty = "EFI System Partition"
> - self.fsopts = "defaults,uid=0,gid=0,umask=0077,shortname=winnt"
> + self.fsopts = "defaults,uid=0,gid=0,umask=0o077,shortname=winnt"
> else:
> if self.fstype != "":
> ty = self.fstype
> @@ -1671,7 +1671,7 @@ class SpokeRegistry(dict):
> def execute(self, storage, ksdata, instClass, users):
> path = os.path.join(iutil.getSysroot(), "var", "lib", "inital-setup")
> try:
> - os.makedirs(path, 0755)
> + os.makedirs(path, 0o755)
> except OSError:
> pass
> f = open(os.path.join(path, "configured.ini"), "a")
> diff --git a/pyanaconda/packaging/livepayload.py b/pyanaconda/packaging/livepayload.py
> index be0ea91..f5fb6a9 100644
> --- a/pyanaconda/packaging/livepayload.py
> +++ b/pyanaconda/packaging/livepayload.py
> @@ -334,7 +334,7 @@ class LiveImageKSPayload(LiveImagePayload):
> img_file = os.path.basename(sorted(img_files)[0])
>
> # move the mount to IMAGE_DIR
> - os.makedirs(IMAGE_DIR, 0755)
> + os.makedirs(IMAGE_DIR, 0o755)
> # work around inability to move shared filesystems
> iutil.execWithRedirect("mount",
> ["--make-rprivate", "/"])
> --
> 1.9.3
>
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
More information about the anaconda-patches
mailing list