All **other** modules fully specify libcalamares; only unpackfs
was importing shortcuts. Change to conventional usage (partly
because that's easier on the pylint implementation, partly because
it's then consistent with the rest).
import sys
import tempfile
import sys
import tempfile
-from libcalamares import *
-from libcalamares.utils import mount
import gettext
_ = gettext.translation("calamares-python",
import gettext
_ = gettext.translation("calamares-python",
- localedir=utils.gettext_path(),
- languages=utils.gettext_languages(),
+ localedir=libcalamares.utils.gettext_path(),
+ languages=libcalamares.utils.gettext_languages(),
fallback=True).gettext
def pretty_name():
fallback=True).gettext
def pretty_name():
return
if os.path.isdir(self.source):
return
if os.path.isdir(self.source):
- r = mount(self.source, imgmountdir, "", "--bind")
+ r = libcalamares.utils.mount(self.source, imgmountdir, "", "--bind")
elif os.path.isfile(self.source):
elif os.path.isfile(self.source):
- r = mount(self.source, imgmountdir, self.sourcefs, "loop")
+ r = libcalamares.utils.mount(self.source, imgmountdir, self.sourcefs, "loop")
else: # self.source is a device
else: # self.source is a device
- r = mount(self.source, imgmountdir, self.sourcefs, "")
+ r = libcalamares.utils.mount(self.source, imgmountdir, self.sourcefs, "")
- utils.debug("Failed to mount '{}' (fs={}) (target={})".format(self.source, self.sourcefs, imgmountdir))
+ libcalamares.utils.debug("Failed to mount '{}' (fs={}) (target={})".format(self.source, self.sourcefs, imgmountdir))
raise subprocess.CalledProcessError(r, "mount")
raise subprocess.CalledProcessError(r, "mount")
List excludes for rsync.
"""
lst = []
List excludes for rsync.
"""
lst = []
- extra_mounts = globalstorage.value("extraMounts")
+ extra_mounts = libcalamares.globalstorage.value("extraMounts")
if extra_mounts is None:
extra_mounts = []
if extra_mounts is None:
extra_mounts = []
# https://bugzilla.redhat.com/show_bug.cgi?id=868755#c50
# for the same issue in Anaconda, which uses a similar workaround.
if process.returncode != 0 and process.returncode != 23:
# https://bugzilla.redhat.com/show_bug.cgi?id=868755#c50
# for the same issue in Anaconda, which uses a similar workaround.
if process.returncode != 0 and process.returncode != 23:
- utils.warning("rsync failed with error code {}.".format(process.returncode))
+ libcalamares.utils.warning("rsync failed with error code {}.".format(process.returncode))
return _("rsync failed with error code {}.").format(process.returncode)
return None
return _("rsync failed with error code {}.").format(process.returncode)
return None
global status
status = _("Unpacking image {}/{}, file {}/{}").format((complete_count+1), len(self.entries), current_done, current_total)
global status
status = _("Unpacking image {}/{}, file {}/{}").format((complete_count+1), len(self.entries), current_done, current_total)
- job.setprogress(progress)
+ libcalamares.job.setprogress(progress)
complete = 0
for entry in self.entries:
status = _("Starting to unpack {}").format(entry.source)
complete = 0
for entry in self.entries:
status = _("Starting to unpack {}").format(entry.source)
- job.setprogress( ( 1.0 * complete ) / len(self.entries) )
+ libcalamares.job.setprogress( ( 1.0 * complete ) / len(self.entries) )
entry.do_mount(source_mount_path)
entry.do_count() # Fill in the entry.total
entry.do_mount(source_mount_path)
entry.do_count() # Fill in the entry.total
try:
os.chmod(root_mount_point, 0o755) # Want / to be rwxr-xr-x
except OSError as e:
try:
os.chmod(root_mount_point, 0o755) # Want / to be rwxr-xr-x
except OSError as e:
- utils.warning("Could not set / to safe permissions: {}".format(e))
+ libcalamares.utils.warning("Could not set / to safe permissions: {}".format(e))
wi = int(w)
return wi if wi > 0 else 1
except ValueError:
wi = int(w)
return wi if wi > 0 else 1
except ValueError:
- utils.warning("*weight* setting {!r} is not valid.".format(w))
+ libcalamares.utils.warning("*weight* setting {!r} is not valid.".format(w))
- utils.warning("*weight* setting {!r} must be number.".format(w))
+ libcalamares.utils.warning("*weight* setting {!r} must be number.".format(w))
"""
Unsquash filesystem.
"""
"""
Unsquash filesystem.
"""
- root_mount_point = globalstorage.value("rootMountPoint")
+ root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
- utils.warning("No mount point for root partition")
+ libcalamares.utils.warning("No mount point for root partition")
return (_("No mount point for root partition"),
_("globalstorage does not contain a \"rootMountPoint\" key, "
"doing nothing"))
if not os.path.exists(root_mount_point):
return (_("No mount point for root partition"),
_("globalstorage does not contain a \"rootMountPoint\" key, "
"doing nothing"))
if not os.path.exists(root_mount_point):
- utils.warning("Bad root mount point \"{}\"".format(root_mount_point))
+ libcalamares.utils.warning("Bad root mount point \"{}\"".format(root_mount_point))
return (_("Bad mount point for root partition"),
_("rootMountPoint is \"{}\", which does not "
"exist, doing nothing").format(root_mount_point))
return (_("Bad mount point for root partition"),
_("rootMountPoint is \"{}\", which does not "
"exist, doing nothing").format(root_mount_point))
# - unsupported filesystems
# - non-existent sources
# - missing tools for specific FS
# - unsupported filesystems
# - non-existent sources
# - missing tools for specific FS
- for entry in job.configuration["unpack"]:
+ for entry in libcalamares.job.configuration["unpack"]:
source = os.path.abspath(entry["source"])
sourcefs = entry["sourcefs"]
if sourcefs not in supported_filesystems:
source = os.path.abspath(entry["source"])
sourcefs = entry["sourcefs"]
if sourcefs not in supported_filesystems:
- utils.warning("The filesystem for \"{}\" ({}) is not supported by your current kernel".format(source, sourcefs))
- utils.warning(" ... modprobe {} may solve the problem".format(sourcefs))
+ libcalamares.utils.warning("The filesystem for \"{}\" ({}) is not supported by your current kernel".format(source, sourcefs))
+ libcalamares.utils.warning(" ... modprobe {} may solve the problem".format(sourcefs))
return (_("Bad unsquash configuration"),
_("The filesystem for \"{}\" ({}) is not supported by your current kernel").format(source, sourcefs))
if not os.path.exists(source):
return (_("Bad unsquash configuration"),
_("The filesystem for \"{}\" ({}) is not supported by your current kernel").format(source, sourcefs))
if not os.path.exists(source):
- utils.warning("The source filesystem \"{}\" does not exist".format(source))
+ libcalamares.utils.warning("The source filesystem \"{}\" does not exist".format(source))
return (_("Bad unsquash configuration"),
_("The source filesystem \"{}\" does not exist").format(source))
if sourcefs == "squashfs":
if shutil.which("unsquashfs") is None:
return (_("Bad unsquash configuration"),
_("The source filesystem \"{}\" does not exist").format(source))
if sourcefs == "squashfs":
if shutil.which("unsquashfs") is None:
- utils.warning("Failed to find unsquashfs")
+ libcalamares.utils.warning("Failed to find unsquashfs")
return (_("Failed to unpack image \"{}\"").format(self.source),
_("Failed to find unsquashfs, make sure you have the squashfs-tools package installed"))
return (_("Failed to unpack image \"{}\"").format(self.source),
_("Failed to find unsquashfs, make sure you have the squashfs-tools package installed"))
unpack = list()
is_first = True
unpack = list()
is_first = True
- for entry in job.configuration["unpack"]:
+ for entry in libcalamares.job.configuration["unpack"]:
source = os.path.abspath(entry["source"])
sourcefs = entry["sourcefs"]
destination = os.path.abspath(root_mount_point + entry["destination"])
if not os.path.isdir(destination) and sourcefs != "file":
source = os.path.abspath(entry["source"])
sourcefs = entry["sourcefs"]
destination = os.path.abspath(root_mount_point + entry["destination"])
if not os.path.isdir(destination) and sourcefs != "file":
- utils.warning(("The destination \"{}\" in the target system is not a directory").format(destination))
+ libcalamares.utils.warning(("The destination \"{}\" in the target system is not a directory").format(destination))
if is_first:
return (_("Bad unsquash configuration"),
_("The destination \"{}\" in the target system is not a directory").format(destination))
else:
if is_first:
return (_("Bad unsquash configuration"),
_("The destination \"{}\" in the target system is not a directory").format(destination))
else:
- utils.debug(".. assuming that the previous targets will create that directory.")
+ libcalamares.utils.debug(".. assuming that the previous targets will create that directory.")
unpack.append(UnpackEntry(source, sourcefs, destination))
# Optional settings
unpack.append(UnpackEntry(source, sourcefs, destination))
# Optional settings