mirror of
https://github.com/scummvm/scummvm.git
synced 2026-05-21 05:40:43 +00:00
09cff5ecc0
tag v1.15.0 67fe5ea7f68cf1185379c2c5e8acf37d483a2d4a https://github.com/clalancette/pycdlib.git
721 lines
64 KiB
HTML
721 lines
64 KiB
HTML
<!DOCTYPE>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Pydoc: module pycdlib.pycdlib</title>
|
|
<link rel="stylesheet" type="text/css" href="pydoc_data/_pydoc.css"></head><body><div style="clear:both;padding-top:.5em;">
|
|
<table class="heading">
|
|
<tr class="heading-text decor">
|
|
<td class="title"> <br><strong class="title"><a href="pycdlib.html" class="white">pycdlib</a>.pycdlib</strong></td>
|
|
<td class="extra"> </td></tr></table>
|
|
<p><span class="code">Main <a href="#PyCdlib">PyCdlib</a> class and support classes and utilities.</span></p>
|
|
<p>
|
|
<table class="section">
|
|
<tr class="decor index-decor heading-text">
|
|
<td class="section-title" colspan=3> <br><strong class="bigsection">Classes</strong></td></tr>
|
|
|
|
<tr><td class="decor index-decor"><span class="code"> </span></td><td> </td>
|
|
<td class="singlecolumn"><dl>
|
|
<dt class="heading-text"><a href="builtins.html#object">builtins.object</a>
|
|
</dt><dd>
|
|
<dl>
|
|
<dt class="heading-text"><a href="pycdlib.pycdlib.html#PyCdlib">PyCdlib</a>
|
|
</dt></dl>
|
|
</dd>
|
|
</dl>
|
|
<p>
|
|
<table class="section">
|
|
<tr class="decor title-decor heading-text">
|
|
<td class="section-title" colspan=3> <br><a name="PyCdlib">class <strong>PyCdlib</strong></a>(<a href="builtins.html#object">builtins.object</a>)</td></tr>
|
|
|
|
<tr><td class="decor title-decor" rowspan=2><span class="code"> </span></td>
|
|
<td class="decor title-decor" colspan=2><span class="code"><a href="#PyCdlib">PyCdlib</a>(always_consistent=False)<br>
|
|
<br>
|
|
The main class for manipulating ISOs.<br> </span></td></tr>
|
|
<tr><td> </td>
|
|
<td class="singlecolumn">Methods defined here:<br>
|
|
<dl><dt><a name="PyCdlib-__init__"><strong>__init__</strong></a>(self, always_consistent=False)</dt><dd><span class="code">Initialize self. See help(type(self)) for accurate signature.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-add_directory"><strong>add_directory</strong></a>(self, iso_path=None, rr_name=None, joliet_path=None, file_mode=None, udf_path=None)</dt><dd><span class="code">Add a directory to the ISO. At least one of an iso_path, joliet_path,<br>
|
|
or udf_path must be provided. Providing joliet_path on a non-Joliet<br>
|
|
ISO, or udf_path on a non-UDF ISO, is an error. If the ISO contains<br>
|
|
Rock Ridge, then a Rock Ridge name must be provided.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
iso_path - The ISO9660 absolute path to use for the directory.<br>
|
|
rr_name - The Rock Ridge name to use for the directory.<br>
|
|
joliet_path - The Joliet absolute path to use for the directory.<br>
|
|
file_mode - The POSIX file mode to use for the directory. This only<br>
|
|
applies for Rock Ridge ISOs.<br>
|
|
udf_path - The UDF absolute path to use for the directory.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-add_eltorito"><strong>add_eltorito</strong></a>(self, bootfile_path, bootcatfile=None, rr_bootcatname=None, joliet_bootcatfile=None, boot_load_size=None, platform_id=0, boot_info_table=False, efi=False, media_name='noemul', bootable=True, boot_load_seg=0, udf_bootcatfile=None)</dt><dd><span class="code">Add an El Torito Boot Record, and associated files, to the ISO. The<br>
|
|
file that will be used as the bootfile must be passed into this function<br>
|
|
and must already be present on the ISO.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
bootfile_path - The file to use as the boot file; it must already<br>
|
|
exist on this ISO.<br>
|
|
bootcatfile - The fake file to use as the boot catalog entry; set to<br>
|
|
BOOT.CAT;1 by default.<br>
|
|
rr_bootcatname - The Rock Ridge name for the fake file to use as the<br>
|
|
boot catalog entry; set to 'boot.cat' by default.<br>
|
|
joliet_bootcatfile - The Joliet name for the fake file to use as the<br>
|
|
boot catalog entry; set to 'boot.cat' by default.<br>
|
|
boot_load_size - The number of sectors to use for the boot entry; if<br>
|
|
set to None (the default), the number of sectors will<br>
|
|
be calculated.<br>
|
|
platform_id - The platform ID to set for the El Torito entry; 0 is for<br>
|
|
x86, 1 is for Power PC, 2 is for Mac, and 0xef is for<br>
|
|
UEFI. 0 is the default.<br>
|
|
boot_info_table - Whether to add a boot info table to the ISO. The<br>
|
|
default is False.<br>
|
|
efi - Whether this is an EFI entry for El Torito. The default is False.<br>
|
|
media_name - The name of the media type, one of 'noemul', 'floppy', or 'hdemul'.<br>
|
|
bootable - Whether the boot media is bootable. The default is True.<br>
|
|
boot_load_seg - The load segment address of the boot image.<br>
|
|
udf_bootcatfile - The name of the boot.cat file on the UDF filesystem.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-add_file"><strong>add_file</strong></a>(self, filename, iso_path=None, rr_name=None, joliet_path=None, file_mode=None, udf_path=None)</dt><dd><span class="code">Add a file to the ISO. If the ISO is a Rock Ridge one, then a Rock<br>
|
|
Ridge name must also be provided. If the ISO is a Joliet one, then a<br>
|
|
Joliet path may also be provided; while it is optional to do so, it is<br>
|
|
highly recommended.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
filename - The filename to use for the data contents for the new file.<br>
|
|
iso_path - The ISO9660 absolute path to the file destination on the ISO.<br>
|
|
rr_name - The Rock Ridge name of the file destination on the ISO.<br>
|
|
joliet_path - The Joliet absolute path to the file destination on the ISO.<br>
|
|
file_mode - The POSIX file_mode to apply to this file. This only<br>
|
|
applies if this is a Rock Ridge ISO. If this is None (the<br>
|
|
default), the permissions from the original file are used.<br>
|
|
udf_path - The UDF name of the file destination on the ISO.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-add_fp"><strong>add_fp</strong></a>(self, fp, length, iso_path=None, rr_name=None, joliet_path=None, file_mode=None, udf_path=None)</dt><dd><span class="code">Add a file to the ISO. If the ISO is a Rock Ridge one, then a Rock<br>
|
|
Ridge name must also be provided. If the ISO is a Joliet one, then a<br>
|
|
Joliet path may also be provided; while it is optional to do so, it is<br>
|
|
highly recommended. Note that the caller must ensure that 'fp' remains<br>
|
|
open for the lifetime of the <a href="#PyCdlib">PyCdlib</a> <a href="builtins.html#object">object</a>, as the <a href="#PyCdlib">PyCdlib</a> class uses<br>
|
|
the file descriptor internally when writing (mastering) the ISO. To<br>
|
|
have <a href="#PyCdlib">PyCdlib</a> manage this automatically, use 'add_file' instead.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
fp - The file <a href="builtins.html#object">object</a> to use for the contents of the new file.<br>
|
|
length - The length of the data for the new file.<br>
|
|
iso_path - The ISO9660 absolute path to the file destination on the ISO.<br>
|
|
rr_name - The Rock Ridge name of the file destination on the ISO.<br>
|
|
joliet_path - The Joliet absolute path to the file destination on the ISO.<br>
|
|
file_mode - The POSIX file_mode to apply to this file. This only<br>
|
|
applies if this is a Rock Ridge ISO. If this is None (the<br>
|
|
default), the permissions from the original file are used.<br>
|
|
udf_path - The UDF name of the file destination on the ISO.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-add_hard_link"><strong>add_hard_link</strong></a>(self, **kwargs)</dt><dd><span class="code">Add a hard link to the ISO. Hard links are alternate names for the<br>
|
|
same file contents that don't take up any additional space on the the<br>
|
|
ISO. This API can be used to create hard links between two files on<br>
|
|
the ISO9660 filesystem, between two files on the Joliet filesystem, or<br>
|
|
between a file on the ISO9660 filesystem and the Joliet filesystem.<br>
|
|
In all cases, exactly one old path must be specified, and exactly one<br>
|
|
new path must be specified.<br>
|
|
Note that this is an advanced API, so using it in combination with the<br>
|
|
higher-level APIs (like <a href="#PyCdlib-rm_file">rm_file</a>()) may result in unexpected behavior.<br>
|
|
Once this API has been used, this API and <a href="#PyCdlib-rm_hard_link">rm_hard_link</a>() should be<br>
|
|
preferred over <a href="#PyCdlib-add_file">add_file</a>() and <a href="#PyCdlib-rm_file">rm_file</a>(), respectively.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
iso_old_path - The old path on the ISO9660 filesystem to link from.<br>
|
|
iso_new_path - The new path on the ISO9660 filesystem to link to.<br>
|
|
joliet_old_path - The old path on the Joliet filesystem to link from.<br>
|
|
joliet_new_path - The new path on the Joliet filesystem to link to.<br>
|
|
rr_name - The Rock Ridge name to use for the new file if this is a Rock<br>
|
|
Ridge ISO and the new path is on the ISO9660 filesystem.<br>
|
|
boot_catalog_old - Use the El Torito boot catalog as the old path.<br>
|
|
udf_old_path - The old path on the UDF filesystem to link from.<br>
|
|
udf_new_path - The new path on the UDF filesystem to link to.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-add_isohybrid"><strong>add_isohybrid</strong></a>(self, part_entry=1, mbr_id=None, part_offset=0, geometry_sectors=32, geometry_heads=64, part_type=None, mac=False, efi=None)</dt><dd><span class="code">Make an ISO a 'hybrid', which means that it can be booted either from a<br>
|
|
CD or from more traditional media (like a USB stick). This requires<br>
|
|
that the ISO already have El Torito, and will use the El Torito boot<br>
|
|
file as a bootable image. That image must contain a certain signature<br>
|
|
in order to work as a hybrid (if using syslinux, this generally means<br>
|
|
the isohdpfx.bin files).<br>
|
|
<br>
|
|
Parameters:<br>
|
|
part_entry - The partition entry to use; one by default.<br>
|
|
mbr_id - The mbr_id to use. If set to None (the default), a random one<br>
|
|
will be generated.<br>
|
|
part_offset - The partition offset to use; zero by default.<br>
|
|
geometry_sectors - The number of sectors to assign; thirty-two by<br>
|
|
default.<br>
|
|
geometry_heads - The number of heads to assign; sixty-four by default.<br>
|
|
part_type - The partition type to assign; twenty-three by default, but<br>
|
|
will automatically be set to 0 if mac or efi are True.<br>
|
|
mac - Add support for Mac; False by default.<br>
|
|
efi - Add support for EFI; False by default, but will automatically<br>
|
|
be set to True if mac is True.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-add_joliet_directory"><strong>add_joliet_directory</strong></a>(self, joliet_path)</dt><dd><span class="code">(deprecated) Add a directory to the Joliet portion of the ISO. Since<br>
|
|
Joliet occupies a completely different context than ISO9660, this<br>
|
|
method can be invoked to create a completely different directory<br>
|
|
structure in the Joliet context, though that is generally not advised.<br>
|
|
It is recommended to use the 'joliet_path' argument of the<br>
|
|
'add_directory' instead of this method.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
joliet_path - The Joliet directory to create.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-add_symlink"><strong>add_symlink</strong></a>(self, symlink_path=None, rr_symlink_name=None, rr_path=None, joliet_path=None, udf_symlink_path=None, udf_target=None)</dt><dd><span class="code">Add a symlink from rr_symlink_name to the rr_path. The ISO must have<br>
|
|
either Rock Ridge or UDF support (or both).<br>
|
|
<br>
|
|
Parameters:<br>
|
|
symlink_path - The ISO9660 path of the symlink itself on the ISO.<br>
|
|
rr_symlink_name - The Rock Ridge name of the symlink itself on the ISO.<br>
|
|
rr_path - The path that the symlink points to on the Rock Ridge part<br>
|
|
of the ISO.<br>
|
|
joliet_path - The Joliet path of the symlink (if this ISO has Joliet).<br>
|
|
udf_symlink_path - The UDF path of the symlink itself on the ISO.<br>
|
|
udf_target - The UDF name of the entry on the ISO that the symlink<br>
|
|
points to.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-clear_hidden"><strong>clear_hidden</strong></a>(self, iso_path=None, rr_path=None, joliet_path=None)</dt><dd><span class="code">Clear the ISO9660 hidden attribute on a file or directory. This will<br>
|
|
cause the file or directory to show up when listing entries on the ISO.<br>
|
|
Exactly one of iso_path, rr_path, or joliet_path must be specified.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
iso_path - The path on the ISO to clear the hidden bit from.<br>
|
|
rr_path - The Rock Ridge path on the ISO to clear the hidden bit from.<br>
|
|
joliet_path - The Joliet path on the ISO to clear the hidden bit from.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-close"><strong>close</strong></a>(self)</dt><dd><span class="code">Close the <a href="#PyCdlib">PyCdlib</a> <a href="builtins.html#object">object</a>, and re-initialize the <a href="builtins.html#object">object</a> to the defaults.<br>
|
|
The <a href="builtins.html#object">object</a> can then be re-used for manipulation of another ISO.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
None.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-duplicate_pvd"><strong>duplicate_pvd</strong></a>(self)</dt><dd><span class="code">Add a duplicate PVD to the ISO. This is a mostly useless feature<br>
|
|
allowed by Ecma-119 to have duplicate PVDs to avoid possible corruption.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
None.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-file_mode"><strong>file_mode</strong></a>(self, **kwargs)</dt><dd><span class="code">Get the POSIX file mode of the file if is a Rock Ridge file.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
iso_path - The absolute ISO path to the file on the ISO.<br>
|
|
rr_path - The absolute Rock Ridge path to the file on the ISO.<br>
|
|
joliet_path - The absolute Joliet path to the file on the ISO.<br>
|
|
udf_path - The absolute UDF path to the file on the ISO.<br>
|
|
Returns:<br>
|
|
An integer representing the POSIX file mode of the file if it is Rock<br>
|
|
Ridge, or None otherwise.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-force_consistency"><strong>force_consistency</strong></a>(self)</dt><dd><span class="code">Make sure the ISO <a href="builtins.html#object">object</a> is fully consistent. <a href="#PyCdlib">PyCdlib</a> typically delays<br>
|
|
doing work until it is necessary, and this detail is usually hidden<br>
|
|
from users. However, there are times that a user may want a fully<br>
|
|
consistent view of the ISO without calling one of the methods that<br>
|
|
forces consistency. This method allows the user to force a consistent<br>
|
|
view of this <a href="builtins.html#object">object</a>.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
None.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-full_path_from_dirrecord"><strong>full_path_from_dirrecord</strong></a>(self, rec, rockridge=False)</dt><dd><span class="code">Get the absolute path of a directory record.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
rec - The directory record to get the full path for.<br>
|
|
rockridge - Whether to get the rock ridge full path.<br>
|
|
Returns:<br>
|
|
A string representing the absolute path to the file on the ISO.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-get_and_write"><strong>get_and_write</strong></a>(self, iso_path, local_path, blocksize=8192)</dt><dd><span class="code">(deprecated) Fetch a single file from the ISO and write it out to the<br>
|
|
specified file. Note that this will overwrite the contents of the local<br>
|
|
file if it already exists. Also note that 'iso_path' must be an<br>
|
|
absolute path to the file. Finally, the 'iso_path' can be an ISO9660<br>
|
|
path, a Rock Ridge path, or a Joliet path. In the case of ambiguity,<br>
|
|
the Joliet path is tried first, followed by the ISO9660 path, followed<br>
|
|
by the Rock Ridge path. It is recommended to use the get_file_from_iso<br>
|
|
API instead to resolve this ambiguity.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
iso_path - The absolute path to the file to get data from.<br>
|
|
local_path - The local filename to write the contents to.<br>
|
|
blocksize - The blocksize to use when copying data; the default is 8192.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-get_and_write_fp"><strong>get_and_write_fp</strong></a>(self, iso_path, outfp, blocksize=8192)</dt><dd><span class="code">(deprecated) Fetch a single file from the ISO and write it out to the<br>
|
|
file <a href="builtins.html#object">object</a>. Note that 'iso_path' must be an absolute path to the file.<br>
|
|
Also note that the 'iso_path' can be an ISO9660 path, a Rock Ridge path,<br>
|
|
or a Joliet path. In the case of ambiguity, the Joliet path is tried<br>
|
|
first, followed by the ISO9660 path, followed by the Rock Ridge path.<br>
|
|
It is recommend to use the get_file_from_iso_fp API instead to resolve<br>
|
|
this ambiguity.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
iso_path - The absolute path to the file to get data from.<br>
|
|
outfp - The file <a href="builtins.html#object">object</a> to write data to.<br>
|
|
blocksize - The blocksize to use when copying data; the default is 8192.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-get_entry"><strong>get_entry</strong></a>(self, iso_path, joliet=False)</dt><dd><span class="code">(deprecated) Get the directory record for a particular path. It is<br>
|
|
recommended to use the 'get_record' API instead.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
iso_path - The path on the ISO to look up information for.<br>
|
|
joliet - Whether to look for the path in the Joliet portion of the ISO.<br>
|
|
Returns:<br>
|
|
A dr.DirectoryRecord <a href="builtins.html#object">object</a> representing the path.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-get_file_from_iso"><strong>get_file_from_iso</strong></a>(self, local_path, **kwargs)</dt><dd><span class="code">Fetch a single file from the ISO and write it out to a local file.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
local_path - The local file to write to.<br>
|
|
blocksize - The number of bytes in each transfer.<br>
|
|
iso_path - The absolute ISO9660 path to lookup on the ISO (exclusive<br>
|
|
with rr_path, joliet_path, and udf_path).<br>
|
|
rr_path - The absolute Rock Ridge path to lookup on the ISO (exclusive<br>
|
|
with iso_path, joliet_path, and udf_path).<br>
|
|
joliet_path - The absolute Joliet path to lookup on the ISO (exclusive<br>
|
|
with iso_path, rr_path, and udf_path).<br>
|
|
udf_path - The absolute UDF path to lookup on the ISO (exclusive with<br>
|
|
iso_path, rr_path, and joliet_path).<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-get_file_from_iso_fp"><strong>get_file_from_iso_fp</strong></a>(self, outfp, **kwargs)</dt><dd><span class="code">Fetch a single file from the ISO and write it out to the file <a href="builtins.html#object">object</a>.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
outfp - The file <a href="builtins.html#object">object</a> to write data to.<br>
|
|
blocksize - The number of bytes in each transfer.<br>
|
|
iso_path - The absolute ISO9660 path to lookup on the ISO (exclusive<br>
|
|
with rr_path, joliet_path, and udf_path).<br>
|
|
rr_path - The absolute Rock Ridge path to lookup on the ISO (exclusive<br>
|
|
with iso_path, joliet_path, and udf_path).<br>
|
|
joliet_path - The absolute Joliet path to lookup on the ISO (exclusive<br>
|
|
with iso_path, rr_path, and udf_path).<br>
|
|
udf_path - The absolute UDF path to lookup on the ISO (exclusive with<br>
|
|
iso_path, rr_path, and joliet_path).<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-get_iso9660_facade"><strong>get_iso9660_facade</strong></a>(self)</dt><dd><span class="code">Return a 'facade' that simplifies some of the complexities of the<br>
|
|
<a href="#PyCdlib">PyCdlib</a> class, while giving up some of the full power. This facade<br>
|
|
only allows manipulation of the ISO9660 portions of the ISO.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
None.<br>
|
|
Returns:<br>
|
|
A PyCdlibISO9660 <a href="builtins.html#object">object</a> that can be used to interact with the ISO.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-get_joliet_facade"><strong>get_joliet_facade</strong></a>(self)</dt><dd><span class="code">Return a 'facade' that simplifies some of the complexities of the<br>
|
|
<a href="#PyCdlib">PyCdlib</a> class, while giving up some of the full power. This facade<br>
|
|
only allows manipulation of the Joliet portions of the ISO.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
None.<br>
|
|
Returns:<br>
|
|
A PyCdlibJoliet <a href="builtins.html#object">object</a> that can be used to interact with the ISO.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-get_record"><strong>get_record</strong></a>(self, **kwargs)</dt><dd><span class="code">Get the directory record for a particular path.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
iso_path - The absolute path on the ISO9660 filesystem to get the<br>
|
|
record for.<br>
|
|
rr_path - The absolute path on the Rock Ridge filesystem to get the<br>
|
|
record for.<br>
|
|
joliet_path - The absolute path on the Joliet filesystem to get the<br>
|
|
record for.<br>
|
|
udf_path - The absolute path on the UDF filesystem to get the record<br>
|
|
for.<br>
|
|
Returns:<br>
|
|
An <a href="builtins.html#object">object</a> that represents the path. This may be a dr.DirectoryRecord<br>
|
|
<a href="builtins.html#object">object</a> (in the cases of iso_path, rr_path, or joliet_path), or a<br>
|
|
udf.UDFFileEntry <a href="builtins.html#object">object</a> (in the case of udf_path).</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-get_rock_ridge_facade"><strong>get_rock_ridge_facade</strong></a>(self)</dt><dd><span class="code">Return a 'facade' that simplifies some of the complexities of the<br>
|
|
<a href="#PyCdlib">PyCdlib</a> class, while giving up some of the full power. This facade<br>
|
|
only allows manipulation of the Rock Ridge portions of the ISO.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
None.<br>
|
|
Returns:<br>
|
|
A PyCdlibRockRidge <a href="builtins.html#object">object</a> that can be used to interact with the ISO.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-get_udf_facade"><strong>get_udf_facade</strong></a>(self)</dt><dd><span class="code">Return a 'facade' that simplifies some of the complexities of the<br>
|
|
<a href="#PyCdlib">PyCdlib</a> class, while giving up some of the full power. This facade<br>
|
|
only allows manipulation of the UDF portions of the ISO.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
None.<br>
|
|
Returns:<br>
|
|
A PyCdlibUDF <a href="builtins.html#object">object</a> that can be used to interact with the ISO.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-has_joliet"><strong>has_joliet</strong></a>(self)</dt><dd><span class="code">Returns whether this ISO has Joliet extensions.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
None.<br>
|
|
Returns:<br>
|
|
True if this ISO has Joliet, False otherwise.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-has_rock_ridge"><strong>has_rock_ridge</strong></a>(self)</dt><dd><span class="code">Returns whether this ISO has Rock Ridge extensions.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
None.<br>
|
|
Returns:<br>
|
|
True if this ISO has Rock Ridge extensions, False otherwise.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-has_udf"><strong>has_udf</strong></a>(self)</dt><dd><span class="code">Returns whether this ISO has UDF extensions.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
None.<br>
|
|
Returns:<br>
|
|
True if this ISO has UDF, False otherwise.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-list_children"><strong>list_children</strong></a>(self, **kwargs)</dt><dd><span class="code">Generate a list of all of the file/directory objects in the<br>
|
|
specified location on the ISO.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
iso_path - The absolute path on the ISO to list the children for.<br>
|
|
rr_path - The absolute Rock Ridge path on the ISO to list the children for.<br>
|
|
joliet_path - The absolute Joliet path on the ISO to list the children for.<br>
|
|
udf_path - The absolute UDF path on the ISO to list the children for.<br>
|
|
Yields:<br>
|
|
Children of this path.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-list_dir"><strong>list_dir</strong></a>(self, iso_path, joliet=False)</dt><dd><span class="code">(deprecated) Generate a list of all of the file/directory objects in the<br>
|
|
specified location on the ISO. It is recommended to use the<br>
|
|
'list_children' API instead.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
iso_path - The path on the ISO to look up information for.<br>
|
|
joliet - Whether to look for the path in the Joliet portion of the ISO.<br>
|
|
Yields:<br>
|
|
Children of this path.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-modify_file_in_place"><strong>modify_file_in_place</strong></a>(self, fp, length, iso_path, rr_name=None, joliet_path=None, udf_path=None)</dt><dd><span class="code">An API to modify a file in place on the ISO. This can be extremely fast<br>
|
|
(much faster than calling the write method), but has many restrictions.<br>
|
|
<br>
|
|
1. The original ISO file pointer must have been opened for reading<br>
|
|
and writing.<br>
|
|
2. Only an existing *file* can be modified; directories cannot be<br>
|
|
changed.<br>
|
|
3. Only an existing file can be *modified*; no new files can be added<br>
|
|
or removed.<br>
|
|
4. The new file contents must use the same number of extents (typically<br>
|
|
2048 bytes) as the old file contents. If using this API to shrink<br>
|
|
a file, this is usually easy since the new contents can be padded<br>
|
|
out with zeros or newlines to meet the requirement. If using this<br>
|
|
API to grow a file, the new contents can only grow up to the next<br>
|
|
extent boundary.<br>
|
|
<br>
|
|
Unlike all other APIs in <a href="#PyCdlib">PyCdlib</a>, this API actually modifies the<br>
|
|
originally opened on-disk file, so use it with caution.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
fp - The file <a href="builtins.html#object">object</a> to use for the contents of the new file.<br>
|
|
length - The length of the new data for the file.<br>
|
|
iso_path - The ISO9660 absolute path to the file destination on the ISO.<br>
|
|
rr_name - The Rock Ridge name of the file destination on the ISO.<br>
|
|
joliet_path - The Joliet absolute path to the file destination on the ISO.<br>
|
|
udf_path - The UDF absolute path to the file destination on the ISO.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-new"><strong>new</strong></a>(self, interchange_level=1, sys_ident='', vol_ident='', set_size=1, seqnum=1, log_block_size=2048, vol_set_ident=' ', pub_ident_str='', preparer_ident_str='', app_ident_str='', copyright_file='', abstract_file='', bibli_file='', vol_expire_date=None, app_use='', joliet=None, rock_ridge=None, xa=False, udf=None)</dt><dd><span class="code">Create a new ISO from scratch.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
interchange_level - The ISO9660 interchange level to use; this dictates<br>
|
|
the rules on the names of files. Levels 1, 2, 3,<br>
|
|
and 4 are supported. Level 1 is the most<br>
|
|
conservative, and is the default, but level 3 is<br>
|
|
recommended.<br>
|
|
sys_ident - The system identification string to use on the new ISO.<br>
|
|
vol_ident - The volume identification string to use on the new ISO.<br>
|
|
set_size - The size of the set of ISOs this ISO is a part of.<br>
|
|
seqnum - The sequence number of the set of this ISO.<br>
|
|
log_block_size - The logical block size to use for the ISO. While ISO9660<br>
|
|
technically supports sizes other than 2048 (the default),<br>
|
|
this almost certainly doesn't work.<br>
|
|
vol_set_ident - The volume set identification string to use on the new ISO.<br>
|
|
pub_ident_str - The publisher identification string to use on the new ISO.<br>
|
|
preparer_ident_str - The preparer identification string to use on the new ISO.<br>
|
|
app_ident_str - The application identification string to use on the new ISO.<br>
|
|
copyright_file - The name of a file at the root of the ISO to use as the<br>
|
|
copyright file.<br>
|
|
abstract_file - The name of a file at the root of the ISO to use as the<br>
|
|
abstract file.<br>
|
|
bibli_file - The name of a file at the root of the ISO to use as the<br>
|
|
bibliographic file.<br>
|
|
vol_expire_date - The date that this ISO will expire at.<br>
|
|
app_use - Arbitrary data that the application can stuff into the primary<br>
|
|
volume descriptor of this ISO.<br>
|
|
joliet - A integer that can have the value 1, 2, or 3 for Joliet<br>
|
|
levels 1, 2, or 3 (3 is by far the most common), or None for<br>
|
|
no Joliet support (the default). For legacy reasons, this<br>
|
|
parameter also accepts a boolean, where the value of 'False'<br>
|
|
means no Joliet and a value of 'True' means level 3.<br>
|
|
rock_ridge - Whether to make this ISO have the Rock Ridge extensions or<br>
|
|
not. The default value of None does not add Rock Ridge<br>
|
|
extensions. A string value of '1.09', '1.10', or '1.12'<br>
|
|
adds the specified Rock Ridge version to the ISO. If<br>
|
|
unsure, pass '1.09' to ensure maximum compatibility.<br>
|
|
xa - Whether to add the ISO9660 Extended Attribute extensions to this<br>
|
|
ISO. The default is False.<br>
|
|
udf - Whether to add UDF support to this ISO. If it is None (the<br>
|
|
default), no UDF support is added. If it is "2.60", version 2.60<br>
|
|
of the UDF spec is used. All other values are disallowed.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-open"><strong>open</strong></a>(self, filename, mode='rb')</dt><dd><span class="code">Open up an existing ISO for inspection and modification.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
filename - The filename containing the ISO to open up.<br>
|
|
mode - The mode to use when opening the ISO file; the default is 'rb'.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-open_file_from_iso"><strong>open_file_from_iso</strong></a>(self, **kwargs)</dt><dd><span class="code">Open a file for reading in a context manager. This allows the user to<br>
|
|
operate on the file in user-defined chunks (utilizing the read() method<br>
|
|
of the returned context manager).<br>
|
|
<br>
|
|
Parameters:<br>
|
|
iso_path - The absolute ISO path to the file on the ISO.<br>
|
|
rr_path - The absolute Rock Ridge path to the file on the ISO.<br>
|
|
joliet_path - The absolute Joliet path to the file on the ISO.<br>
|
|
udf_path - The absolute UDF path to the file on the ISO.<br>
|
|
Returns:<br>
|
|
A PyCdlibIO <a href="builtins.html#object">object</a> allowing access to the file.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-open_fp"><strong>open_fp</strong></a>(self, fp)</dt><dd><span class="code">Open up an existing ISO for inspection and modification. Note that the<br>
|
|
file <a href="builtins.html#object">object</a> passed in here must stay open for the lifetime of this<br>
|
|
<a href="builtins.html#object">object</a>, as the <a href="#PyCdlib">PyCdlib</a> class uses it internally to do writing and reading<br>
|
|
operations. To have <a href="#PyCdlib">PyCdlib</a> manage this automatically, use 'open'<br>
|
|
instead.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
fp - The file <a href="builtins.html#object">object</a> containing the ISO to open up.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-rm_directory"><strong>rm_directory</strong></a>(self, iso_path=None, rr_name=None, joliet_path=None, udf_path=None)</dt><dd><span class="code">Remove a directory from the ISO. The directory must be empty.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
iso_path - The path to the directory to remove.<br>
|
|
rr_name - The Rock Ridge name of the directory to remove.<br>
|
|
joliet_path - The Joliet path to the directory to remove.<br>
|
|
udf_path - The UDF absolute path to the directory to remove.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-rm_eltorito"><strong>rm_eltorito</strong></a>(self)</dt><dd><span class="code">Remove the El Torito boot record (and Boot Catalog) from the ISO.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
None.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-rm_file"><strong>rm_file</strong></a>(self, iso_path=None, rr_name=None, joliet_path=None, udf_path=None)</dt><dd><span class="code">Remove a file from the ISO. This removes the data and the listing of<br>
|
|
the file from all contexts, even when only one path is given (to only<br>
|
|
remove it from a single context, use <a href="#PyCdlib-rm_hard_link">rm_hard_link</a>() instead). Due to<br>
|
|
some complexities of the ISO format, removal of zero-byte files from all<br>
|
|
contexts does not automatically happen, so this method may need to be<br>
|
|
called more than once for zero-byte files.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
iso_path - The path to the file to remove.<br>
|
|
rr_name - The Rock Ridge name of the file to remove.<br>
|
|
joliet_path - The Joliet path to the file to remove.<br>
|
|
udf_path - The UDF path to the file to remove.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-rm_hard_link"><strong>rm_hard_link</strong></a>(self, iso_path=None, joliet_path=None, udf_path=None)</dt><dd><span class="code">Remove a hard link from the ISO. If the number of links to a piece of<br>
|
|
data drops to zero, then the contents will be removed from the ISO.<br>
|
|
This can be thought of as a lower-level interface to <a href="#PyCdlib-rm_file">rm_file</a>(). Either<br>
|
|
an ISO9660 path or a Joliet path must be passed to this API, but not<br>
|
|
both. Thus, this interface can be used to hide files from either the<br>
|
|
ISO9660 filesystem, the Joliet filesystem, or both (if there is another<br>
|
|
reference to the data on the ISO, such as in El Torito). Note that this<br>
|
|
is an advanced API, so using it in combination with the higher-level APIs<br>
|
|
(like <a href="#PyCdlib-rm_file">rm_file</a>()) may result in unexpected behavior. Once this API has<br>
|
|
been used, this API and <a href="#PyCdlib-add_hard_link">add_hard_link</a>() should be preferred over<br>
|
|
<a href="#PyCdlib-rm_file">rm_file</a>() and <a href="#PyCdlib-add_file">add_file</a>().<br>
|
|
<br>
|
|
Parameters:<br>
|
|
iso_path - The ISO link path to remove.<br>
|
|
joliet_path - The Joliet link path to remove.<br>
|
|
udf_path - The UDF link path to remove.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-rm_isohybrid"><strong>rm_isohybrid</strong></a>(self)</dt><dd><span class="code">Remove the 'hybridization' of an ISO, making it a traditional ISO again.<br>
|
|
This means the ISO will no longer be able to be copied and booted off<br>
|
|
of traditional media (like USB sticks).<br>
|
|
<br>
|
|
Parameters:<br>
|
|
None.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-rm_joliet_directory"><strong>rm_joliet_directory</strong></a>(self, joliet_path)</dt><dd><span class="code">(deprecated) Remove a Joliet directory from the ISO. It is recommended<br>
|
|
to use the 'joliet_path' parameter to 'rm_directory' instead.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
joliet_path - The Joliet path to the directory to remove.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-set_hidden"><strong>set_hidden</strong></a>(self, iso_path=None, rr_path=None, joliet_path=None)</dt><dd><span class="code">Set the ISO9660 hidden attribute on a file or directory. This will<br>
|
|
cause the file or directory not to show up when listing entries on the<br>
|
|
ISO. Exactly one of iso_path, rr_path, or joliet_path must be specified.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
iso_path - The path on the ISO to set the hidden bit on.<br>
|
|
rr_path - The Rock Ridge path on the ISO to set the hidden bit on.<br>
|
|
joliet_path - The Joliet path on the ISO to set the hidden bit on.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-set_relocated_name"><strong>set_relocated_name</strong></a>(self, name, rr_name)</dt><dd><span class="code">Set the name of the relocated directory on a Rock Ridge ISO. The ISO<br>
|
|
must be a Rock Ridge one, and must not have previously had the relocated<br>
|
|
name set.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
name - The name for a relocated directory.<br>
|
|
rr_name - The Rock Ridge name for a relocated directory.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-walk"><strong>walk</strong></a>(self, **kwargs)</dt><dd><span class="code">Walk the entries on the ISO, starting at the given path. One, and only<br>
|
|
one, of iso_path, rr_path, joliet_path, and udf_path is allowed.<br>
|
|
Similar to os.<a href="#PyCdlib-walk">walk</a>(), yield a 3-tuple of (path-to-here, dirlist, filelist)<br>
|
|
for each directory level.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
iso_path - The absolute ISO path to the starting entry on the ISO.<br>
|
|
rr_path - The absolute Rock Ridge path to the starting entry on the ISO.<br>
|
|
joliet_path - The absolute Joliet path to the starting entry on the ISO.<br>
|
|
udf_path - The absolute UDF path to the starting entry on the ISO.<br>
|
|
encoding - The encoding to use for returned strings.<br>
|
|
Yields:<br>
|
|
3-tuples of (path-to-here, dirlist, filelist)<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-write"><strong>write</strong></a>(self, filename, blocksize=32768, progress_cb=None, progress_opaque=None)</dt><dd><span class="code">Write a properly formatted ISO out to the filename passed in. This<br>
|
|
also goes by the name of 'mastering'.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
filename - The filename to write the data to.<br>
|
|
blocksize - The blocksize to use when copying data; the default is 32768.<br>
|
|
progress_cb - If not None, a function to call as the write call does its<br>
|
|
work. The callback function must have a signature of:<br>
|
|
def func(done, total, opaque).<br>
|
|
progress_opaque - User data to be passed to the progress callback; the<br>
|
|
default is None.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<dl><dt><a name="PyCdlib-write_fp"><strong>write_fp</strong></a>(self, outfp, blocksize=32768, progress_cb=None, progress_opaque=None)</dt><dd><span class="code">Write a properly formatted ISO out to the file <a href="builtins.html#object">object</a> passed in. This<br>
|
|
also goes by the name of 'mastering'.<br>
|
|
<br>
|
|
Parameters:<br>
|
|
outfp - The file <a href="builtins.html#object">object</a> to write the data to.<br>
|
|
blocksize - The blocksize to use when copying data; the default is 32768.<br>
|
|
progress_cb - If not None, a function to call as the write call does its<br>
|
|
work. The callback function must have a signature of:<br>
|
|
def func(done, total, opaque).<br>
|
|
progress_opaque - User data to be passed to the progress callback; the<br>
|
|
default is None.<br>
|
|
Returns:<br>
|
|
Nothing.</span></dd></dl>
|
|
|
|
<hr>
|
|
Data descriptors defined here:<br>
|
|
<dl><dt><strong>brs</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>eltorito_boot_catalog</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>enhanced_vd</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>inodes</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>interchange_level</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>isohybrid_mbr</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>joliet_vd</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>logical_block_size</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>pvd</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>pvds</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>rock_ridge</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>svds</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>udf_anchors</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>udf_beas</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>udf_boots</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>udf_file_set</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>udf_file_set_terminator</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>udf_logical_volume_integrity</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>udf_logical_volume_integrity_terminator</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>udf_main_descs</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>udf_nsr</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>udf_reserve_descs</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>udf_root</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>udf_teas</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>vdsts</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>version_vd</strong></dt>
|
|
</dl>
|
|
<dl><dt><strong>xa</strong></dt>
|
|
</dl>
|
|
</td></tr></table></td></tr></table></div>
|
|
</body></html>
|