示例#1
0
    def set_version_info(self, new_version=None, dry_run=True):
        '''Updates the version in version.py files for all modules we manage/release.

        Args:
            new_version (str, optional): A new module version. If not set, we only update the
                nightly version. Defaults to None.
            dry_run (bool, optional): Whether this operation should be a dry run. Defaults to True.

        Returns:
            List[dict]: The new versions of all modules.
        '''
        new_nightly = get_nightly_version()

        versions = []
        for module in self.all_publishable_modules:
            new_version = new_version or module.get_version_info(
            )['__version__']
            res = module.set_version_info(new_version,
                                          new_nightly,
                                          dry_run=dry_run)

            versions.append(res)

        assert all_equal(versions)
        return versions[0]
示例#2
0
    def check_all_versions_equal(self):
        '''Checks that all versions (both module and nightly) are equal

        Returns:
            List[dict]: List of dictionaries of version info
        '''
        module_versions = self.all_module_versions

        if not all_equal(module_versions.values()):
            click.echo(
                'Warning! Found repository in a bad state. Existing package versions were not '
                'equal:\n{versions}'.format(
                    versions=format_module_versions(module_versions)))
        return module_versions
示例#3
0
    def check_versions_equal(self, nightly=False):
        '''Checks that all versions for one source (module or nightly) are equal

        Returns:
            List[dict]: List of dictionaries of version info
        '''
        module_versions = self.all_module_versions

        source = '__nightly__' if nightly else '__version__'

        if not all_equal([module_version[source] for module_version in module_versions.values()]):
            click.echo(
                'Module versions must be in lockstep to release. Found:\n{versions}'.format(
                    versions=format_module_versions(module_versions)
                )
            )
            sys.exit(1)

        return module_versions