This file is indexed.

/usr/share/doc/python-kiwi/api/kiwi.environ.Library.html is in python-kiwi 1.9.22-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>kiwi.environ.Library : API documentation</title>
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
    <link href="apidocs.css" type="text/css" rel="stylesheet" />
    
    
  </head>
  <body>
    <h1 class="class">k.e.Library(<a href="kiwi.environ.Environment.html">Environment</a>) : class documentation</h1>
    <p>
      <span id="part">Part of <a href="kiwi.html">kiwi</a>.<a href="kiwi.environ.html">environ</a></span>
      
      <a href="classIndex.html#kiwi.environ.Library">View In Hierarchy</a>
    </p>
    <div>
      <p>Known subclasses: <a href="kiwi.environ.Application.html">kiwi.environ.Application</a></p>
    </div>
    <div>A Library is a local environment object, it's a subclass of the 
Environment class. It's used by libraries and applications (through the 
Application class)</p>
<p>It provides a way to manage local resources, which should only be seen 
in the current context.</p>
<p>Libraries are usually instantiated in __init__.py in the topmost package
in your library, an example usage is kiwi itself which does:</p>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">from</span> kiwi.environ <span class="py-keyword">import</span> Library
<span class="py-prompt">&gt;&gt;&gt; </span>lib = Library(<span class="py-string">'kiwi'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">if</span> lib.uninstalled:
<span class="py-prompt">&gt;&gt;&gt; </span>    lib.add_global_resource(<span class="py-string">'glade'</span>, <span class="py-string">'glade'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span>    lib.add_global_resource(<span class="py-string">'pixmap'</span>, <span class="py-string">'pixmaps'</span>)</pre>
<p>which is combined with the following class in setup.py:</p>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">from</span> kiwi.dist <span class="py-keyword">import</span> InstallLib
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">class</span> <span class="py-defname">InstallLib</span>(TemplateInstallLib):
<span class="py-prompt">&gt;&gt;&gt; </span>   name = <span class="py-string">'kiwi'</span>
<span class="py-prompt">&gt;&gt;&gt; </span>   global_resources = dict(glade=<span class="py-string">'$datadir/glade'</span>,
<span class="py-prompt">&gt;&gt;&gt; </span>                           pixmap=<span class="py-string">'$datadir/pixmaps'</span>)
<span class="py-prompt">&gt;&gt;&gt;</span>
<span class="py-prompt">&gt;&gt;&gt; </span>setup(...,
<span class="py-prompt">&gt;&gt;&gt; </span>      data_files=[(<span class="py-string">'share/kiwi/glade'</span>,
<span class="py-prompt">&gt;&gt;&gt; </span>                  listfiles(<span class="py-string">'glade'</span>, <span class="py-string">'*.glade'</span>)),
<span class="py-prompt">&gt;&gt;&gt; </span>                  (<span class="py-string">'share/kiwi/pixmaps'</span>,
<span class="py-prompt">&gt;&gt;&gt; </span>                  listfiles(<span class="py-string">'pixmaps'</span>, <span class="py-string">'*.png'</span>)),
<span class="py-prompt">&gt;&gt;&gt; </span>      cmdclass=dict(install_lib=InstallLib))</pre>
<p>It may seems like a bit of work, but this is everything that's needed 
for kiwi to figure out how to load resources when installed and when 
running in an uninstalled mode, eg directly from the source tree. To locate
a pixmap called kiwi.png the following is enough:</p>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">from</span> kiwi.environ <span class="py-keyword">import</span> environ
<span class="py-prompt">&gt;&gt;&gt; </span>environ.find_resource(<span class="py-string">'pixmap'</span>, <span class="py-string">'kiwi.png'</span>)
<span class="py-output">'/usr/share/kiwi/pixmaps/kiwi.png' # installed mode</span></pre>
<p>Which will lookup the resource kiwi.png in the domain pixmap, which 
points to $datadir/pixmaps (eg $prefix/share/kiwi/pixmaps) when running in 
installed mode and from $builddir/pixmaps otherwise.<table class="fieldTable"></table></div>

    
    
    <div id="splitTables">
      <table class="children sortable" id="id401">
  
  
<tr class="method">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Library.html#__init__">__init__</a></td>
    <td><span>Creates a new library, this is usually called in __init__.py in a</span></td>
  </tr><tr class="method">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Library.html#enable_translation">enable_translation</a></td>
    <td><span>Enables translation for a library</span></td>
  </tr><tr class="method">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Library.html#set_application_domain">set_application_domain</a></td>
    <td><span>Sets the default application domain</span></td>
  </tr><tr class="method">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Library.html#add_global_resource">add_global_resource</a></td>
    <td><span>Convenience method to add a global resource.</span></td>
  </tr><tr class="method">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Library.html#add_global_resources">add_global_resources</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr><tr class="method private">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Library.html#_check_translation">_check_translation</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr>
  
</table>
      
        <p>
          Inherited from <a href="kiwi.environ.Environment.html">Environment</a>:
        </p>
        <table class="children sortable" id="id402">
  
  
<tr class="basemethod">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Environment.html#get_root">get_root</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr><tr class="basemethod">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Environment.html#get_log_level">get_log_level</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr><tr class="basemethod">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Environment.html#get_resource_paths">get_resource_paths</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr><tr class="basemethod">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Environment.html#add_resource">add_resource</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr><tr class="basemethod">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Environment.html#add_resources">add_resources</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr><tr class="basemethod">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Environment.html#find_resource">find_resource</a></td>
    <td><span>Locate a specific resource of called name of type resource</span></td>
  </tr><tr class="basemethod private">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Environment.html#_add_extensions">_add_extensions</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr><tr class="basemethod private">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Environment.html#_add_resource_variable">_add_resource_variable</a></td>
    <td><span>Add resources from an environment variable</span></td>
  </tr><tr class="basemethod private">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Environment.html#_get_epydoc">_get_epydoc</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr>
  
</table>
      
      
    </div>
    
    
    

    <div class="function">
  <a name="kiwi.environ.Library.__init__">
    
  </a>
  <a name="__init__">
    
  </a>
  <div class="functionHeader">
    
    def
    __init__(self, name, root='..', dirname=None):
    
  </div>
  <div class="functionBody">
    <div class="interfaceinfo">overrides <a href="kiwi.environ.Environment.html#__init__">kiwi.environ.Environment.__init__</a></div><div class="interfaceinfo">overridden in <a href="kiwi.environ.Application.html">kiwi.environ.Application</a></div>
    <div>Creates a new library, this is usually called in __init__.py in a 
toplevel package. All resources will be relative to the <i>root</i> 
directory.<table class="fieldTable"><tr class="fieldStart"><td class="fieldName">Parameters</td><td class="fieldArg">name</td><td>name of the library
</td></tr><tr><td></td><td class="fieldArg">root</td><td>root directory
</td></tr><tr><td></td><td class="fieldArg">dirname</td><td></td></tr></table></div>
  </div>
</div><div class="function">
  <a name="kiwi.environ.Library._check_translation">
    
  </a>
  <a name="_check_translation">
    
  </a>
  <div class="functionHeader">
    
    def
    _check_translation(self, domain, directory):
    
  </div>
  <div class="functionBody">
    
    <div class="undocumented">Undocumented</div>
  </div>
</div><div class="function">
  <a name="kiwi.environ.Library.enable_translation">
    
  </a>
  <a name="enable_translation">
    
  </a>
  <div class="functionHeader">
    
    def
    enable_translation(self, domain=None, localedir=None):
    
  </div>
  <div class="functionBody">
    <div class="interfaceinfo">overridden in <a href="kiwi.environ.Application.html">kiwi.environ.Application</a></div>
    <div>Enables translation for a library<table class="fieldTable"><tr class="fieldStart"><td class="fieldName">Parameters</td><td class="fieldArg">domain</td><td>optional, if not specified name sent to constructor will be used
</td></tr><tr><td></td><td class="fieldArg">localedir</td><td>directory to get locales from when running in uninstalled mode. If not 
specified a directory called 'locale' in the root will be used.
</td></tr></table></div>
  </div>
</div><div class="function">
  <a name="kiwi.environ.Library.set_application_domain">
    
  </a>
  <a name="set_application_domain">
    
  </a>
  <div class="functionHeader">
    
    def
    set_application_domain(self, domain):
    
  </div>
  <div class="functionBody">
    
    <div>Sets the default application domain<table class="fieldTable"><tr class="fieldStart"><td class="fieldName">Parameters</td><td class="fieldArg">domain</td><td>the domain
</td></tr></table></div>
  </div>
</div><div class="function">
  <a name="kiwi.environ.Library.add_global_resource">
    
  </a>
  <a name="add_global_resource">
    
  </a>
  <div class="functionHeader">
    
    def
    add_global_resource(self, resource, path):
    
  </div>
  <div class="functionBody">
    
    <div>Convenience method to add a global resource. This is the same as calling
kiwi.environ.environ.add_resource<table class="fieldTable"></table></div>
  </div>
</div><div class="function">
  <a name="kiwi.environ.Library.add_global_resources">
    
  </a>
  <a name="add_global_resources">
    
  </a>
  <div class="functionHeader">
    
    def
    add_global_resources(self, **kwargs):
    
  </div>
  <div class="functionBody">
    
    <div class="undocumented">Undocumented</div>
  </div>
</div>
    <address>
      <a href="index.html">API Documentation</a> for Kiwi, generated by <a href="http://codespeak.net/~mwh/pydoctor/">pydoctor</a> at 2010-05-20 02:10:57.
    </address>
  </body>
</html>