animio.setup

Epydoc: animio.setup

Forward the call to mrv’s setup routine

Functions

animio.setup.__init__(self, dist)
Okay, its getting interesting: cmd checks for the type of dist - we have derived from it and provide our own type. Distribution is an oldstyle class which doesn’t even work with isinstance - to workaround this, we derive from object as well. In the moment we call __init__ on the BaseDistribution part of our instance, it claims not to be an instance of type Distribution(Base) anymore. Something is fishy here. As a workaround, we get rid of the typecheck in the command base.
animio.setup.convert_path(pathname)
Return ‘pathname’ as a name that will work on the native filesystem, i.e. split it on ‘/’ and put it back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them in the filesystem. Raises ValueError on non-Unix-ish systems if ‘pathname’ either starts or ends with a slash.
animio.setup.find_packages(where='.', exclude=())

Return a list all Python packages found within directory ‘where’

‘where’ should be supplied as a “cross-platform” (i.e. URL-style) path; it will be converted to the appropriate local path syntax. ‘exclude’ is a sequence of package names to exclude; ‘*’ can be used as a wildcard in the names, such that ‘foo.*’ will exclude all subpackages of ‘foo’ (but not ‘foo’ itself).

animio.setup.include_setup_py()
#import mrvs setup.py
animio.setup.main(args, distclass=<class 'animio.setup.Distribution'>)
animio.setup.setup(**attrs)

The gateway to the Distutils: do everything your setup script needs to do, in a highly flexible and user-driven way. Briefly: create a Distribution instance; find and parse config files; parse the command line; run each Distutils command found there, customized by the options supplied to ‘setup()’ (as keyword arguments), in config files, and on the command line.

The Distribution instance might be an instance of a class supplied via the ‘distclass’ keyword argument to ‘setup’; if no such class is supplied, then the Distribution class (in dist.py) is instantiated. All other arguments to ‘setup’ (except for ‘cmdclass’) are used to set attributes of the Distribution instance.

The ‘cmdclass’ argument, if supplied, is a dictionary mapping command names to command classes. Each command encountered on the command line will be turned into a command class, which is in turn instantiated; any class found in ‘cmdclass’ is used in place of the default, which is (for command ‘foo_bar’) class ‘foo_bar’ in module ‘distutils.command.foo_bar’. The command class must provide a ‘user_options’ attribute which is a list of option specifiers for ‘distutils.fancy_getopt’. Any command-line options between the current and the next command are used to set attributes of the current command object.

When the entire command-line has been successfully parsed, calls the ‘run()’ method on each command object in turn. This method will be driven entirely by the Distribution object (which each command object has a reference to, thanks to its constructor), and the command-specific options that became attributes of each command object.

Classes

Epydoc: animio.setup.Distribution

class animio.setup.Distribution(*args, **kwargs)

Bases: object, distutils.dist.Distribution

Customize available options and behaviour to work with mrv and derived projects

announce(msg, level=1)
dump_option_dicts(header=None, commands=None, indent='')
finalize_options()
Set final values for all the options on the Distribution instance, analogous to the .finalize_options() method of Command objects.
find_config_files()

Find as many configuration files as should be processed for this platform, and return a list of filenames in the order in which they should be parsed. The filenames returned are guaranteed to exist (modulo nasty race conditions).

There are three possible config files: distutils.cfg in the Distutils installation directory (ie. where the top-level Distutils __inst__.py file lives), a file in the user’s home directory named .pydistutils.cfg on Unix and pydistutils.cfg on Windows/Mac, and setup.cfg in the current directory.

classmethod fixed_list_arg(value)
As the comamndline parsing is as bad as it gets, it will not parse the correct types, nor will it split ‘,’ separated items into a list correctly. If options are provided via the comandline, they are generally screwed up as they are plain strings, so each and every command has to check and verify them by itself. Well done, could have been a nice base task job. We check value for a comman separated string, and return the parsed list if necessary, or the value itself if it is already a list or tuple
get_command_class(command)

Return the class that implements the Distutils command named by ‘command’. First we check the ‘cmdclass’ dictionary; if the command is mentioned there, we fetch the class object from the dictionary and return it. Otherwise we load the command module (“distutils.command.” + command) and fetch the command class from the module. The loaded class is also stored in ‘cmdclass’ to speed future calls to ‘get_command_class()’.

Raises DistutilsModuleError if the expected module could not be found, or if that module does not define the expected class.

get_command_list()
Get a list of (command, description) tuples. The list is divided into “standard commands” (listed in distutils.command.__all__) and “extra commands” (mentioned in self.cmdclass, but not a standard command). The descriptions come from the command class attribute ‘description’.
get_command_obj(command, create=1)
Return the command object for ‘command’. Normally this object is cached on a previous call to ‘get_command_obj()’; if no command object for ‘command’ is in the cache, then we either create and return it (if ‘create’ is true) or return None.
get_command_packages()
Return a list of packages from which commands are loaded.
get_fullname()
Returns:Full name, including the python version we are compiling the code
get_option_dict(command)
Get the option dictionary for a given command. If that command’s option dictionary hasn’t been created yet, then create it and return the new dictionary; otherwise, return the existing option dictionary.
get_packages()
Returns:list of all packages in rootpackage in __import__ compatible form
handle_display_options(option_order)
If there were any non-global “display-only” options (–help-commands or the metadata display options) on the command line, display the requested info and return true; else return false.
handle_version_and_tag()

Assure our current commit in the main repository is tagged properly If so, continue, if not, try to create a tag with the current version. If the version was already tagged before, help the user to adjust his version string in the root module, make a commit, and finally create the tag we were so desperate for. The main idea is to enforce a unique version each time we make a release, and to make that easy

Returns:TagReference object created
Raises EnvironmentError:
 if we could not get a valid tag
has_c_libraries()
has_data_files()
has_ext_modules()
has_headers()
has_modules()
has_pure_modules()
has_scripts()
is_pure()
classmethod modifiy_sys_args()

Parse our own arguments off the args list and modify the argument stream accordingly.

Note:needs to be called before setup of the distutils is called
parse_command_line()
Handle our custom options
parse_config_files(filenames=None)
perform_regression_tests()
Run regression tests and fail with a report if one of the regression test fails
postprocess_metadata()
Called after the commandline has been parsed. With all information available we can decide whether additional dependencies need to be specified
print_command_list(commands, header, max_length)
Print a subset of the list of all commands – used by ‘print_commands()’.
print_commands()
Print out a help message listing all available commands with a description of each. The list is divided into “standard commands” (listed in distutils.command.__all__) and “extra commands” (mentioned in self.cmdclass, but not a standard command). The descriptions come from the command class attribute ‘description’.
reinitialize_command(command, reinit_subcommands=0)

Reinitializes a command to the state it was in when first returned by ‘get_command_obj()’: ie., initialized but not yet finalized. This provides the opportunity to sneak option values in programmatically, overriding or supplementing user-supplied values from the config files and command line. You’ll have to re-finalize the command object (by calling ‘finalize_options()’ or ‘ensure_finalized()’) before using it for real.

‘command’ should be a command name (string) or command object. If ‘reinit_subcommands’ is true, also reinitializes the command’s sub-commands, as declared by the ‘sub_commands’ class attribute (if it has one). See the “install” command for an example. Only reinitializes the sub-commands that actually matter, ie. those whose test predicates return true.

Returns the reinitialized command object.

classmethod retrieve_project_info()
import the project information module :return: package info module object
classmethod retrieve_root_package(basedir='.')
Make sure the root package is in the python path and is set as our root :return: root package object
run_command(command)
Do whatever it takes to run a command (including nothing at all, if the command has already been run). Specifically: if we have already created and run the command named by ‘command’, return silently without doing anything. If the command named by ‘command’ doesn’t even have a command object yet, create one. Then invoke ‘run()’ on that command object (or an existing one).
run_commands()
Perform required pre- and post-run actions
spawn_python_interpreter(args, cwd=None)

Start the default python interpreter, and handle the windows special case :param args: passed to the python interpreter, must not include the executable :param cwd: if not None, it will be set for the childs working directory :return: Spawned Process :note: All output channels of our process will be connected to the output channels

of the spawned one
classmethod version_string(version_info)
Returns:version string from the given version info which is assumed to

be in the default python version_info format ( sys.version_info )

Epydoc: animio.setup.BuildPython

class animio.setup.BuildPython(*args, **kwargs)

Bases: animio.setup._GitMixin, animio.setup._RegressionMixin, distutils.command.build_py.build_py

Customize the command preparing python modules in order to skip copying original py files if compile is specified. Additionally we allow the python interpreter to be specified as the bytecode is incompatible between the versions

add_files_and_commit(root_repo, repo, root_dir, root_tag)

Add all files recursively to the index as found below root_dir and commit the index.

As a special ability, we will rewrite their paths and thus add them relative to the root directory, even though the git repository might be on another level. It also sports a simple way to determine whether the commit already exists, so it will not recommit data that has just been committed.

Parameters:
  • root_repo – Repository containing the data of the main project
  • repo – dedicated repository containing the distribution data
Returns:

tuple(root_original_head, (Created)Commit object) The head to which the root repository pointed before we changed it to our distribution head, and the commit object we possible created in the distribution repository

