• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1:mod:`modulegraph.zipio` --- Read-only filesystem access
2========================================================
3
4.. module:: modulegraph.zipio
5   :synopsis: Read-only filesystem access with ZIP support
6
7This module contains a number of functions that mirror functions found
8in :mod:`os` and :mod:`os.path`, but have support for data inside
9zipfiles as well as regular filesystem objects.
10
11The *path* argument of all functions below can refer to an object
12on the filesystem, but can also refer to an entry inside a zipfile. In
13the latter case, a prefix of *path* will be the name of zipfile while
14the rest refers to an object in that zipfile. As an example, when
15``somepath/mydata.zip`` is a zipfile the path ``somepath/mydata.zip/somefile.txt``
16will refer to ``somefile.txt`` inside the zipfile.
17
18.. function:: open(path[, mode])
19
20   Open a file, like :func:`the built-in open function <__builtin__.open>`.
21
22   The *mode* defaults to ``"r"`` and must be either ``"r"`` or ``"rb"``.
23
24.. function:: listdir(path)
25
26   List the contents of a directory, like :func:`os.listdir`.
27
28
29.. function:: isfile(path)
30
31   Returns true if *path* exists and refers to a file.
32
33   Raises IOError when *path* doesn't exist at all.
34
35   Based on :func:`os.path.isfile`
36
37
38.. function:: isdir(path)
39
40   Returns true if *path* exists and refers to a directory.
41
42   Raises IOError when *path* doesn't exist at all.
43
44   Based on :func:`os.path.isdir`
45
46
47.. function:: islink(path)
48
49   Returns true if *path* exists and refers to a symbolic link.
50
51   Raises IOError when *path* doesn't exist at all.
52
53   Based on :func:`os.path.islink`
54
55
56.. function:: readlink(path)
57
58   Returns the contents of a symbolic link, like :func:`os.readlink`.
59
60.. function:: getmtime(path)
61
62   Returns the last modifiction time of a file or directory, like
63   :func:`os.path.getmtime`.
64
65.. function:: getmode(path)
66
67   Returns the UNIX file mode for a file or directory, like the
68   *st_mode* attribute in the result of :func:`os.stat`.
69