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