classmethod adjust_user_options(options)
Append git specific user options to the given options
announce(msg, level=1)
If the current verbosity level is of greater than or equal to ‘level’ print ‘msg’ to stdout.
branch_name()
Returns:name of the branch identifying our current release configuration
build_module(module, module_file, package)
build_modules()
build_package_data()
Copy data files into build directory
build_packages()
byte_compile(files, **kwargs)
If we are supposed to compile, remove the original file afterwards
check_module(module, module_file)
check_package(package, package_dir)
copy_file(infile, outfile, preserve_mode=1, preserve_times=1, link=None, level=1)
Copy a file respecting verbose, dry-run and force flags. (The former two default to whatever is in the Distribution object, and the latter defaults to false for commands that don’t define it.)
copy_tree(infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1)
Copy an entire directory tree respecting verbose, dry-run, and force flags.
debug_print(msg)
Print ‘msg’ to stdout if the global DEBUG (taken from the DISTUTILS_DEBUG environment variable) flag is true.
dump_options(header=None, indent='')
ensure_dirname(option)
ensure_filename(option)
Ensure that ‘option’ is the name of an existing file.
ensure_finalized()
ensure_string(option, default=None)
Ensure that ‘option’ is a string; if not defined, set it to ‘default’.
ensure_string_list(option)
Ensure that ‘option’ is a list of strings. If ‘option’ is currently a string, we split it either on /,s*/ or /s+/, so “foo bar baz”, “foo,bar,baz”, and “foo, bar baz” all become [“foo”, “bar”, “baz”].
execute(func, args, msg=None, level=1)
finalize_options()
find_all_modules()
Same as above, but ... different. Instaed of using the find_package_modules method, it reimplements the same functionality ... wtf ??
find_data_files(package, src_dir)
Fixes the underlying method by allowing to specify whole directories whose files will be copied recursively. Thanks python for not even providing the bare mininum so people end up reimplementing parts of the ‘distribution system’
find_modules()
Finds individually-specified Python modules, ie. those listed by module name in ‘self.py_modules’. Returns a list of tuples (package, module_base, filename): ‘package’ is a tuple of the path through package-space to the module; ‘module_base’ is the bare (no packages, no dots) module name, and ‘filename’ is the path to the “.py” file (relative to the distribution root) that implements the module.
find_package_modules(package, package_dir)
Overridden to filter return value using our exludes
fix_scripts()
Check what the user classified as script and fix the first line to point to the right python interpreter version (only if we are compiling). Additionally, make the file executable on linux
get_command_name()
get_data_files()
Generate list of ‘(package,src_dir,build_dir,filenames)’ tuples
get_finalized_command(command, create=1)
Wrapper around Distribution’s ‘get_command_obj()’ method: find (create if necessary and ‘create’ is true) the command object for ‘command’, call its ‘ensure_finalized()’ method, and return the finalized command object.
get_module_outfile(build_dir, package, module)
get_outputs(include_bytecode=1)
get_package_dir(package)
Return the directory, relative to the top of the source distribution, where package ‘package’ should be found (at least according to the ‘package_dir’ option, if any).
get_source_files()
get_sub_commands()
Determine the sub-commands that are relevant in the current distribution (ie., that need to be run). This is based on the ‘sub_commands’ class attribute: each tuple in that list may include a method that we call to determine if the subcommand needs to be run for the current distribution. Return a list of command names.
handle_exclusion()
Apply the exclusion patterns
initialize_options()
item_chooser(description, items)
Utility allowing the user to easily select items from the items list :param items: objects that can be converted into a string :return: list of selected items
make_archive(base_name, format, root_dir=None, base_dir=None)
make_file(infiles, outfile, func, args, exec_msg=None, skip_msg=None, level=1)
Special case of ‘execute()’ for operations that process one or more input files and generate one output file. Works just like ‘execute()’, except the operation is skipped and a different message printed if ‘outfile’ already exists and is newer than all files listed in ‘infiles’. If the command defined ‘self.force’, and it is true, then the command is unconditionally run – does no timestamp checks.
mkpath(name, mode=511)
move_file(src, dst, level=1)
Move a file respectin dry-run flag.
post_regression_test(testexecutable, test_root_dir)

Perform a regression test for the maya version’s the user supplied. :param testexecutable: path to the tmrv-compatible executable - it is

expected to be inside a tree which allows the project to put itself into the path.
Parameter:root_dir – root directory under which tests can be found
Raises EnvironmentError:
 if started process returned non-0
push_to_remotes(repo, heads=[], remotes=[])
Push the given branchs to the given remotes. If one of the lists is empty, it the respective items will be queried from the user
reinitialize_command(command, reinit_subcommands=0)
run()
Perform the main operation, and handle git afterwards :note: It is done at a point where the py modules as well as the executables are available. In case there are c-modules, these wouldn’t be availble here.
run_command(command)
Run some other command: uses the ‘run_command()’ method of Distribution, which creates and finalizes the command object if necessary and then invokes its ‘run()’ method.
set_head_to(repo, head_name)

et our head to point to the given head_name. If possible, update the index to represent the tree the head points to

Returns:Head named head_name
Note:In the worst case, the head points to non-existing ref, as the repository is still empty
set_undefined_options(src_cmd, *option_pairs)
Set the values of any “undefined” options from corresponding option values in some other command object. “Undefined” here means “is None”, which is the convention used to indicate that an option has not been changed between ‘initialize_options()’ and ‘finalize_options()’. Usually called from ‘finalize_options()’ for options that depend on some other command rather than another option of the same command. ‘src_cmd’ is the other command from which option values will be taken (a command object will be created for it if necessary); the remaining arguments are ‘(src_option,dst_option)’ tuples which mean “take the value of ‘src_option’ in the ‘src_cmd’ command object, and copy it to ‘dst_option’ in the current command object”.
spawn(cmd, search_path=1, level=1)
Spawn an external command respecting dry-run flag.
update_git(root_dir)
Put the contents in the root_dir into the configured git repository Its important to note that the actual relative location of root_dir does not matter as long as it is inside the git repository. The later object paths within the git repository will all be relative to root_dir.
warn(msg)

Epydoc: animio.setup.BuildScripts

class animio.setup.BuildScripts(dist)

Bases: distutils.command.build_scripts.build_scripts

Uses our way to adjust the first line of the script, additionally rename the executable to indicate the required interpreter. Otherwise scripts would override each other anyway.

announce(msg, level=1)
If the current verbosity level is of greater than or equal to ‘level’ print ‘msg’ to stdout.
copy_file(infile, outfile, preserve_mode=1, preserve_times=1, link=None, level=1)
Copy a file respecting verbose, dry-run and force flags. (The former two default to whatever is in the Distribution object, and the latter defaults to false for commands that don’t define it.)
copy_scripts()
copy_tree(infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1)
Copy an entire directory tree respecting verbose, dry-run, and force flags.
debug_print(msg)
Print ‘msg’ to stdout if the global DEBUG (taken from the DISTUTILS_DEBUG environment variable) flag is true.
dump_options(header=None, indent='')
ensure_dirname(option)
ensure_filename(option)
Ensure that ‘option’ is the name of an existing file.
ensure_finalized()
ensure_string(option, default=None)
Ensure that ‘option’ is a string; if not defined, set it to ‘default’.
ensure_string_list(option)
Ensure that ‘option’ is a list of strings. If ‘option’ is currently a string, we split it either on /,s*/ or /s+/, so “foo bar baz”, “foo,bar,baz”, and “foo, bar baz” all become [“foo”, “bar”, “baz”].
execute(func, args, msg=None, level=1)
finalize_options()
get_command_name()
get_finalized_command(command, create=1)
Wrapper around Distribution’s ‘get_command_obj()’ method: find (create if necessary and ‘create’ is true) the command object for ‘command’, call its ‘ensure_finalized()’ method, and return the finalized command object.
get_source_files()
get_sub_commands()
Determine the sub-commands that are relevant in the current distribution (ie., that need to be run). This is based on the ‘sub_commands’ class attribute: each tuple in that list may include a method that we call to determine if the subcommand needs to be run for the current distribution. Return a list of command names.
classmethod handle_scripts(scripts, adjust_first_line, suffix='')

Handle the given scripts to work for later installation :param scripts: paths to scripts to hanlde :param adjust_first_line: if True, the first line will receive the actual

python version to match the version of the this python interpreter
Parameter:suffix – if given, the suffix is assumed to be a suffix for all scripts. If scripts want to execfile each other, the name of the script needs adjustment to actually work, which is unknown to the script in advance. Hence we fix the string ourselves. The suffix is assumed to be appended to all input script files, revealing the original script basename if the suffix is removed. The latter one is searched for in the script.
initialize_options()
make_archive(base_name, format, root_dir=None, base_dir=None)
make_file(infiles, outfile, func, args, exec_msg=None, skip_msg=None, level=1)
Special case of ‘execute()’ for operations that process one or more input files and generate one output file. Works just like ‘execute()’, except the operation is skipped and a different message printed if ‘outfile’ already exists and is newer than all files listed in ‘infiles’. If the command defined ‘self.force’, and it is true, then the command is unconditionally run – does no timestamp checks.
mkpath(name, mode=511)
move_file(src, dst, level=1)
Move a file respectin dry-run flag.
reinitialize_command(command, reinit_subcommands=0)
run()
run_command(command)
Run some other command: uses the ‘run_command()’ method of Distribution, which creates and finalizes the command object if necessary and then invokes its ‘run()’ method.
set_undefined_options(src_cmd, *option_pairs)
Set the values of any “undefined” options from corresponding option values in some other command object. “Undefined” here means “is None”, which is the convention used to indicate that an option has not been changed between ‘initialize_options()’ and ‘finalize_options()’. Usually called from ‘finalize_options()’ for options that depend on some other command rather than another option of the same command. ‘src_cmd’ is the other command from which option values will be taken (a command object will be created for it if necessary); the remaining arguments are ‘(src_option,dst_option)’ tuples which mean “take the value of ‘src_option’ in the ‘src_cmd’ command object, and copy it to ‘dst_option’ in the current command object”.
spawn(cmd, search_path=1, level=1)
Spawn an external command respecting dry-run flag.
warn(msg)

