This file is indexed.

/usr/lib/python2.7/dist-packages/code_saturne/cs_package.py is in code-saturne-data 4.3.3+repack-1build1.

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
# -*- coding: utf-8 -*-
# Package information, generated from cs_package.py.in by make.

#-------------------------------------------------------------------------------

# This file is part of Code_Saturne, a general-purpose CFD tool.
#
# Copyright (C) 1998-2016 EDF S.A.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
# Street, Fifth Floor, Boston, MA 02110-1301, USA.

#-------------------------------------------------------------------------------

import os
import sys

import cs_config


# Package information
#--------------------

class package:

    def __init__(self, scriptdir = None):

        # System configuration (compilers, pre-requisites, ...)

        self.config = cs_config.config()

        # Package information

        self.name = "code_saturne"
        self.tarname = "code_saturne"
        self.pkgversion = "4.3.3"
        self.string = "code_saturne 4.3.3"
        self.bugreport = "saturne-support@edf.fr"
        self.url = "http://code-saturne.org"
        self.version = "4.3"
        self.version_full = "4.3.3"
        self.version_short = "4.3"
        self.revision = ""

        self.code_name = "Code_Saturne"

        self.preprocessor = "cs_preprocess" + self.config.exeext
        self.solver = "cs_solver" + self.config.exeext
        self.check_syntax = "cs_check_syntax" + self.config.exeext
        self.io_dump = "cs_io_dump" + self.config.exeext
        self.guiname = "SaturneGUI" + self.config.shext
        self.runcase = "runcase" + self.config.shext
        self.runsolver = "run_solver" + self.config.shext
        self.configfile = "code_saturne" + self.config.cfgext
        self.scratchdir = 'tmp_Saturne'
        self.srcdir = 'src_saturne'

        # Installation directories

        self.scriptdir = scriptdir

        self.dirs = {'prefix': ("", "/usr"),
                     'exec_prefix': ("", "/usr"),
                     'bindir': ("bin", "/usr/bin"),
                     'includedir': ("include", "/usr/include"),
                     'pkgincludedir': (os.path.join("include", self.name),
                                       "/usr/include/code_saturne"),
                     'libdir': ("lib", "/usr/lib"),
                     'libexecdir': ("libexec", "/usr/lib"),
                     'pkglibexecdir': (os.path.join("libexec", self.name),
                                       "/usr/lib/code_saturne"),
                     'pythondir': (os.path.join("lib",
                                                "python" + sys.version[:3],
                                                "site-packages"),
                                   "/usr/lib/python2.7/dist-packages"),
                     'pkgpythondir': (os.path.join("lib",
                                                   "python" + sys.version[:3],
                                                   "site-packages",
                                                   self.name),
                                      "/usr/lib/python2.7/dist-packages/code_saturne"),
                     'localedir': (os.path.join("share", "locale"),
                                   "/usr/share/locale"),
                     'datarootdir': ("share", "/usr/share"),
                     'datadir': ("share", "/usr/share"),
                     'pkgdatadir': (os.path.join("share", self.name),
                                    "/usr/share/code_saturne"),
                     'docdir': (os.path.join("share", "doc", self.name),
                                "/usr/share/doc/code_saturne"),
                     'pdfdir': (os.path.join("share", "doc", self.name),
                                "/usr/share/doc/code_saturne"),
                     'sysconfdir': ("etc", "/etc")}

    def get_dir(self, installdir):

        # First, handle the standard "non relocatable" case
        if self.config.features['relocatable'] == "no":
            return self.dirs[installdir][1]

        # Second, check if CS_ROOT_DIR is set
        prefix = os.getenv('CS_ROOT_DIR')

        # Third, assume that SALOME is being used
        if prefix == None:
            prefix = os.getenv('CFDMODULE_ROOT_DIR')

        # Last, assume that code_saturne main script is used
        if prefix == None:
            bindir = os.path.dirname(self.scriptdir)
            prefix = os.path.dirname(bindir)

        return os.path.join(prefix, self.dirs[installdir][0])

    def get_preprocessor(self):

        return os.path.join(self.get_dir("pkglibexecdir"),
                            self.preprocessor)

    def get_io_dump(self):

        return os.path.join(self.get_dir("pkglibexecdir"),
                            self.io_dump)

    def get_solver(self):

        return os.path.join(self.get_dir("pkglibexecdir"),
                            self.solver)

    def get_check_syntax(self):

        return os.path.join(self.get_dir("pkglibexecdir"),
                            self.check_syntax)

    def get_io_dump(self):

        return os.path.join(self.get_dir("pkglibexecdir"),
                            self.io_dump)

    def get_global_configfile(self):

        # Windows XP:         C:\Documents and Settings\All Users
        # Windows Vista/7/8:  C:\ProgramData
        # Linux and co:       /etc

        if sys.platform.startswith("win"):
            # One could use PROGRAMDATA but it is not available on Windows XP
            configdir = os.path.join(os.getenv("ALLUSERSPROFILE"),
                                     self.code_name, self.version_short)
        else:
            configdir = self.get_dir("sysconfdir")

        return [os.path.join(configdir, self.configfile)]

    def get_user_configfile(self):

        # Windows XP:         C:\Documents and Settings\{user}\Application Data
        # Windows Vista/7/8:  C:\Users\{user}\AppData\Roaming
        # Linux and co:       /home/{user}   (or similar)

        if sys.platform.startswith("win"):
            configdir = os.path.join(os.getenv("APPDATA"),
                                     self.code_name, self.version_short)
            return [os.path.join(configdir, self.configfile)]
        else:
            configdir = os.path.expanduser("~")
            return [os.path.join(configdir, "." + self.configfile)]

    def get_configfiles(self):

        u_cfg = self.get_user_configfile()
        g_cfg = self.get_global_configfile()

        return g_cfg + u_cfg

    def get_batchdir(self):

        return os.path.join(self.get_dir("pkgdatadir"),
                            'batch')

    def get_runcase_script(self, script):

        return os.path.join(self.get_dir("pkgdatadir"),
                            script)

    def get_alternate_version(self, version):
        """
        Return alternate version package object
        """

        pkg = None

        # Determine path (by absolute or local name)
        pythondir = os.path.normpath(version)
        prefix = os.path.normpath(self.get_dir("exec_prefix"))
        if self.get_dir("pkgpythondir").find(prefix) > -1:
            postfix = self.get_dir("pkgpythondir")[len(prefix)+1:]
            if not os.path.isabs(pythondir):
                prefix = os.path.split(prefix)[0]
            else:
                prefix = version
            pythondir = os.path.normpath(os.path.join(prefix,
                                                      version,
                                                      postfix))

        # load alternate package
        if os.path.isdir(pythondir):
            import sys
            sys.path.insert(0, pythondir)
            if sys.version < '3.4':
                import cs_config
                reload(cs_config)
                import cs_package
                reload(cs_package)
            else:
                import importlib
                import cs_config
                importlib.reload(cs_config)
                import cs_package
                importlib.reload(cs_package)
            pkg = cs_package.package()
            sys.path.pop(0)
        else:
            raise ImportError("Alternative version '" + pythondir + "' not found.")

        return pkg


    def get_cross_compil(self):

        return self.config.features['build_os']


#-------------------------------------------------------------------------------