def bump_pkg(pkg_path, final=True): """Bump both version files (history+version.txt) for a package """ hp = FileHistoryParser(pkg_path) hp.bump_version() bump_version(pkg_path) vh = hp.get_current_version() vv = get_version(pkg_path) def check_final(x, final): return (final and ('dev' not in x)) or ((not final) and ('dev' in x)) def check_versions(x, y, final): return (x == y) and check_final(x, final) if not check_versions(vv, vh, final): f = final and 'final' or 'devel' print_msg( "There is something wrong with package version when " "trying to bump to ", f) print_msg("HISTORY.txt version is at", vh) print_msg("version.txt version is at", vv) sys.exit(1)
def step_5(self, step, description): if self.no_buildout_update: return version = get_version(self.package_path) version_path = os.path.join(self.build_path, 'versions.cfg') self.do_step(lambda: change_version( path=version_path, package=self.package, version=version), step, description)
def step_6(self, step, description): if self.no_buildout_update: return version = get_version(self.package_path) self.do_step( lambda: self.build_scm.commit( paths=["versions.cfg"], message='Updated %s to %s' % (self.package, version)), step, description)
def step_6(self, step, description): if self.no_buildout_update: return version = get_version(self.package_path) self.do_step( lambda: self.build_scm.commit(paths=["versions.cfg"], message='Updated %s to %s' % (self.package, version)), step, description)
def step_5(self, step, description): if self.no_buildout_update: return version = get_version(self.package_path) version_path = os.path.join(self.build_path, 'versions.cfg') self.do_step( lambda: change_version( path=version_path, package=self.package, version=version), step, description)
def step_8(self, step, description): self.pkg_scm.reset(['HEAD^1']) self.pkg_scm.checkout(["develop"]) self.pkg_scm.update([]) version = get_version(self.package_path) self.do_step( lambda: self.pkg_scm.commit([], message='Updated version for %s to %s' % (self.package, version)), step, description) self.pkg_scm.push(["--tags"]) self.pkg_scm.push(["--all"])
def step_7(self, step, description): def bump(): return bump_pkg(self.package_path, final=False) def commit(): return self.pkg_scm.commit(message="Bump version and history file") def do(): return bump() and commit() self.do_step(do, step, description, interactive=True) if self.verbose: vv = get_version(self.package_path) print_msg("Bumped version to ", vv)
def bump_pkg(pkg_path, final=True): """Bump both version files (history+version.txt) for a package """ hp = FileHistoryParser(pkg_path) hp.bump_version() bump_version(pkg_path) vh = hp.get_current_version() vv = get_version(pkg_path) def check_final(x, final): return (final and ('dev' not in x)) or ((not final) and ('dev' in x)) def check_versions(x, y, final): return (x == y) and check_final(x, final) if not check_versions(vv, vh, final): f = final and 'final' or 'devel' print_msg("There is something wrong with package version when " "trying to bump to ", f) print_msg("HISTORY.txt version is at", vh) print_msg("version.txt version is at", vv) sys.exit(1)
def check_package_sanity(self): # if self.pkg_scm.is_dirty(): # raise Error("Package is dirty. Quiting") if not os.path.exists(self.package_path): raise Error("Path %s is invalid, quiting." % self.package_path) # check if we have hardcoded version in setup.py # this is a dumb but hopefully effective method: we look for a line # starting with version= and fail if there's a number on it setup_py = find_file(self.package_path, 'setup.py') f = open(setup_py) version = [l for l in f.readlines() if l.strip().startswith('version')] for l in version: for c in l: if c.isdigit(): raise Error("There's a hardcoded version in the " "setup.py file. Quiting.") vv = get_version(self.package_path) vh = FileHistoryParser(self.package_path).get_current_version() if self.resume_from > 1: return # Bypass sanity checks when resuming vv_version = Version(vv) if not vv_version.is_prerelease: raise Error("Version.txt file does not contain a dev version. " "Quiting.") vh_version = Version(vh) if not vh_version.is_prerelease: raise Error("HISTORY.txt file does not contain a dev version. " "Quiting.") if vh != vv: raise Error("Latest version in HISTORY.txt is not the " "same as in version.txt. Quiting.") # We depend on collective.dist installed in the python. # Installing eggmonkey under buildout with a different python doesn't # install properly the collective.dist print_msg("Installing collective.dist in ", self.python) cmd = self.python + " setup.py easy_install -q -U collective.dist" try: subprocess.check_call(cmd, cwd=self.package_path, shell=True) except subprocess.CalledProcessError: # raise Error("Failed to install collective.dist in", self.python) pass # easier not to fail here # check if package metadata is properly filled try: cmd = self.python + " setup.py check --strict" subprocess.check_call(cmd, cwd=self.package_path, shell=True) except subprocess.CalledProcessError: print "Make sure that the package following metadata filled in:" print " - name" print " - version" print " - url" print " - author and author_email" print " - maintainer and maintainer_email" raise Error("Package has improperly filled metadata. Quiting")