Epydoc: animio.setup

class animio.setup.Command(dist)

Abstract base class for defining command classes, the “worker bees” of the Distutils. A useful analogy for command classes is to think of them as subroutines with local variables called “options”. The options are “declared” in ‘initialize_options()’ and “defined” (given their final values, aka “finalized”) in ‘finalize_options()’, both of which must be defined by every command class. The distinction between the two is necessary because option values might come from the outside world (command line, config file, ...), and any options dependent on other options must be computed after these outside influences have been processed – hence ‘finalize_options()’. The “body” of the subroutine, where it does all its work based on the values of its options, is the ‘run()’ method, which must also be implemented by every command class.

announce(msg, level=1)
If the current verbosity level is of greater than or equal to ‘level’ print ‘msg’ to stdout.
copy_file(infile, outfile, preserve_mode=1, preserve_times=1, link=None, level=1)
Copy a file respecting verbose, dry-run and force flags. (The former two default to whatever is in the Distribution object, and the latter defaults to false for commands that don’t define it.)
copy_tree(infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1)
Copy an entire directory tree respecting verbose, dry-run, and force flags.
debug_print(msg)
Print ‘msg’ to stdout if the global DEBUG (taken from the DISTUTILS_DEBUG environment variable) flag is true.
dump_options(header=None, indent='')
ensure_dirname(option)
ensure_filename(option)
Ensure that ‘option’ is the name of an existing file.
ensure_finalized()
ensure_string(option, default=None)
Ensure that ‘option’ is a string; if not defined, set it to ‘default’.
ensure_string_list(option)
Ensure that ‘option’ is a list of strings. If ‘option’ is currently a string, we split it either on /,s*/ or /s+/, so “foo bar baz”, “foo,bar,baz”, and “foo, bar baz” all become [“foo”, “bar”, “baz”].
execute(func, args, msg=None, level=1)
finalize_options()

Set final values for all the options that this command supports. This is always called as late as possible, ie. after any option assignments from the command-line or from other commands have been done. Thus, this is the place to code option dependencies: if ‘foo’ depends on ‘bar’, then it is safe to set ‘foo’ from ‘bar’ as long as ‘foo’ still has the same value it was assigned in ‘initialize_options()’.

This method must be implemented by all command classes.

get_command_name()
get_finalized_command(command, create=1)
Wrapper around Distribution’s ‘get_command_obj()’ method: find (create if necessary and ‘create’ is true) the command object for ‘command’, call its ‘ensure_finalized()’ method, and return the finalized command object.
get_sub_commands()
Determine the sub-commands that are relevant in the current distribution (ie., that need to be run). This is based on the ‘sub_commands’ class attribute: each tuple in that list may include a method that we call to determine if the subcommand needs to be run for the current distribution. Return a list of command names.
initialize_options()

Set default values for all the options that this command supports. Note that these defaults may be overridden by other commands, by the setup script, by config files, or by the command-line. Thus, this is not the place to code dependencies between options; generally, ‘initialize_options()’ implementations are just a bunch of “self.foo = None” assignments.

This method must be implemented by all command classes.

make_archive(base_name, format, root_dir=None, base_dir=None)
make_file(infiles, outfile, func, args, exec_msg=None, skip_msg=None, level=1)
Special case of ‘execute()’ for operations that process one or more input files and generate one output file. Works just like ‘execute()’, except the operation is skipped and a different message printed if ‘outfile’ already exists and is newer than all files listed in ‘infiles’. If the command defined ‘self.force’, and it is true, then the command is unconditionally run – does no timestamp checks.
mkpath(name, mode=511)
move_file(src, dst, level=1)
Move a file respectin dry-run flag.
reinitialize_command(command, reinit_subcommands=0)
run()

A command’s raison d’etre: carry out the action it exists to perform, controlled by the options initialized in ‘initialize_options()’, customized by other commands, the setup script, the command-line, and config files, and finalized in ‘finalize_options()’. All terminal output and filesystem interaction should be done by ‘run()’.

This method must be implemented by all command classes.

run_command(command)
Run some other command: uses the ‘run_command()’ method of Distribution, which creates and finalizes the command object if necessary and then invokes its ‘run()’ method.
set_undefined_options(src_cmd, *option_pairs)
Set the values of any “undefined” options from corresponding option values in some other command object. “Undefined” here means “is None”, which is the convention used to indicate that an option has not been changed between ‘initialize_options()’ and ‘finalize_options()’. Usually called from ‘finalize_options()’ for options that depend on some other command rather than another option of the same command. ‘src_cmd’ is the other command from which option values will be taken (a command object will be created for it if necessary); the remaining arguments are ‘(src_option,dst_option)’ tuples which mean “take the value of ‘src_option’ in the ‘src_cmd’ command object, and copy it to ‘dst_option’ in the current command object”.
spawn(cmd, search_path=1, level=1)
Spawn an external command respecting dry-run flag.
warn(msg)

Epydoc: animio.setup.Distribution

class animio.setup.Distribution(*args, **kwargs)

Bases: object, distutils.dist.Distribution

Customize available options and behaviour to work with mrv and derived projects

announce(msg, level=1)
dump_option_dicts(header=None, commands=None, indent='')
finalize_options()
Set final values for all the options on the Distribution instance, analogous to the .finalize_options() method of Command objects.
find_config_files()

Find as many configuration files as should be processed for this platform, and return a list of filenames in the order in which they should be parsed. The filenames returned are guaranteed to exist (modulo nasty race conditions).

There are three possible config files: distutils.cfg in the Distutils installation directory (ie. where the top-level Distutils __inst__.py file lives), a file in the user’s home directory named .pydistutils.cfg on Unix and pydistutils.cfg on Windows/Mac, and setup.cfg in the current directory.

classmethod fixed_list_arg(value)
As the comamndline parsing is as bad as it gets, it will not parse the correct types, nor will it split ‘,’ separated items into a list correctly. If options are provided via the comandline, they are generally screwed up as they are plain strings, so each and every command has to check and verify them by itself. Well done, could have been a nice base task job. We check value for a comman separated string, and return the parsed list if necessary, or the value itself if it is already a list or tuple
get_command_class(command)

Return the class that implements the Distutils command named by ‘command’. First we check the ‘cmdclass’ dictionary; if the command is mentioned there, we fetch the class object from the dictionary and return it. Otherwise we load the command module (“distutils.command.” + command) and fetch the command class from the module. The loaded class is also stored in ‘cmdclass’ to speed future calls to ‘get_command_class()’.

Raises DistutilsModuleError if the expected module could not be found, or if that module does not define the expected class.

get_command_list()
Get a list of (command, description) tuples. The list is divided into “standard commands” (listed in distutils.command.__all__) and “extra commands” (mentioned in self.cmdclass, but not a standard command). The descriptions come from the command class attribute ‘description’.
get_command_obj(command, create=1)
Return the command object for ‘command’. Normally this object is cached on a previous call to ‘get_command_obj()’; if no command object for ‘command’ is in the cache, then we either create and return it (if ‘create’ is true) or return None.
get_command_packages()
Return a list of packages from which commands are loaded.
get_fullname()
Returns:Full name, including the python version we are compiling the code
get_option_dict(command)
Get the option dictionary for a given command. If that command’s option dictionary hasn’t been created yet, then create it and return the new dictionary; otherwise, return the existing option dictionary.
get_packages()
Returns:list of all packages in rootpackage in __import__ compatible form
handle_display_options(option_order)
If there were any non-global “display-only” options (–help-commands or the metadata display options) on the command line, display the requested info and return true; else return false.
handle_version_and_tag()

Assure our current commit in the main repository is tagged properly If so, continue, if not, try to create a tag with the current version. If the version was already tagged before, help the user to adjust his version string in the root module, make a commit, and finally create the tag we were so desperate for. The main idea is to enforce a unique version each time we make a release, and to make that easy

Returns:TagReference object created
Raises EnvironmentError:
 if we could not get a valid tag
has_c_libraries()
has_data_files()
has_ext_modules()
has_headers()
has_modules()
has_pure_modules()
has_scripts()
is_pure()
classmethod modifiy_sys_args()

Parse our own arguments off the args list and modify the argument stream accordingly.

