Contains routines required to initialize mrv
Perform the actual execution of the executable with the given args. This method does whatever is required to get it right on windows, which is the only reason this method exists !
Parameter: | args – arguments, without the executable as first argument |
---|---|
Note: | does not return |
Returns: | list of installed maya versions which are locally available - |
---|
they can be used in methods that require the maya_version to be given. Versions are ordered such that the latest version is given last.
Replace this process with the maya executable as specified by maya_version.
Parameters: |
|
---|---|
Rase environmenterror: | |
if the respective maya version could not be found |
Replace this process with a python process as determined by the given options. This will either be the respective python interpreter, or mayapy. If it works, the function does not return
Parameters: |
|
---|
Use this option in case the python interpreter crashes for some reason. :raise EnvironmentError: If no suitable executable could be started
Find an mrv script of the given name. This method should be used if you want to figure out where the mrv executable with the given name is located. The returned path is either relative or absolute.
Returns: | Path to script |
---|---|
Raises EnvironmentError: | |
if the executable could not be found | |
Note: | Currently it only looks for executables, but handles projects |
which use mrv as a subproject
Intialize MRV up to the point where we can replace this process with the one we prepared
Parameter: | args – commandline arguments excluding the executable ( usually first arg ) |
---|---|
Returns: | tuple(use_this_interpreter, maya_version, args) tuple of Bool, maya_version, and the remaining args The boolean indicates whether we have to reuse this interpreter, as it is mayapy |
Returns: | True if version is a supported maya version |
---|---|
Parameter: | version – float which is either 8.5 or 2008 to 20XX |
Returns: | A path instance of the correct type |
---|---|
Note: | use this constructor if you use the Path.set_separator method at runtime to assure you will always create instances of the actual type, and not only of the type you imported last |
Enclose arguments in quotes if they contain spaces ... on windows only :return: tuple of possibly modified arguments
Todo: | remove this function, its unused |
---|
Returns: | possibly adjusted path to executable in order to allow its execution This currently only kicks in on windows as we can’t handle spaces properly. |
---|---|
Note: | Will change working dir |
Todo: | remove this function, its unused |
Returns: | string path to the existing maya installation directory for the |
---|
given maya version :raise EnvironmentError: if it was not found
Returns: | float representing the maya version of the currently running |
---|
mayapy interpreter. :raise EnvironmentError: If called from a ‘normal’ python interpreter
Returns: | tuple(bool, version) tuple of bool indicating whether the version could |
---|
be parsed and was valid, and a float representing the parsed or default version. :param default: The desired default maya version
Returns: | name or path to python executable in this system, deals with |
---|
linux and windows specials
Returns: | python version matching the given maya version |
---|---|
Raises EnvironmentError: | |
If there is no known matching python version |
Set the given env_var to the given value, but append the existing value to it using the system path separator
Parameter: | append – if True, value will be appended to existing values, otherwise it will be prepended |
---|
Returns: | True if the executable is mayapy |
---|
Epydoc: mrv.cmd.base.SpawnedCommand
Bases: object
Implements a command which can be started easily by specifying a class path such as package.cmd.module.CommandClass whose instance should be started in a standalone process.
The target command must be derived from this class and must implement the ‘execute’ method.
To use this class, derive from it and change the configuration variables accordingly.
The instance will always own a logger instance at its member called ‘log’, the configuration will be applied according to k_log_application_id
The parser used to parse all options is vailable at its member called ‘parser’, its set during option_parser
The instance may also be created within an existing process and executed manually - in that case it will not exit automatically if a serious event occours
Damonize the spawned command, passing *args to the instanciated command’s execute method.
Returns: | None in calling process, no return in the daemon as sys.exit will be called. |
---|---|
Note: | see configuration variables prefixed with _daemon_ |
Note: | based on Chad J. Schroeder createDaemon method, see http://code.activestate.com/recipes/278731-creating-a-daemon-the-python-way |
Returns: | OptionParser Instance containing all supported options |
---|---|
Note: | Should be overridden by subclass to add additional options and option groups themselves after calling the base class implementation |
Spawn a new standalone process of this command type Additional arguments passed to the command process
Parameter: | kwargs – Additional keyword arguments to be passed to Subprocess.Popen, use it to configure your IO |
---|
Returns: Subprocess.Popen instance
Epydoc: mrv.cmd.base.SpawnedHelpFormatter
Bases: optparse.TitledHelpFormatter
Formatter assuring our help looks good
Epydoc: mrv.cmd.base.SpawnedOptionParser
Bases: optparse.OptionParser
Customized version to ease use of SpawnedCommand
Initialized with the ‘spawned’ keyword in addition to the default keywords to prevent a system exit
check_values(values : Values, args : [string]) -> (values : Values, args : [string])
Check that the supplied option values and leftover arguments are valid. Returns the option values and leftover arguments (possibly adjusted, possibly completely new – whatever you like). Default implementation just returns the passed-in values; subclasses may override as desired.
error(msg : string)
Print a usage message incorporating ‘msg’ to stderr and exit. If you override this in a subclass, it should not return – it should either exit or raise an exception.
-> (values : Values, args : [string])
Parse the command-line options found in ‘args’ (default: sys.argv[1:]). Any errors result in a call to ‘error()’, which by default prints the usage message to stderr and calls sys.exit() with an error message. On success returns a pair (values, args) where ‘values’ is an Values instance (with all your option values) and ‘args’ is the list of arguments left over after parsing options.
print_help(file : file = stdout)
Print an extended help message, listing all options and any help text provided with them, to ‘file’ (default stdout).
print_usage(file : file = stdout)
Print the usage message for the current program (self.usage) to ‘file’ (default stdout). Any occurrence of the string “%prog” in self.usage is replaced with the name of the current program (basename of sys.argv[0]). Does nothing if self.usage is empty or not defined.
print_version(file : file = stdout)
Print the version message for this program (self.version) to ‘file’ (default stdout). As with print_usage(), any occurrence of “%prog” in self.version is replaced by the current program’s name. Does nothing if self.version is empty or undefined.