Method summary
- __init__(self, verbose = False)
- add(self, project, parent = None, raise_missing = True)
- add_dependencies(self)
- checkout(self, dir, dry_run = True)
- get_projects(self)
- get_root_project_info(self)
- inspect_repositories(self, repositories, ignore_repo_map = False)
- load_project_map(self, map)
- print_project_map(self)
- save_map_file(self, filepath)
Methods
- __init__(self, verbose = False)
Constructor.
- Extended to initialize our custom attributes:
- verbose is a boolean indicating whether to print lots of
information about the state progress of this instance.
- add(self, project, parent = None, raise_missing = True)
Add the specified project to our set of projects.
- The project specification may be either:
- a fully specified url to a project directory in ANY svn repository. A project directory is one that contains a setup.py file.
- a string that can be parsed by setuptools into a project specification, meaning a project name and/or version requirement.
- add_dependencies(self)
Add any dependencies of the current project set.
This method exists specifically so we can prefer the versions specified by the user's additions to this project set over finding the optimum match to some dependency in the first project. For example, if the first project, let's call it 'foo', has a dependency for 'bar >2.0, <3.0a' and the user explicitly added 'bar-2.5', then that dependency is met by the user addition. If we had parsed 'foo's dependencies before adding 'bar' though, we might have found 'bar-2.9' in the repository and used that instead, and then gotten a version conflict when we added the user's 'bar-2.5'.
- checkout(self, dir, dry_run = True)
Checkout the source for the known projects to the specified directory.
If the dry_run parameter is True, then no checkouts are actually made and instead we just output the status messages about what should be checked-out.
- get_projects(self)
Return a list of the projects in this project set.
The list is actually a list of tuples where each tuple is the project name and version.
- get_root_project_info(self)
Return the name and version of the root project of this project set.
The root project is the first project added by the user.
- inspect_repositories(self, repositories, ignore_repo_map = False)
Add to our project map by inspecting the specified SVN repositories.
The repositories argument is a list of URLs as strings. Each repository in the list will be inspected to discover the project sources stored in that repository. Unless the ignore_repo_map parameter is True, inspection starts by looking for a project map file stored at the root of the repository. If a project map is found, then its contents are read and we are done inspecting that repository. If no project map is found, then we will crawl the repository looking for the setup.py's that define project source trees.
- load_project_map(self, map)
Merge projects from the specified project map into our own project map.
The map parameter may be either the content of a project map or a filepath as a string. Either way, the contents of the map are iterated over to add each project to our own project map.
If a filepath is provided and the specified file can not be read, a ProjectMapNotFound exception is raised.
- print_project_map(self)
Prints the set of known projects to stdout.
- save_map_file(self, filepath)
Write out the contents of our project map to the specified file.
The file is created if it does not already exist, though the necessary directories are not created if they do not exist.