Note:needs to be called before setup of the distutils is called
parse_command_line()
Handle our custom options
parse_config_files(filenames=None)
perform_regression_tests()
Run regression tests and fail with a report if one of the regression test fails
postprocess_metadata()
Called after the commandline has been parsed. With all information available we can decide whether additional dependencies need to be specified
print_command_list(commands, header, max_length)
Print a subset of the list of all commands – used by ‘print_commands()’.
print_commands()
Print out a help message listing all available commands with a description of each. The list is divided into “standard commands” (listed in distutils.command.__all__) and “extra commands” (mentioned in self.cmdclass, but not a standard command). The descriptions come from the command class attribute ‘description’.
reinitialize_command(command, reinit_subcommands=0)

Reinitializes a command to the state it was in when first returned by ‘get_command_obj()’: ie., initialized but not yet finalized. This provides the opportunity to sneak option values in programmatically, overriding or supplementing user-supplied values from the config files and command line. You’ll have to re-finalize the command object (by calling ‘finalize_options()’ or ‘ensure_finalized()’) before using it for real.

‘command’ should be a command name (string) or command object. If ‘reinit_subcommands’ is true, also reinitializes the command’s sub-commands, as declared by the ‘sub_commands’ class attribute (if it has one). See the “install” command for an example. Only reinitializes the sub-commands that actually matter, ie. those whose test predicates return true.

Returns the reinitialized command object.

classmethod retrieve_project_info()
import the project information module :return: package info module object
classmethod retrieve_root_package(basedir='.')
Make sure the root package is in the python path and is set as our root :return: root package object
run_command(command)
Do whatever it takes to run a command (including nothing at all, if the command has already been run). Specifically: if we have already created and run the command named by ‘command’, return silently without doing anything. If the command named by ‘command’ doesn’t even have a command object yet, create one. Then invoke ‘run()’ on that command object (or an existing one).
run_commands()
Perform required pre- and post-run actions
spawn_python_interpreter(args, cwd=None)

Start the default python interpreter, and handle the windows special case :param args: passed to the python interpreter, must not include the executable :param cwd: if not None, it will be set for the childs working directory :return: Spawned Process :note: All output channels of our process will be connected to the output channels

of the spawned one
classmethod version_string(version_info)
Returns:version string from the given version info which is assumed to

be in the default python version_info format ( sys.version_info )

Epydoc: animio.setup.DocDistro

class animio.setup.DocDistro(*args)

Bases: animio.setup._GitMixin, distutils.cmd.Command

Build the documentation, and include everything into the git repository if required.

add_files_and_commit(root_repo, repo, root_dir, root_tag)

Add all files recursively to the index as found below root_dir and commit the index.

As a special ability, we will rewrite their paths and thus add them relative to the root directory, even though the git repository might be on another level. It also sports a simple way to determine whether the commit already exists, so it will not recommit data that has just been committed.

Parameters:
  • root_repo – Repository containing the data of the main project
  • repo – dedicated repository containing the distribution data
Returns:

tuple(root_original_head, (Created)Commit object) The head to which the root repository pointed before we changed it to our distribution head, and the commit object we possible created in the distribution repository

classmethod adjust_user_options(options)
Append git specific user options to the given options
announce(msg, level=1)
If the current verbosity level is of greater than or equal to ‘level’ print ‘msg’ to stdout.
branch_name()
Returns:name of the branch identifying our current release configuration
build_documentation()

Build the documentation with our current version tag - this allows it to be included in the release as it has been updated

Returns:tuple(html_base, Bool) tuple with base directory containing all html files ( possibly with subdirectories ), and a boolean which is True if the documentation was build, False if it was still uptodate
copy_file(infile, outfile, preserve_mode=1, preserve_times=1, link=None, level=1)
Copy a file respecting verbose, dry-run and force flags. (The former two default to whatever is in the Distribution object, and the latter defaults to false for commands that don’t define it.)
copy_tree(infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1)
Copy an entire directory tree respecting verbose, dry-run, and force flags.
create_zip_archive(html_out_dir)
Create a zip archive from the data in the html output directory :return: path to the created zip file
debug_print(msg)
Print ‘msg’ to stdout if the global DEBUG (taken from the DISTUTILS_DEBUG environment variable) flag is true.
dump_options(header=None, indent='')
ensure_dirname(option)
ensure_filename(option)
Ensure that ‘option’ is the name of an existing file.
ensure_finalized()
ensure_string(option, default=None)
Ensure that ‘option’ is a string; if not defined, set it to ‘default’.
ensure_string_list(option)
Ensure that ‘option’ is a list of strings. If ‘option’ is currently a string, we split it either on /,s*/ or /s+/, so “foo bar baz”, “foo,bar,baz”, and “foo, bar baz” all become [“foo”, “bar”, “baz”].
execute(func, args, msg=None, level=1)
finalize_options()
get_command_name()
get_finalized_command(command, create=1)
Wrapper around Distribution’s ‘get_command_obj()’ method: find (create if necessary and ‘create’ is true) the command object for ‘command’, call its ‘ensure_finalized()’ method, and return the finalized command object.
get_sub_commands()
Determine the sub-commands that are relevant in the current distribution (ie., that need to be run). This is based on the ‘sub_commands’ class attribute: each tuple in that list may include a method that we call to determine if the subcommand needs to be run for the current distribution. Return a list of command names.
initialize_options()
item_chooser(description, items)
Utility allowing the user to easily select items from the items list :param items: objects that can be converted into a string :return: list of selected items
make_archive(base_name, format, root_dir=None, base_dir=None)
make_file(infiles, outfile, func, args, exec_msg=None, skip_msg=None, level=1)
Special case of ‘execute()’ for operations that process one or more input files and generate one output file. Works just like ‘execute()’, except the operation is skipped and a different message printed if ‘outfile’ already exists and is newer than all files listed in ‘infiles’. If the command defined ‘self.force’, and it is true, then the command is unconditionally run – does no timestamp checks.
mkpath(name, mode=511)
move_file(src, dst, level=1)
Move a file respectin dry-run flag.
push_to_remotes(repo, heads=[], remotes=[])
Push the given branchs to the given remotes. If one of the lists is empty, it the respective items will be queried from the user
reinitialize_command(command, reinit_subcommands=0)
run()
run_command(command)
Run some other command: uses the ‘run_command()’ method of Distribution, which creates and finalizes the command object if necessary and then invokes its ‘run()’ method.
set_head_to(repo, head_name)

et our head to point to the given head_name. If possible, update the index to represent the tree the head points to

Returns:Head named head_name
Note:In the worst case, the head points to non-existing ref, as the repository is still empty
set_undefined_options(src_cmd, *option_pairs)
Set the values of any “undefined” options from corresponding option values in some other command object. “Undefined” here means “is None”, which is the convention used to indicate that an option has not been changed between ‘initialize_options()’ and ‘finalize_options()’. Usually called from ‘finalize_options()’ for options that depend on some other command rather than another option of the same command. ‘src_cmd’ is the other command from which option values will be taken (a command object will be created for it if necessary); the remaining arguments are ‘(src_option,dst_option)’ tuples which mean “take the value of ‘src_option’ in the ‘src_cmd’ command object, and copy it to ‘dst_option’ in the current command object”.
spawn(cmd, search_path=1, level=1)
Spawn an external command respecting dry-run flag.
update_git(root_dir)
Put the contents in the root_dir into the configured git repository Its important to note that the actual relative location of root_dir does not matter as long as it is inside the git repository. The later object paths within the git repository will all be relative to root_dir.
warn(msg)

Epydoc: animio.setup.GitSourceDistribution

class animio.setup.GitSourceDistribution(*args, **kwargs)

Bases: animio.setup._GitMixin, animio.setup._RegressionMixin, distutils.command.sdist.sdist

Instead of creating an archive, we put the source tree into a git repository

add_defaults()
Add all the default files to self.filelist:
  • README or README.txt
  • setup.py
  • test/test*.py
  • all pure Python modules mentioned in setup script
  • all C sources listed as part of extensions or C libraries in the setup script (doesn’t catch C headers!)

Warns if (README or README.txt) or setup.py are missing; everything else is optional.

add_files_and_commit(root_repo, repo, root_dir, root_tag)

Add all files recursively to the index as found below root_dir and commit the index.

As a special ability, we will rewrite their paths and thus add them relative to the root directory, even though the git repository might be on another level. It also sports a simple way to determine whether the commit already exists, so it will not recommit data that has just been committed.

Parameters:
  • root_repo – Repository containing the data of the main project
  • repo – dedicated repository containing the distribution data
Returns:

tuple(root_original_head, (Created)Commit object) The head to which the root repository pointed before we changed it to our distribution head, and the commit object we possible created in the distribution repository

