1 """
2 Application-class that implements pyFoamPackCase.py
3 """
4
5 from PyFoamApplication import PyFoamApplication
6
7 from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory
8
9 from os import path
10 from optparse import OptionGroup
11
14 description="""\
15 Packs a case into a tar-file copying the system, constant and
16 0-directories. Excludes all .svn-direcotries and all files ending
17 with ~
18 """
19 PyFoamApplication.__init__(self,
20 args=args,
21 description=description,
22 usage="%prog <case>",
23 interspersed=True,
24 changeVersion=False,
25 nr=1)
26
28 what=OptionGroup(self.parser,
29 "What",
30 "Define what should be packed")
31 self.parser.add_option_group(what)
32
33 what.add_option("--last",
34 action="store_true",
35 dest="last",
36 default=False,
37 help="Also add the last time-step")
38 what.add_option("--pyfoam",
39 action="store_true",
40 dest="pyfoam",
41 default=False,
42 help="Add all files starting with PyFoam to the tarfile")
43 what.add_option("--chemkin",
44 action="store_true",
45 dest="chemkin",
46 default=False,
47 help="Also add the Chemkin-directory")
48 what.add_option("--add",
49 action="append",
50 dest="additional",
51 default=[],
52 help="Add all files and directories in the case directory that fit a glob-pattern to the tar (can be used more than once)")
53 what.add_option("--exclude",
54 action="append",
55 dest="exclude",
56 default=[],
57 help="Exclude all files and directories that fit this glob pattern from being added, no matter at level (can be used more than once)")
58 what.add_option("--no-polyMesh",
59 action="store_true",
60 dest="noPloyMesh",
61 help="Exclude the polyMesh-directory")
62 self.parser.add_option("--tarname",
63 action="store",
64 dest="tarname",
65 default=None,
66 help='Name of the tarfile. If unset the name of the case plus ".tgz" will be used')
67 self.parser.add_option("--base-name",
68 action="store",
69 dest="basename",
70 default=None,
71 help='Name of the case inside the tar-file. If not set the actual basename of the case is used')
72
100