diff options
Diffstat (limited to 'scripts/lib/mic/3rdparty/pykickstart/commands/xconfig.py')
| -rw-r--r-- | scripts/lib/mic/3rdparty/pykickstart/commands/xconfig.py | 184 |
1 files changed, 184 insertions, 0 deletions
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/xconfig.py b/scripts/lib/mic/3rdparty/pykickstart/commands/xconfig.py new file mode 100644 index 0000000000..644ee86743 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/xconfig.py | |||
| @@ -0,0 +1,184 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007, 2008 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC3_XConfig(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.op = self._getParser() | ||
| 34 | |||
| 35 | self.card = kwargs.get("card", "") | ||
| 36 | self.defaultdesktop = kwargs.get("defaultdesktop", "") | ||
| 37 | self.depth = kwargs.get("depth", 0) | ||
| 38 | self.hsync = kwargs.get("hsync", "") | ||
| 39 | self.monitor = kwargs.get("monitor", "") | ||
| 40 | self.noProbe = kwargs.get("noProbe", False) | ||
| 41 | self.resolution = kwargs.get("resolution", "") | ||
| 42 | self.server = kwargs.get("server", "") | ||
| 43 | self.startX = kwargs.get("startX", False) | ||
| 44 | self.videoRam = kwargs.get("videoRam", "") | ||
| 45 | self.vsync = kwargs.get("vsync", "") | ||
| 46 | |||
| 47 | def __str__(self): | ||
| 48 | retval = KickstartCommand.__str__(self) | ||
| 49 | |||
| 50 | if self.card != "": | ||
| 51 | retval += " --card=%s" % self.card | ||
| 52 | if self.defaultdesktop != "": | ||
| 53 | retval += " --defaultdesktop=%s" % self.defaultdesktop | ||
| 54 | if self.depth != 0: | ||
| 55 | retval += " --depth=%d" % self.depth | ||
| 56 | if self.hsync != "": | ||
| 57 | retval += " --hsync=%s" % self.hsync | ||
| 58 | if self.monitor != "": | ||
| 59 | retval += " --monitor=%s" % self.monitor | ||
| 60 | if self.noProbe: | ||
| 61 | retval += " --noprobe" | ||
| 62 | if self.resolution != "": | ||
| 63 | retval += " --resolution=%s" % self.resolution | ||
| 64 | if self.server != "": | ||
| 65 | retval += " --server=%s" % self.server | ||
| 66 | if self.startX: | ||
| 67 | retval += " --startxonboot" | ||
| 68 | if self.videoRam != "": | ||
| 69 | retval += " --videoram=%s" % self.videoRam | ||
| 70 | if self.vsync != "": | ||
| 71 | retval += " --vsync=%s" % self.vsync | ||
| 72 | |||
| 73 | if retval != "": | ||
| 74 | retval = "# X Window System configuration information\nxconfig %s\n" % retval | ||
| 75 | |||
| 76 | return retval | ||
| 77 | |||
| 78 | def _getParser(self): | ||
| 79 | op = KSOptionParser() | ||
| 80 | op.add_option("--card") | ||
| 81 | op.add_option("--defaultdesktop") | ||
| 82 | op.add_option("--depth", action="store", type="int", nargs=1) | ||
| 83 | op.add_option("--hsync") | ||
| 84 | op.add_option("--monitor") | ||
| 85 | op.add_option("--noprobe", dest="noProbe", action="store_true", | ||
| 86 | default=False) | ||
| 87 | op.add_option("--resolution") | ||
| 88 | op.add_option("--server") | ||
| 89 | op.add_option("--startxonboot", dest="startX", action="store_true", | ||
| 90 | default=False) | ||
| 91 | op.add_option("--videoram", dest="videoRam") | ||
| 92 | op.add_option("--vsync") | ||
| 93 | return op | ||
| 94 | |||
| 95 | def parse(self, args): | ||
| 96 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 97 | if extra: | ||
| 98 | mapping = {"command": "xconfig", "options": extra} | ||
| 99 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Unexpected arguments to %(command)s command: %(options)s") % mapping) | ||
| 100 | |||
| 101 | self._setToSelf(self.op, opts) | ||
| 102 | return self | ||
| 103 | |||
| 104 | class FC6_XConfig(FC3_XConfig): | ||
| 105 | removedKeywords = FC3_XConfig.removedKeywords + ["card", "hsync", "monitor", "noProbe", "vsync"] | ||
| 106 | removedAttrs = FC3_XConfig.removedAttrs + ["card", "hsync", "monitor", "noProbe", "vsync"] | ||
| 107 | |||
| 108 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 109 | FC3_XConfig.__init__(self, writePriority, *args, **kwargs) | ||
| 110 | self.deleteRemovedAttrs() | ||
| 111 | |||
| 112 | self.driver = kwargs.get("driver", "") | ||
| 113 | |||
| 114 | def __str__(self): | ||
| 115 | retval = KickstartCommand.__str__(self) | ||
| 116 | |||
| 117 | if hasattr(self, "driver") and self.driver != "": | ||
| 118 | retval += " --driver=%s" % self.driver | ||
| 119 | if self.defaultdesktop != "": | ||
| 120 | retval += " --defaultdesktop=%s" % self.defaultdesktop | ||
| 121 | if self.depth != 0: | ||
| 122 | retval += " --depth=%d" % self.depth | ||
| 123 | if hasattr(self, "resolution") and self.resolution != "": | ||
| 124 | retval += " --resolution=%s" % self.resolution | ||
| 125 | if self.startX: | ||
| 126 | retval += " --startxonboot" | ||
| 127 | if hasattr(self, "videoRam") and self.videoRam != "": | ||
| 128 | retval += " --videoram=%s" % self.videoRam | ||
| 129 | |||
| 130 | if retval != "": | ||
| 131 | retval = "# X Window System configuration information\nxconfig %s\n" % retval | ||
| 132 | |||
| 133 | return retval | ||
| 134 | |||
| 135 | def _getParser(self): | ||
| 136 | op = FC3_XConfig._getParser(self) | ||
| 137 | op.add_option("--card", deprecated=1) | ||
| 138 | op.add_option("--driver", dest="driver") | ||
| 139 | op.add_option("--hsync", deprecated=1) | ||
| 140 | op.add_option("--monitor", deprecated=1) | ||
| 141 | op.add_option("--noprobe", deprecated=1) | ||
| 142 | op.add_option("--vsync", deprecated=1) | ||
| 143 | return op | ||
| 144 | |||
| 145 | class F9_XConfig(FC6_XConfig): | ||
| 146 | removedKeywords = FC6_XConfig.removedKeywords | ||
| 147 | removedAttrs = FC6_XConfig.removedAttrs | ||
| 148 | |||
| 149 | def _getParser(self): | ||
| 150 | op = FC6_XConfig._getParser(self) | ||
| 151 | op.remove_option("--card") | ||
| 152 | op.remove_option("--hsync") | ||
| 153 | op.remove_option("--monitor") | ||
| 154 | op.remove_option("--noprobe") | ||
| 155 | op.remove_option("--vsync") | ||
| 156 | return op | ||
| 157 | |||
| 158 | class F10_XConfig(F9_XConfig): | ||
| 159 | removedKeywords = F9_XConfig.removedKeywords + ["driver", "resolution", "videoRam"] | ||
| 160 | removedAttrs = F9_XConfig.removedAttrs + ["driver", "resolution", "videoRam"] | ||
| 161 | |||
| 162 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 163 | F9_XConfig.__init__(self, writePriority, *args, **kwargs) | ||
| 164 | self.deleteRemovedAttrs() | ||
| 165 | |||
| 166 | def _getParser(self): | ||
| 167 | op = F9_XConfig._getParser(self) | ||
| 168 | op.add_option("--driver", deprecated=1) | ||
| 169 | op.add_option("--depth", deprecated=1) | ||
| 170 | op.add_option("--resolution", deprecated=1) | ||
| 171 | op.add_option("--videoram", deprecated=1) | ||
| 172 | return op | ||
| 173 | |||
| 174 | class F14_XConfig(F10_XConfig): | ||
| 175 | removedKeywords = F10_XConfig.removedKeywords | ||
| 176 | removedAttrs = F10_XConfig.removedAttrs | ||
| 177 | |||
| 178 | def _getParser(self): | ||
| 179 | op = F10_XConfig._getParser(self) | ||
| 180 | op.remove_option("--driver") | ||
| 181 | op.remove_option("--depth") | ||
| 182 | op.remove_option("--resolution") | ||
| 183 | op.remove_option("--videoram") | ||
| 184 | return op | ||