classmethod adjust_user_options(options)
Append git specific user options to the given options
announce(msg, level=1)
If the current verbosity level is of greater than or equal to ‘level’ print ‘msg’ to stdout.
branch_name()
Returns:name of the branch identifying our current release configuration
check_metadata()
Ensure that all required elements of meta-data (name, version, URL, (author and author_email) or (maintainer and maintainer_email)) are supplied by the Distribution object; warn if any are missing.
copy_file(infile, outfile, preserve_mode=1, preserve_times=1, link=None, level=1)
Copy a file respecting verbose, dry-run and force flags. (The former two default to whatever is in the Distribution object, and the latter defaults to false for commands that don’t define it.)
copy_tree(infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1)
Copy an entire directory tree respecting verbose, dry-run, and force flags.
debug_print(msg)
Print ‘msg’ to stdout if the global DEBUG (taken from the DISTUTILS_DEBUG environment variable) flag is true.
dump_options(header=None, indent='')
ensure_dirname(option)
ensure_filename(option)
Ensure that ‘option’ is the name of an existing file.
ensure_finalized()
ensure_string(option, default=None)
Ensure that ‘option’ is a string; if not defined, set it to ‘default’.
ensure_string_list(option)
Ensure that ‘option’ is a list of strings. If ‘option’ is currently a string, we split it either on /,s*/ or /s+/, so “foo bar baz”, “foo,bar,baz”, and “foo, bar baz” all become [“foo”, “bar”, “baz”].
execute(func, args, msg=None, level=1)
finalize_options()
As the inheritance hierarchy is screwed up with old-style classes, we have to forward to the call manually to our bases ...
get_archive_files()
Return the list of archive files created when the command was run, or None if the command hasn’t run yet.
get_command_name()
get_file_list()
Figure out the list of files to include in the source distribution, and put it in ‘self.filelist’. This might involve reading the manifest template (and writing the manifest), or just reading the manifest, or just using the default file set – it all depends on the user’s options and the state of the filesystem.
get_finalized_command(command, create=1)
Wrapper around Distribution’s ‘get_command_obj()’ method: find (create if necessary and ‘create’ is true) the command object for ‘command’, call its ‘ensure_finalized()’ method, and return the finalized command object.
get_sub_commands()
Determine the sub-commands that are relevant in the current distribution (ie., that need to be run). This is based on the ‘sub_commands’ class attribute: each tuple in that list may include a method that we call to determine if the subcommand needs to be run for the current distribution. Return a list of command names.
initialize_options()
item_chooser(description, items)
Utility allowing the user to easily select items from the items list :param items: objects that can be converted into a string :return: list of selected items
make_archive(base_name, format, root_dir=None, base_dir=None)
make_distribution()
Make s source distribution, but set it up to allow post-testing if desired
make_file(infiles, outfile, func, args, exec_msg=None, skip_msg=None, level=1)
Special case of ‘execute()’ for operations that process one or more input files and generate one output file. Works just like ‘execute()’, except the operation is skipped and a different message printed if ‘outfile’ already exists and is newer than all files listed in ‘infiles’. If the command defined ‘self.force’, and it is true, then the command is unconditionally run – does no timestamp checks.
make_release_tree(base_dir, files)
Create the directory tree that will become the source distribution archive. All directories implied by the filenames in ‘files’ are created under ‘base_dir’, and then we hard link or copy (if hard linking is unavailable) those files into place. Essentially, this duplicates the developer’s source tree, but in a directory named after the distribution, containing only the files to be distributed.
mkpath(name, mode=511)
move_file(src, dst, level=1)
Move a file respectin dry-run flag.
post_regression_test(testexecutable, test_root_dir)

Perform a regression test for the maya version’s the user supplied. :param testexecutable: path to the tmrv-compatible executable - it is

expected to be inside a tree which allows the project to put itself into the path.
Parameter:root_dir – root directory under which tests can be found
Raises EnvironmentError:
 if started process returned non-0
prune_file_list()

Prune off branches that might slip into the file list as created by ‘read_template()’, but really don’t belong there:

  • the build tree (typically “build”)
  • the release tree itself (only an issue if we ran “sdist” previously with –keep-temp, or it aborted)
  • any RCS, CVS, .svn, .hg, .git, .bzr, _darcs directories
push_to_remotes(repo, heads=[], remotes=[])
Push the given branchs to the given remotes. If one of the lists is empty, it the respective items will be queried from the user
read_manifest()
Read the manifest file (named by ‘self.manifest’) and use it to fill in ‘self.filelist’, the list of files to include in the source distribution.
read_template()

Read and parse manifest template file named by self.template.

(usually “MANIFEST.in”) The parsing and processing is done by ‘self.filelist’, which updates itself accordingly.

reinitialize_command(command, reinit_subcommands=0)
run()
run_command(command)
Run some other command: uses the ‘run_command()’ method of Distribution, which creates and finalizes the command object if necessary and then invokes its ‘run()’ method.
set_head_to(repo, head_name)

et our head to point to the given head_name. If possible, update the index to represent the tree the head points to

Returns:Head named head_name
Note:In the worst case, the head points to non-existing ref, as the repository is still empty
set_undefined_options(src_cmd, *option_pairs)
Set the values of any “undefined” options from corresponding option values in some other command object. “Undefined” here means “is None”, which is the convention used to indicate that an option has not been changed between ‘initialize_options()’ and ‘finalize_options()’. Usually called from ‘finalize_options()’ for options that depend on some other command rather than another option of the same command. ‘src_cmd’ is the other command from which option values will be taken (a command object will be created for it if necessary); the remaining arguments are ‘(src_option,dst_option)’ tuples which mean “take the value of ‘src_option’ in the ‘src_cmd’ command object, and copy it to ‘dst_option’ in the current command object”.
spawn(cmd, search_path=1, level=1)
Spawn an external command respecting dry-run flag.
update_git(root_dir)
Put the contents in the root_dir into the configured git repository Its important to note that the actual relative location of root_dir does not matter as long as it is inside the git repository. The later object paths within the git repository will all be relative to root_dir.
warn(msg)
write_manifest()
Write the file list in ‘self.filelist’ (presumably as filled in by ‘add_defaults()’ and ‘read_template()’) to the manifest file named by ‘self.manifest’.

Epydoc: animio.setup.InstallCommand

class animio.setup.InstallCommand(dist)

Bases: distutils.command.install.install

Assure compilation is done by build_py

announce(msg, level=1)
If the current verbosity level is of greater than or equal to ‘level’ print ‘msg’ to stdout.
change_roots(*names)
convert_paths(*names)
copy_file(infile, outfile, preserve_mode=1, preserve_times=1, link=None, level=1)
Copy a file respecting verbose, dry-run and force flags. (The former two default to whatever is in the Distribution object, and the latter defaults to false for commands that don’t define it.)
copy_tree(infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1)
Copy an entire directory tree respecting verbose, dry-run, and force flags.
create_home_path()
Create directories under ~
create_path_file()
debug_print(msg)
Print ‘msg’ to stdout if the global DEBUG (taken from the DISTUTILS_DEBUG environment variable) flag is true.
dump_dirs(msg)
dump_options(header=None, indent='')
ensure_dirname(option)
ensure_filename(option)
Ensure that ‘option’ is the name of an existing file.
ensure_finalized()
ensure_string(option, default=None)
Ensure that ‘option’ is a string; if not defined, set it to ‘default’.
ensure_string_list(option)
Ensure that ‘option’ is a list of strings. If ‘option’ is currently a string, we split it either on /,s*/ or /s+/, so “foo bar baz”, “foo,bar,baz”, and “foo, bar baz” all become [“foo”, “bar”, “baz”].
execute(func, args, msg=None, level=1)
expand_basedirs()
expand_dirs()
finalize_options()
finalize_other()
finalize_unix()
get_command_name()
get_finalized_command(command, create=1)
Wrapper around Distribution’s ‘get_command_obj()’ method: find (create if necessary and ‘create’ is true) the command object for ‘command’, call its ‘ensure_finalized()’ method, and return the finalized command object.
get_inputs()
get_outputs()
get_sub_commands()
Determine the sub-commands that are relevant in the current distribution (ie., that need to be run). This is based on the ‘sub_commands’ class attribute: each tuple in that list may include a method that we call to determine if the subcommand needs to be run for the current distribution. Return a list of command names.
handle_extra_path()
has_data()
has_headers()
has_lib()
Return true if the current distribution has any Python modules to install.
has_scripts()
initialize_options()
make_archive(base_name, format, root_dir=None, base_dir=None)
make_file(infiles, outfile, func, args, exec_msg=None, skip_msg=None, level=1)
Special case of ‘execute()’ for operations that process one or more input files and generate one output file. Works just like ‘execute()’, except the operation is skipped and a different message printed if ‘outfile’ already exists and is newer than all files listed in ‘infiles’. If the command defined ‘self.force’, and it is true, then the command is unconditionally run – does no timestamp checks.
mkpath(name, mode=511)
move_file(src, dst, level=1)
Move a file respectin dry-run flag.
reinitialize_command(command, reinit_subcommands=0)
run()
initialize build_py with our compile options
run_command(command)
Run some other command: uses the ‘run_command()’ method of Distribution, which creates and finalizes the command object if necessary and then invokes its ‘run()’ method.
select_scheme(name)
set_undefined_options(src_cmd, *option_pairs)
Set the values of any “undefined” options from corresponding option values in some other command object. “Undefined” here means “is None”, which is the convention used to indicate that an option has not been changed between ‘initialize_options()’ and ‘finalize_options()’. Usually called from ‘finalize_options()’ for options that depend on some other command rather than another option of the same command. ‘src_cmd’ is the other command from which option values will be taken (a command object will be created for it if necessary); the remaining arguments are ‘(src_option,dst_option)’ tuples which mean “take the value of ‘src_option’ in the ‘src_cmd’ command object, and copy it to ‘dst_option’ in the current command object”.
spawn(cmd, search_path=1, level=1)
Spawn an external command respecting dry-run flag.
warn(msg)

Epydoc: animio.setup.InstallLibCommand

