parent
							
								
									1e9e16d829
								
							
						
					
					
						commit
						005690bd67
					
				
							
								
								
									
										1
									
								
								AUTHORS
								
								
								
								
							
							
						
						
									
										1
									
								
								AUTHORS
								
								
								
								
							| 
						 | 
					@ -13,6 +13,7 @@ Ahn Ki-Wook
 | 
				
			||||||
Akiomi Kamakura
 | 
					Akiomi Kamakura
 | 
				
			||||||
Alan Velasco
 | 
					Alan Velasco
 | 
				
			||||||
Alexander Johnson
 | 
					Alexander Johnson
 | 
				
			||||||
 | 
					Alexander King
 | 
				
			||||||
Alexei Kozlenok
 | 
					Alexei Kozlenok
 | 
				
			||||||
Allan Feldman
 | 
					Allan Feldman
 | 
				
			||||||
Aly Sivji
 | 
					Aly Sivji
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,8 +54,16 @@ def prepare_release_pr(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    check_call(["git", "checkout", f"origin/{base_branch}"])
 | 
					    check_call(["git", "checkout", f"origin/{base_branch}"])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    changelog = Path("changelog")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    features = list(changelog.glob("*.feature.rst"))
 | 
				
			||||||
 | 
					    breaking = list(changelog.glob("*.breaking.rst"))
 | 
				
			||||||
 | 
					    is_feature_release = bool(features or breaking)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        version = find_next_version(base_branch, is_major, prerelease)
 | 
					        version = find_next_version(
 | 
				
			||||||
 | 
					            base_branch, is_major, is_feature_release, prerelease
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
    except InvalidFeatureRelease as e:
 | 
					    except InvalidFeatureRelease as e:
 | 
				
			||||||
        print(f"{Fore.RED}{e}")
 | 
					        print(f"{Fore.RED}{e}")
 | 
				
			||||||
        raise SystemExit(1)
 | 
					        raise SystemExit(1)
 | 
				
			||||||
| 
						 | 
					@ -80,9 +88,24 @@ def prepare_release_pr(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    print(f"Branch {Fore.CYAN}{release_branch}{Fore.RESET} created.")
 | 
					    print(f"Branch {Fore.CYAN}{release_branch}{Fore.RESET} created.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if prerelease:
 | 
				
			||||||
 | 
					        template_name = "release.pre.rst"
 | 
				
			||||||
 | 
					    elif is_feature_release:
 | 
				
			||||||
 | 
					        template_name = "release.minor.rst"
 | 
				
			||||||
 | 
					    else:
 | 
				
			||||||
 | 
					        template_name = "release.patch.rst"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # important to use tox here because we have changed branches, so dependencies
 | 
					    # important to use tox here because we have changed branches, so dependencies
 | 
				
			||||||
    # might have changed as well
 | 
					    # might have changed as well
 | 
				
			||||||
    cmdline = ["tox", "-e", "release", "--", version, "--skip-check-links"]
 | 
					    cmdline = [
 | 
				
			||||||
 | 
					        "tox",
 | 
				
			||||||
 | 
					        "-e",
 | 
				
			||||||
 | 
					        "release",
 | 
				
			||||||
 | 
					        "--",
 | 
				
			||||||
 | 
					        version,
 | 
				
			||||||
 | 
					        template_name,
 | 
				
			||||||
 | 
					        "--skip-check-links",
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
    print("Running", " ".join(cmdline))
 | 
					    print("Running", " ".join(cmdline))
 | 
				
			||||||
    run(
 | 
					    run(
 | 
				
			||||||
        cmdline,
 | 
					        cmdline,
 | 
				
			||||||
| 
						 | 
					@ -107,7 +130,9 @@ def prepare_release_pr(
 | 
				
			||||||
    print(f"Pull request {Fore.CYAN}{pr.url}{Fore.RESET} created.")
 | 
					    print(f"Pull request {Fore.CYAN}{pr.url}{Fore.RESET} created.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def find_next_version(base_branch: str, is_major: bool, prerelease: str) -> str:
 | 
					def find_next_version(
 | 
				
			||||||
 | 
					    base_branch: str, is_major: bool, is_feature_release: bool, prerelease: str
 | 
				
			||||||
 | 
					) -> str:
 | 
				
			||||||
    output = check_output(["git", "tag"], encoding="UTF-8")
 | 
					    output = check_output(["git", "tag"], encoding="UTF-8")
 | 
				
			||||||
    valid_versions = []
 | 
					    valid_versions = []
 | 
				
			||||||
    for v in output.splitlines():
 | 
					    for v in output.splitlines():
 | 
				
			||||||
| 
						 | 
					@ -118,12 +143,6 @@ def find_next_version(base_branch: str, is_major: bool, prerelease: str) -> str:
 | 
				
			||||||
    valid_versions.sort()
 | 
					    valid_versions.sort()
 | 
				
			||||||
    last_version = valid_versions[-1]
 | 
					    last_version = valid_versions[-1]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    changelog = Path("changelog")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    features = list(changelog.glob("*.feature.rst"))
 | 
					 | 
				
			||||||
    breaking = list(changelog.glob("*.breaking.rst"))
 | 
					 | 
				
			||||||
    is_feature_release = features or breaking
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if is_major:
 | 
					    if is_major:
 | 
				
			||||||
        return f"{last_version[0]+1}.0.0{prerelease}"
 | 
					        return f"{last_version[0]+1}.0.0{prerelease}"
 | 
				
			||||||
    elif is_feature_release:
 | 
					    elif is_feature_release:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,29 @@
 | 
				
			||||||
 | 
					pytest-{version}
 | 
				
			||||||
 | 
					=======================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The pytest team is proud to announce the {version} prerelease!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This is a prerelease, not intended for production use, but to test the upcoming features and improvements
 | 
				
			||||||
 | 
					in order to catch any major problems before the final version is released to the major public.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					We appreciate your help testing this out before the final release, making sure to report any
 | 
				
			||||||
 | 
					regressions to our issue tracker:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					https://github.com/pytest-dev/pytest/issues
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					When doing so, please include the string ``[prerelease]`` in the title.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You can upgrade from PyPI via:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pip install pytest=={version}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Users are encouraged to take a look at the CHANGELOG carefully:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    https://docs.pytest.org/en/stable/changelog.html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Thanks to all the contributors to this release:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{contributors}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Happy testing,
 | 
				
			||||||
 | 
					The pytest Development Team
 | 
				
			||||||
| 
						 | 
					@ -10,7 +10,7 @@ from colorama import Fore
 | 
				
			||||||
from colorama import init
 | 
					from colorama import init
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def announce(version):
 | 
					def announce(version, template_name):
 | 
				
			||||||
    """Generates a new release announcement entry in the docs."""
 | 
					    """Generates a new release announcement entry in the docs."""
 | 
				
			||||||
    # Get our list of authors
 | 
					    # Get our list of authors
 | 
				
			||||||
    stdout = check_output(["git", "describe", "--abbrev=0", "--tags"])
 | 
					    stdout = check_output(["git", "describe", "--abbrev=0", "--tags"])
 | 
				
			||||||
| 
						 | 
					@ -22,9 +22,6 @@ def announce(version):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    contributors = {name for name in stdout.splitlines() if not name.endswith("[bot]")}
 | 
					    contributors = {name for name in stdout.splitlines() if not name.endswith("[bot]")}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    template_name = (
 | 
					 | 
				
			||||||
        "release.minor.rst" if version.endswith(".0") else "release.patch.rst"
 | 
					 | 
				
			||||||
    )
 | 
					 | 
				
			||||||
    template_text = (
 | 
					    template_text = (
 | 
				
			||||||
        Path(__file__).parent.joinpath(template_name).read_text(encoding="UTF-8")
 | 
					        Path(__file__).parent.joinpath(template_name).read_text(encoding="UTF-8")
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
| 
						 | 
					@ -81,9 +78,9 @@ def check_links():
 | 
				
			||||||
    check_call(["tox", "-e", "docs-checklinks"])
 | 
					    check_call(["tox", "-e", "docs-checklinks"])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def pre_release(version, *, skip_check_links):
 | 
					def pre_release(version, template_name, *, skip_check_links):
 | 
				
			||||||
    """Generates new docs, release announcements and creates a local tag."""
 | 
					    """Generates new docs, release announcements and creates a local tag."""
 | 
				
			||||||
    announce(version)
 | 
					    announce(version, template_name)
 | 
				
			||||||
    regen(version)
 | 
					    regen(version)
 | 
				
			||||||
    changelog(version, write_out=True)
 | 
					    changelog(version, write_out=True)
 | 
				
			||||||
    fix_formatting()
 | 
					    fix_formatting()
 | 
				
			||||||
| 
						 | 
					@ -108,9 +105,16 @@ def main():
 | 
				
			||||||
    init(autoreset=True)
 | 
					    init(autoreset=True)
 | 
				
			||||||
    parser = argparse.ArgumentParser()
 | 
					    parser = argparse.ArgumentParser()
 | 
				
			||||||
    parser.add_argument("version", help="Release version")
 | 
					    parser.add_argument("version", help="Release version")
 | 
				
			||||||
 | 
					    parser.add_argument(
 | 
				
			||||||
 | 
					        "template_name", help="Name of template file to use for release announcement"
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    parser.add_argument("--skip-check-links", action="store_true", default=False)
 | 
					    parser.add_argument("--skip-check-links", action="store_true", default=False)
 | 
				
			||||||
    options = parser.parse_args()
 | 
					    options = parser.parse_args()
 | 
				
			||||||
    pre_release(options.version, skip_check_links=options.skip_check_links)
 | 
					    pre_release(
 | 
				
			||||||
 | 
					        options.version,
 | 
				
			||||||
 | 
					        options.template_name,
 | 
				
			||||||
 | 
					        skip_check_links=options.skip_check_links,
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if __name__ == "__main__":
 | 
					if __name__ == "__main__":
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue