1
#-------------------------------------------------------------------------------
3
# This file is part of the Code_Saturne User Interface, element of the
4
# Code_Saturne CFD tool.
6
# Copyright (C) 1998-2010 EDF S.A., France
8
# contact: saturne-support@edf.fr
10
# The Code_Saturne User Interface is free software; you can redistribute it
11
# and/or modify it under the terms of the GNU General Public License
12
# as published by the Free Software Foundation; either version 2 of
13
# the License, or (at your option) any later version.
15
# The Code_Saturne User Interface is distributed in the hope that it will be
16
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
17
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
# GNU General Public License for more details.
20
# You should have received a copy of the GNU General Public License
21
# along with the Code_Saturne Kernel; if not, write to the
22
# Free Software Foundation, Inc.,
23
# 51 Franklin St, Fifth Floor,
24
# Boston, MA 02110-1301 USA
26
#-------------------------------------------------------------------------------
3
#-------------------------------------------------------------------------------
5
# This file is part of Code_Saturne, a general-purpose CFD tool.
7
# Copyright (C) 1998-2011 EDF S.A.
9
# This program is free software; you can redistribute it and/or modify it under
10
# the terms of the GNU General Public License as published by the Free Software
11
# Foundation; either version 2 of the License, or (at your option) any later
14
# This program is distributed in the hope that it will be useful, but WITHOUT
15
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19
# You should have received a copy of the GNU General Public License along with
20
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
21
# Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
#-------------------------------------------------------------------------------
30
26
This module describes the script used to display information on Code_Saturne.
44
40
import os, sys, pwd, shutil, stat
45
41
from optparse import OptionParser
50
43
#-------------------------------------------------------------------------------
51
44
# Processes the passed command line arguments
52
45
#-------------------------------------------------------------------------------
55
def process_cmd_line(argv):
48
def process_cmd_line(argv, pkg):
57
50
Processes the passed command line arguments.
76
69
parser.add_option("--version", dest="version",
77
70
action="store_true",
78
help="print Code_Saturne version number")
71
help="print version number")
80
73
parser.set_defaults(pdf_reader=None)
81
74
parser.set_defaults(guides=[])
99
92
#-------------------------------------------------------------------------------
95
def print_version(pkg):
104
97
Print Code_Saturne version.
107
print "Code_Saturne version: %s" % cs_config.package.version
100
print(pkg.name + " version: " + pkg.version)
110
103
#-------------------------------------------------------------------------------
123
116
"kde-open", # KDE 4
124
117
"exo-open"] # Xfce
126
readers = ["evince", "gpdf", "kpdf", "xpdf", "acroread"]
119
readers = ["okular", "evince", "kpdf", "gpdf", "xpdf", "acroread"]
128
manual = os.path.join(cs_config.dirs.pdfdir, m) + '.pdf'
121
manual = os.path.join(pkg.pdfdir, m) + '.pdf'
130
123
if not os.path.isfile(manual):
131
print "File %s not found." % manual
124
print("File %s not found." % manual)
134
127
# First: use the reader specified by the user, if any
150
143
if os.system(cmd) == 0:
154
#-------------------------------------------------------------------------------
155
# Creation of the study directory
156
#-------------------------------------------------------------------------------
146
#-------------------------------------------------------------------------------
148
#-------------------------------------------------------------------------------
164
manuals, reader = process_cmd_line(argv)
155
manuals, reader = process_cmd_line(argv, pkg)
166
157
for m in manuals:
167
launch_manual(reader, m)
170
if __name__ == "__main__":
158
launch_manual(reader, m, pkg)
173
160
#-------------------------------------------------------------------------------