class animio.setup.InstallLibCommand(dist)

Bases: distutils.command.install_lib.install_lib

Makes sure the compilation does not happen - if the user wants it, it will only work in the build_py command.

announce(msg, level=1)
If the current verbosity level is of greater than or equal to ‘level’ print ‘msg’ to stdout.
build()
byte_compile(files)
Ignore it
copy_file(infile, outfile, preserve_mode=1, preserve_times=1, link=None, level=1)
Copy a file respecting verbose, dry-run and force flags. (The former two default to whatever is in the Distribution object, and the latter defaults to false for commands that don’t define it.)
copy_tree(infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1)
Copy an entire directory tree respecting verbose, dry-run, and force flags.
debug_print(msg)
Print ‘msg’ to stdout if the global DEBUG (taken from the DISTUTILS_DEBUG environment variable) flag is true.
dump_options(header=None, indent='')
ensure_dirname(option)
ensure_filename(option)
Ensure that ‘option’ is the name of an existing file.
ensure_finalized()
ensure_string(option, default=None)
Ensure that ‘option’ is a string; if not defined, set it to ‘default’.
ensure_string_list(option)
Ensure that ‘option’ is a list of strings. If ‘option’ is currently a string, we split it either on /,s*/ or /s+/, so “foo bar baz”, “foo,bar,baz”, and “foo, bar baz” all become [“foo”, “bar”, “baz”].
execute(func, args, msg=None, level=1)
finalize_options()
get_command_name()
get_finalized_command(command, create=1)
Wrapper around Distribution’s ‘get_command_obj()’ method: find (create if necessary and ‘create’ is true) the command object for ‘command’, call its ‘ensure_finalized()’ method, and return the finalized command object.
get_inputs()
Get the list of files that are input to this command, ie. the files that get installed as they are named in the build tree. The files in this list correspond one-to-one to the output filenames returned by ‘get_outputs()’.
get_outputs()
Return the list of files that would be installed if this command were actually run. Not affected by the “dry-run” flag or whether modules have actually been built yet.
get_sub_commands()
Determine the sub-commands that are relevant in the current distribution (ie., that need to be run). This is based on the ‘sub_commands’ class attribute: each tuple in that list may include a method that we call to determine if the subcommand needs to be run for the current distribution. Return a list of command names.
initialize_options()
install()
make_archive(base_name, format, root_dir=None, base_dir=None)
make_file(infiles, outfile, func, args, exec_msg=None, skip_msg=None, level=1)
Special case of ‘execute()’ for operations that process one or more input files and generate one output file. Works just like ‘execute()’, except the operation is skipped and a different message printed if ‘outfile’ already exists and is newer than all files listed in ‘infiles’. If the command defined ‘self.force’, and it is true, then the command is unconditionally run – does no timestamp checks.
mkpath(name, mode=511)
move_file(src, dst, level=1)
Move a file respectin dry-run flag.
reinitialize_command(command, reinit_subcommands=0)
run()
run_command(command)
Run some other command: uses the ‘run_command()’ method of Distribution, which creates and finalizes the command object if necessary and then invokes its ‘run()’ method.
set_undefined_options(src_cmd, *option_pairs)
Set the values of any “undefined” options from corresponding option values in some other command object. “Undefined” here means “is None”, which is the convention used to indicate that an option has not been changed between ‘initialize_options()’ and ‘finalize_options()’. Usually called from ‘finalize_options()’ for options that depend on some other command rather than another option of the same command. ‘src_cmd’ is the other command from which option values will be taken (a command object will be created for it if necessary); the remaining arguments are ‘(src_option,dst_option)’ tuples which mean “take the value of ‘src_option’ in the ‘src_cmd’ command object, and copy it to ‘dst_option’ in the current command object”.
spawn(cmd, search_path=1, level=1)
Spawn an external command respecting dry-run flag.
warn(msg)

Epydoc: animio.setup._GitMixin

class animio.setup._GitMixin(*args, **kwargs)

Bases: object

Provides functionality to add files and folders within a base directory into the root of a git repository of our choice

add_files_and_commit(root_repo, repo, root_dir, root_tag)

Add all files recursively to the index as found below root_dir and commit the index.

As a special ability, we will rewrite their paths and thus add them relative to the root directory, even though the git repository might be on another level. It also sports a simple way to determine whether the commit already exists, so it will not recommit data that has just been committed.

Parameters:
  • root_repo – Repository containing the data of the main project
  • repo – dedicated repository containing the distribution data
Returns:

tuple(root_original_head, (Created)Commit object) The head to which the root repository pointed before we changed it to our distribution head, and the commit object we possible created in the distribution repository

classmethod adjust_user_options(options)
Append git specific user options to the given options
branch_name()
Returns:name of the branch identifying our current release configuration
finalize_options()
Assure our args are of the correct type
item_chooser(description, items)
Utility allowing the user to easily select items from the items list :param items: objects that can be converted into a string :return: list of selected items
push_to_remotes(repo, heads=[], remotes=[])
Push the given branchs to the given remotes. If one of the lists is empty, it the respective items will be queried from the user
set_head_to(repo, head_name)

et our head to point to the given head_name. If possible, update the index to represent the tree the head points to

Returns:Head named head_name
Note:In the worst case, the head points to non-existing ref, as the repository is still empty
update_git(root_dir)
Put the contents in the root_dir into the configured git repository Its important to note that the actual relative location of root_dir does not matter as long as it is inside the git repository. The later object paths within the git repository will all be relative to root_dir.

Epydoc: animio.setup._RegressionMixin

class animio.setup._RegressionMixin(*args, **kwargs)

Bases: object

Provides a simple interface allowing to perform a regression test

classmethod adjust_user_options(user_options)
finalize_options()
post_regression_test(testexecutable, test_root_dir)

Perform a regression test for the maya version’s the user supplied. :param testexecutable: path to the tmrv-compatible executable - it is

expected to be inside a tree which allows the project to put itself into the path.
Parameter:root_dir – root directory under which tests can be found
Raises EnvironmentError:
 if started process returned non-0

Epydoc: animio.setup

class animio.setup.build_py(dist)

Bases: distutils.cmd.Command

announce(msg, level=1)
If the current verbosity level is of greater than or equal to ‘level’ print ‘msg’ to stdout.
build_module(module, module_file, package)
build_modules()
build_package_data()
Copy data files into build directory
build_packages()
byte_compile(files)
check_module(module, module_file)
check_package(package, package_dir)
copy_file(infile, outfile, preserve_mode=1, preserve_times=1, link=None, level=1)
Copy a file respecting verbose, dry-run and force flags. (The former two default to whatever is in the Distribution object, and the latter defaults to false for commands that don’t define it.)
copy_tree(infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1)
Copy an entire directory tree respecting verbose, dry-run, and force flags.
debug_print(msg)
Print ‘msg’ to stdout if the global DEBUG (taken from the DISTUTILS_DEBUG environment variable) flag is true.
dump_options(header=None, indent='')
ensure_dirname(option)
ensure_filename(option)
Ensure that ‘option’ is the name of an existing file.
ensure_finalized()
ensure_string(option, default=None)
Ensure that ‘option’ is a string; if not defined, set it to ‘default’.
ensure_string_list(option)
Ensure that ‘option’ is a list of strings. If ‘option’ is currently a string, we split it either on /,s*/ or /s+/, so “foo bar baz”, “foo,bar,baz”, and “foo, bar baz” all become [“foo”, “bar”, “baz”].
execute(func, args, msg=None, level=1)
finalize_options()
find_all_modules()
Compute the list of all modules that will be built, whether they are specified one-module-at-a-time (‘self.py_modules’) or by whole packages (‘self.packages’). Return a list of tuples (package, module, module_file), just like ‘find_modules()’ and ‘find_package_modules()’ do.
find_data_files(package, src_dir)
Return filenames for package’s data files in ‘src_dir’
find_modules()
Finds individually-specified Python modules, ie. those listed by module name in ‘self.py_modules’. Returns a list of tuples (package, module_base, filename): ‘package’ is a tuple of the path through package-space to the module; ‘module_base’ is the bare (no packages, no dots) module name, and ‘filename’ is the path to the “.py” file (relative to the distribution root) that implements the module.
find_package_modules(package, package_dir)
get_command_name()
get_data_files()
Generate list of ‘(package,src_dir,build_dir,filenames)’ tuples
get_finalized_command(command, create=1)
Wrapper around Distribution’s ‘get_command_obj()’ method: find (create if necessary and ‘create’ is true) the command object for ‘command’, call its ‘ensure_finalized()’ method, and return the finalized command object.
get_module_outfile(build_dir, package, module)
get_outputs(include_bytecode=1)
get_package_dir(package)
Return the directory, relative to the top of the source distribution, where package ‘package’ should be found (at least according to the ‘package_dir’ option, if any).
get_source_files()
get_sub_commands()
Determine the sub-commands that are relevant in the current distribution (ie., that need to be run). This is based on the ‘sub_commands’ class attribute: each tuple in that list may include a method that we call to determine if the subcommand needs to be run for the current distribution. Return a list of command names.
initialize_options()
make_archive(base_name, format, root_dir=None, base_dir=None)
make_file(infiles, outfile, func, args, exec_msg=None, skip_msg=None, level=1)
Special case of ‘execute()’ for operations that process one or more input files and generate one output file. Works just like ‘execute()’, except the operation is skipped and a different message printed if ‘outfile’ already exists and is newer than all files listed in ‘infiles’. If the command defined ‘self.force’, and it is true, then the command is unconditionally run – does no timestamp checks.
mkpath(name, mode=511)
move_file(src, dst, level=1)
Move a file respectin dry-run flag.
reinitialize_command(command, reinit_subcommands=0)
run()
run_command(command)
Run some other command: uses the ‘run_command()’ method of Distribution, which creates and finalizes the command object if necessary and then invokes its ‘run()’ method.
set_undefined_options(src_cmd, *option_pairs)
Set the values of any “undefined” options from corresponding option values in some other command object. “Undefined” here means “is None”, which is the convention used to indicate that an option has not been changed between ‘initialize_options()’ and ‘finalize_options()’. Usually called from ‘finalize_options()’ for options that depend on some other command rather than another option of the same command. ‘src_cmd’ is the other command from which option values will be taken (a command object will be created for it if necessary); the remaining arguments are ‘(src_option,dst_option)’ tuples which mean “take the value of ‘src_option’ in the ‘src_cmd’ command object, and copy it to ‘dst_option’ in the current command object”.
spawn(cmd, search_path=1, level=1)
Spawn an external command respecting dry-run flag.
warn(msg)

