1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2011-2014 CEA/DEN, EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 Python script for HOMARD
22 Copyright EDF-R&D 2014
28 #========================================================================
29 #========================================================================
30 def gzip_gunzip(data_dir, num_tuto, option) :
32 Compression/Uncompression of the med files of a directory such as tutorial_x.nn.med
34 num_tuto: number of the tutorial
35 option : 1: compression, -1: uncompression
36 Copyright EDF-R&D 2014
39 ficloc_basis = "tutorial_%d" % num_tuto
50 ficloc = ficloc_basis + ".%02d.med" % num
51 nomfic = os.path.join(data_dir, ficloc)
52 if not os.path.isfile(nomfic) :
54 nomfic = os.path.join(data_dir, ficloc)
55 if os.path.isfile(nomfic) :
56 os.system("gunzip "+nomfic)
61 ficloc = ficloc_basis + ".fr.med"
62 nomfic = os.path.join(data_dir, ficloc)
63 if not os.path.isfile(nomfic) :
65 nomfic = os.path.join(data_dir, ficloc)
66 if os.path.isfile(nomfic) :
67 os.system("gunzip "+nomfic)
71 elif ( option == 1 ) :
75 ficloc = ficloc_basis + ".%02d.med.gz" % num
76 nomfic = os.path.join(data_dir, ficloc)
77 if not os.path.isfile(nomfic) :
78 ficloc = ficloc_basis + ".%02d.med" % num
79 nomfic = os.path.join(data_dir, ficloc)
80 if os.path.isfile(nomfic) :
81 os.system("gzip "+nomfic)
86 ficloc = ficloc_basis + ".fr.med.gz"
87 nomfic = os.path.join(data_dir, ficloc)
88 if not os.path.isfile(nomfic) :
89 ficloc = ficloc_basis + ".fr.med"
90 nomfic = os.path.join(data_dir, ficloc)
91 if os.path.isfile(nomfic) :
92 os.system("gzip "+nomfic)
96 #========================================================================
97 #========================================================================