This file is indexed.

/usr/share/pyshared/kivy/garden.py is in python-kivy 1.7.2-1.

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
'''
Garden
======

.. versionadded:: 1.7.0

Garden is a project to centralize addons for Kivy, maintained by users. You can
find more information at `Kivy Garden <http://kivy-garden.github.io/>`_ All the
garden packages are centralized on the `kivy-garden Github
<https://github.com/kivy-garden>`_.

We provide a tool (`kivy/tools/garden`) for managing garden packages::

    # Installing a garden package
    garden install graph

    # Upgrade a garden package
    garden install --upgrade graph

    # Uninstall a garden package
    garden uninstall graph

    # List all the garden packages installed
    garden list

    # Search new packages
    garden search

    # Search all the packages that contain "graph"
    garden search graph

    # Show the help
    garden --help

All the garden packages are installed by default in `~/.kivy/garden`.

Packaging
---------

If you want to include garden package in your application, you can add `--app`
in the `install` command. This will create a `libs/garden` directory in your
current directory, and will be used by `kivy.garden`.

For example::

    cd myapp
    garden install --app graph


'''

__path__ = 'kivy.garden'

import sys
import imp
from os.path import dirname, join, realpath, exists
from kivy import kivy_home_dir

#: system path where garden modules can be installed
garden_system_dir = join(kivy_home_dir, 'garden')

#: application path where garden modules can be installed
garden_app_dir = join(realpath(dirname(sys.argv[0])), 'libs', 'garden')


class GardenImporter(object):

    def find_module(self, fullname, path):
        #print 'find_module()', (fullname, path)
        if path == 'kivy.garden':
            return self

    def load_module(self, fullname):
        #print 'load_module()', fullname
        assert(fullname.startswith('kivy.'))
        modname = fullname.split('.', 1)[-1]
        for directory in (garden_app_dir, garden_system_dir):
            moddir = join(directory, modname)
            #print 'search for', moddir
            if exists(moddir):
                return self._load_module(fullname, moddir)

    def _load_module(self, fullname, moddir):
        mod = imp.load_module(fullname, None, moddir,
                ('', '', imp.PKG_DIRECTORY))
        return mod


# insert the garden importer as ultimate importer
sys.meta_path.append(GardenImporter())