Epydoc: animio.setup

class animio.setup.build_scripts(dist)

Bases: distutils.cmd.Command

announce(msg, level=1)
If the current verbosity level is of greater than or equal to ‘level’ print ‘msg’ to stdout.
copy_file(infile, outfile, preserve_mode=1, preserve_times=1, link=None, level=1)
Copy a file respecting verbose, dry-run and force flags. (The former two default to whatever is in the Distribution object, and the latter defaults to false for commands that don’t define it.)
copy_scripts()
Copy each script listed in ‘self.scripts’; if it’s marked as a Python script in the Unix way (first line matches ‘first_line_re’, ie. starts with “#!” and contains “python”), then adjust the first line to refer to the current Python interpreter as we copy.
copy_tree(infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1)
Copy an entire directory tree respecting verbose, dry-run, and force flags.
debug_print(msg)
Print ‘msg’ to stdout if the global DEBUG (taken from the DISTUTILS_DEBUG environment variable) flag is true.
dump_options(header=None, indent='')
ensure_dirname(option)
ensure_filename(option)
Ensure that ‘option’ is the name of an existing file.
ensure_finalized()
ensure_string(option, default=None)
Ensure that ‘option’ is a string; if not defined, set it to ‘default’.
ensure_string_list(option)
Ensure that ‘option’ is a list of strings. If ‘option’ is currently a string, we split it either on /,s*/ or /s+/, so “foo bar baz”, “foo,bar,baz”, and “foo, bar baz” all become [“foo”, “bar”, “baz”].
execute(func, args, msg=None, level=1)
finalize_options()
get_command_name()
get_finalized_command(command, create=1)
Wrapper around Distribution’s ‘get_command_obj()’ method: find (create if necessary and ‘create’ is true) the command object for ‘command’, call its ‘ensure_finalized()’ method, and return the finalized command object.
get_source_files()
get_sub_commands()
Determine the sub-commands that are relevant in the current distribution (ie., that need to be run). This is based on the ‘sub_commands’ class attribute: each tuple in that list may include a method that we call to determine if the subcommand needs to be run for the current distribution. Return a list of command names.
initialize_options()
make_archive(base_name, format, root_dir=None, base_dir=None)
make_file(infiles, outfile, func, args, exec_msg=None, skip_msg=None, level=1)
Special case of ‘execute()’ for operations that process one or more input files and generate one output file. Works just like ‘execute()’, except the operation is skipped and a different message printed if ‘outfile’ already exists and is newer than all files listed in ‘infiles’. If the command defined ‘self.force’, and it is true, then the command is unconditionally run – does no timestamp checks.
mkpath(name, mode=511)
move_file(src, dst, level=1)
Move a file respectin dry-run flag.
reinitialize_command(command, reinit_subcommands=0)
run()
run_command(command)
Run some other command: uses the ‘run_command()’ method of Distribution, which creates and finalizes the command object if necessary and then invokes its ‘run()’ method.
set_undefined_options(src_cmd, *option_pairs)
Set the values of any “undefined” options from corresponding option values in some other command object. “Undefined” here means “is None”, which is the convention used to indicate that an option has not been changed between ‘initialize_options()’ and ‘finalize_options()’. Usually called from ‘finalize_options()’ for options that depend on some other command rather than another option of the same command. ‘src_cmd’ is the other command from which option values will be taken (a command object will be created for it if necessary); the remaining arguments are ‘(src_option,dst_option)’ tuples which mean “take the value of ‘src_option’ in the ‘src_cmd’ command object, and copy it to ‘dst_option’ in the current command object”.
spawn(cmd, search_path=1, level=1)
Spawn an external command respecting dry-run flag.
warn(msg)

Epydoc: animio.setup

class animio.setup.chain

Bases: object

chain(*iterables) –> chain object

Return a chain object whose .next() method returns elements from the first iterable until it is exhausted, then elements from the next iterable, until all of the iterables are exhausted.

static from_iterable()

chain.from_iterable(iterable) –> chain object

Alternate chain() contructor taking a single iterable argument that evaluates lazily.

next
x.next() -> the next value, or raise StopIteration

Epydoc: animio.setup

class animio.setup.install(dist)

Bases: distutils.cmd.Command

announce(msg, level=1)
If the current verbosity level is of greater than or equal to ‘level’ print ‘msg’ to stdout.
change_roots(*names)
convert_paths(*names)
copy_file(infile, outfile, preserve_mode=1, preserve_times=1, link=None, level=1)
Copy a file respecting verbose, dry-run and force flags. (The former two default to whatever is in the Distribution object, and the latter defaults to false for commands that don’t define it.)
copy_tree(infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1)
Copy an entire directory tree respecting verbose, dry-run, and force flags.
create_home_path()
Create directories under ~
create_path_file()
debug_print(msg)
Print ‘msg’ to stdout if the global DEBUG (taken from the DISTUTILS_DEBUG environment variable) flag is true.
dump_dirs(msg)
dump_options(header=None, indent='')
ensure_dirname(option)
ensure_filename(option)
Ensure that ‘option’ is the name of an existing file.
ensure_finalized()
ensure_string(option, default=None)
Ensure that ‘option’ is a string; if not defined, set it to ‘default’.
ensure_string_list(option)
Ensure that ‘option’ is a list of strings. If ‘option’ is currently a string, we split it either on /,s*/ or /s+/, so “foo bar baz”, “foo,bar,baz”, and “foo, bar baz” all become [“foo”, “bar”, “baz”].
execute(func, args, msg=None, level=1)
expand_basedirs()
expand_dirs()
finalize_options()
finalize_other()
finalize_unix()
get_command_name()
get_finalized_command(command, create=1)
Wrapper around Distribution’s ‘get_command_obj()’ method: find (create if necessary and ‘create’ is true) the command object for ‘command’, call its ‘ensure_finalized()’ method, and return the finalized command object.
get_inputs()
get_outputs()
get_sub_commands()
Determine the sub-commands that are relevant in the current distribution (ie., that need to be run). This is based on the ‘sub_commands’ class attribute: each tuple in that list may include a method that we call to determine if the subcommand needs to be run for the current distribution. Return a list of command names.
handle_extra_path()
has_data()
has_headers()
has_lib()
Return true if the current distribution has any Python modules to install.
has_scripts()
initialize_options()
make_archive(base_name, format, root_dir=None, base_dir=None)
make_file(infiles, outfile, func, args, exec_msg=None, skip_msg=None, level=1)
Special case of ‘execute()’ for operations that process one or more input files and generate one output file. Works just like ‘execute()’, except the operation is skipped and a different message printed if ‘outfile’ already exists and is newer than all files listed in ‘infiles’. If the command defined ‘self.force’, and it is true, then the command is unconditionally run – does no timestamp checks.
mkpath(name, mode=511)
move_file(src, dst, level=1)
Move a file respectin dry-run flag.
reinitialize_command(command, reinit_subcommands=0)
run()
run_command(command)
Run some other command: uses the ‘run_command()’ method of Distribution, which creates and finalizes the command object if necessary and then invokes its ‘run()’ method.
select_scheme(name)
set_undefined_options(src_cmd, *option_pairs)
Set the values of any “undefined” options from corresponding option values in some other command object. “Undefined” here means “is None”, which is the convention used to indicate that an option has not been changed between ‘initialize_options()’ and ‘finalize_options()’. Usually called from ‘finalize_options()’ for options that depend on some other command rather than another option of the same command. ‘src_cmd’ is the other command from which option values will be taken (a command object will be created for it if necessary); the remaining arguments are ‘(src_option,dst_option)’ tuples which mean “take the value of ‘src_option’ in the ‘src_cmd’ command object, and copy it to ‘dst_option’ in the current command object”.
spawn(cmd, search_path=1, level=1)
Spawn an external command respecting dry-run flag.
warn(msg)

Epydoc: animio.setup

class animio.setup.install_lib(dist)

Bases: distutils.cmd.Command

announce(msg, level=1)
If the current verbosity level is of greater than or equal to ‘level’ print ‘msg’ to stdout.
build()
byte_compile(files)
copy_file(infile, outfile, preserve_mode=1, preserve_times=1, link=None, level=1)
Copy a file respecting verbose, dry-run and force flags. (The former two default to whatever is in the Distribution object, and the latter defaults to false for commands that don’t define it.)
copy_tree(infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1)
Copy an entire directory tree respecting verbose, dry-run, and force flags.
debug_print(msg)
Print ‘msg’ to stdout if the global DEBUG (taken from the DISTUTILS_DEBUG environment variable) flag is true.
dump_options(header=None, indent='')
ensure_dirname(option)
ensure_filename(option)
Ensure that ‘option’ is the name of an existing file.
ensure_finalized()
ensure_string(option, default=None)
Ensure that ‘option’ is a string; if not defined, set it to ‘default’.
ensure_string_list(option)
Ensure that ‘option’ is a list of strings. If ‘option’ is currently a string, we split it either on /,s*/ or /s+/, so “foo bar baz”, “foo,bar,baz”, and “foo, bar baz” all become [“foo”, “bar”, “baz”].
execute(func, args, msg=None, level=1)
finalize_options()
get_command_name()
get_finalized_command(command, create=1)
Wrapper around Distribution’s ‘get_command_obj()’ method: find (create if necessary and ‘create’ is true) the command object for ‘command’, call its ‘ensure_finalized()’ method, and return the finalized command object.
get_inputs()
Get the list of files that are input to this command, ie. the files that get installed as they are named in the build tree. The files in this list correspond one-to-one to the output filenames returned by ‘get_outputs()’.
get_outputs()
Return the list of files that would be installed if this command were actually run. Not affected by the “dry-run” flag or whether modules have actually been built yet.
get_sub_commands()
Determine the sub-commands that are relevant in the current distribution (ie., that need to be run). This is based on the ‘sub_commands’ class attribute: each tuple in that list may include a method that we call to determine if the subcommand needs to be run for the current distribution. Return a list of command names.
initialize_options()
install()
make_archive(base_name, format, root_dir=None, base_dir=None)
make_file(infiles, outfile, func, args, exec_msg=None, skip_msg=None, level=1)
Special case of ‘execute()’ for operations that process one or more input files and generate one output file. Works just like ‘execute()’, except the operation is skipped and a different message printed if ‘outfile’ already exists and is newer than all files listed in ‘infiles’. If the command defined ‘self.force’, and it is true, then the command is unconditionally run – does no timestamp checks.
mkpath(name, mode=511)
move_file(src, dst, level=1)
Move a file respectin dry-run flag.
reinitialize_command(command, reinit_subcommands=0)
run()
run_command(command)
Run some other command: uses the ‘run_command()’ method of Distribution, which creates and finalizes the command object if necessary and then invokes its ‘run()’ method.
set_undefined_options(src_cmd, *option_pairs)
Set the values of any “undefined” options from corresponding option values in some other command object. “Undefined” here means “is None”, which is the convention used to indicate that an option has not been changed between ‘initialize_options()’ and ‘finalize_options()’. Usually called from ‘finalize_options()’ for options that depend on some other command rather than another option of the same command. ‘src_cmd’ is the other command from which option values will be taken (a command object will be created for it if necessary); the remaining arguments are ‘(src_option,dst_option)’ tuples which mean “take the value of ‘src_option’ in the ‘src_cmd’ command object, and copy it to ‘dst_option’ in the current command object”.
spawn(cmd, search_path=1, level=1)
Spawn an external command respecting dry-run flag.
warn(msg)

Epydoc: animio.setup

class animio.setup.sdist(dist)

Bases: distutils.cmd.Command

add_defaults()
Add all the default files to self.filelist:
  • README or README.txt
  • setup.py
  • test/test*.py
  • all pure Python modules mentioned in setup script
  • all C sources listed as part of extensions or C libraries in the setup script (doesn’t catch C headers!)

Warns if (README or README.txt) or setup.py are missing; everything else is optional.

announce(msg, level=1)
If the current verbosity level is of greater than or equal to ‘level’ print ‘msg’ to stdout.
check_metadata()
Ensure that all required elements of meta-data (name, version, URL, (author and author_email) or (maintainer and maintainer_email)) are supplied by the Distribution object; warn if any are missing.
copy_file(infile, outfile, preserve_mode=1, preserve_times=1, link=None, level=1)
Copy a file respecting verbose, dry-run and force flags. (The former two default to whatever is in the Distribution object, and the latter defaults to false for commands that don’t define it.)
copy_tree(infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1)
Copy an entire directory tree respecting verbose, dry-run, and force flags.
debug_print(msg)
Print ‘msg’ to stdout if the global DEBUG (taken from the DISTUTILS_DEBUG environment variable) flag is true.
dump_options(header=None, indent='')
ensure_dirname(option)
ensure_filename(option)
Ensure that ‘option’ is the name of an existing file.
ensure_finalized()
ensure_string(option, default=None)
Ensure that ‘option’ is a string; if not defined, set it to ‘default’.
ensure_string_list(option)
Ensure that ‘option’ is a list of strings. If ‘option’ is currently a string, we split it either on /,s*/ or /s+/, so “foo bar baz”, “foo,bar,baz”, and “foo, bar baz” all become [“foo”, “bar”, “baz”].
execute(func, args, msg=None, level=1)
finalize_options()
get_archive_files()
Return the list of archive files created when the command was run, or None if the command hasn’t run yet.
get_command_name()
get_file_list()
Figure out the list of files to include in the source distribution, and put it in ‘self.filelist’. This might involve reading the manifest template (and writing the manifest), or just reading the manifest, or just using the default file set – it all depends on the user’s options and the state of the filesystem.
get_finalized_command(command, create=1)
Wrapper around Distribution’s ‘get_command_obj()’ method: find (create if necessary and ‘create’ is true) the command object for ‘command’, call its ‘ensure_finalized()’ method, and return the finalized command object.
get_sub_commands()
Determine the sub-commands that are relevant in the current distribution (ie., that need to be run). This is based on the ‘sub_commands’ class attribute: each tuple in that list may include a method that we call to determine if the subcommand needs to be run for the current distribution. Return a list of command names.
initialize_options()
make_archive(base_name, format, root_dir=None, base_dir=None)
make_distribution()
Create the source distribution(s). First, we create the release tree with ‘make_release_tree()’; then, we create all required archive files (according to ‘self.formats’) from the release tree. Finally, we clean up by blowing away the release tree (unless ‘self.keep_temp’ is true). The list of archive files created is stored so it can be retrieved later by ‘get_archive_files()’.
make_file(infiles, outfile, func, args, exec_msg=None, skip_msg=None, level=1)
Special case of ‘execute()’ for operations that process one or more input files and generate one output file. Works just like ‘execute()’, except the operation is skipped and a different message printed if ‘outfile’ already exists and is newer than all files listed in ‘infiles’. If the command defined ‘self.force’, and it is true, then the command is unconditionally run – does no timestamp checks.
make_release_tree(base_dir, files)
Create the directory tree that will become the source distribution archive. All directories implied by the filenames in ‘files’ are created under ‘base_dir’, and then we hard link or copy (if hard linking is unavailable) those files into place. Essentially, this duplicates the developer’s source tree, but in a directory named after the distribution, containing only the files to be distributed.
mkpath(name, mode=511)
move_file(src, dst, level=1)
Move a file respectin dry-run flag.
prune_file_list()

Prune off branches that might slip into the file list as created by ‘read_template()’, but really don’t belong there:

  • the build tree (typically “build”)
  • the release tree itself (only an issue if we ran “sdist” previously with –keep-temp, or it aborted)
  • any RCS, CVS, .svn, .hg, .git, .bzr, _darcs directories
read_manifest()
Read the manifest file (named by ‘self.manifest’) and use it to fill in ‘self.filelist’, the list of files to include in the source distribution.
read_template()

Read and parse manifest template file named by self.template.

(usually “MANIFEST.in”) The parsing and processing is done by ‘self.filelist’, which updates itself accordingly.

reinitialize_command(command, reinit_subcommands=0)
run()
run_command(command)
Run some other command: uses the ‘run_command()’ method of Distribution, which creates and finalizes the command object if necessary and then invokes its ‘run()’ method.
set_undefined_options(src_cmd, *option_pairs)
Set the values of any “undefined” options from corresponding option values in some other command object. “Undefined” here means “is None”, which is the convention used to indicate that an option has not been changed between ‘initialize_options()’ and ‘finalize_options()’. Usually called from ‘finalize_options()’ for options that depend on some other command rather than another option of the same command. ‘src_cmd’ is the other command from which option values will be taken (a command object will be created for it if necessary); the remaining arguments are ‘(src_option,dst_option)’ tuples which mean “take the value of ‘src_option’ in the ‘src_cmd’ command object, and copy it to ‘dst_option’ in the current command object”.
spawn(cmd, search_path=1, level=1)
Spawn an external command respecting dry-run flag.
warn(msg)
write_manifest()
Write the file list in ‘self.filelist’ (presumably as filled in by ‘add_defaults()’ and ‘read_template()’) to the manifest file named by ‘self.manifest’.

Table Of Contents

Previous topic

animio.info

Next topic

animio.ui

This Page