diff --git a/src/docs/release.md b/src/docs/release.md index 4c970240331..3730fcde0a1 100644 --- a/src/docs/release.md +++ b/src/docs/release.md @@ -51,9 +51,7 @@ script fail: - **Get your pypi account added as an `owner` for all pantsbuild.pants packages.** - You can ask any one of the [Owners](#owners) listed below to do this. - Once this is done and you've performed your 1st release, add yourself to - the [Owners](#owners) section below. + You can ask any one of the current [Owners](#owners) to do this. - **Configure your pypi credentials locally in `~/.pypirc`** @@ -194,7 +192,7 @@ if the tag for the prior release (eg: release_0.0.33) :::bash $ ./build-support/bin/contributors.sh -s -Listing Packages and Owners +Listing Packages and Owners ------ The current list of packages can be obtained via : @@ -202,31 +200,13 @@ The current list of packages can be obtained via : :::bash $ ./build-support/bin/release.sh -l -Right now that's: - -- pantsbuild.pants -- pantsbuild.pants.contrib.avro -- pantsbuild.pants.contrib.buildgen -- pantsbuild.pants.contrib.codeanalysis -- pantsbuild.pants.contrib.confluence -- pantsbuild.pants.contrib.cpp -- pantsbuild.pants.contrib.errorprone -- pantsbuild.pants.contrib.findbugs -- pantsbuild.pants.contrib.go -- pantsbuild.pants.contrib.googlejavaformat -- pantsbuild.pants.contrib.jax_ws -- pantsbuild.pants.contrib.mypy -- pantsbuild.pants.contrib.node -- pantsbuild.pants.contrib.python.checks -- pantsbuild.pants.contrib.scalajs -- pantsbuild.pants.contrib.scrooge -- pantsbuild.pants.contrib.thrifty -- pantsbuild.pants.testinfra - You can run the following to get a full ownership roster for each package : :::bash $ ./build-support/bin/release.sh -o +We generally expect all packages to have the same set of owners, which you can +view [here](https://pypi.org/project/pantsbuild.pants/). + [needs-cherrypick]: https://github.com/pantsbuild/pants/pulls?q=is%3Apr+label%3Aneeds-cherrypick diff --git a/src/python/pants/releases/reversion.py b/src/python/pants/releases/reversion.py index 0601e93ec23..43a1f86aa34 100644 --- a/src/python/pants/releases/reversion.py +++ b/src/python/pants/releases/reversion.py @@ -9,8 +9,8 @@ import fnmatch import glob import hashlib -import json import os +import re import zipfile from builtins import open, str @@ -89,6 +89,11 @@ def rewrite_record_file(workspace, src_record_file, mutated_file_tuples): safe_file_dump(os.path.join(workspace, dst_record_file), '\r\n'.join(output_records) + '\r\n', binary_mode=False) +# The wheel METADATA file will contain a line like: `Version: 1.11.0.dev3+7951ec01`. +# We don't parse the entire file because it's large (it contains the entire release notes history). +_version_re = re.compile('Version: (?P\S+)') + + def reversion(args): with temporary_dir() as workspace: # Extract the input. @@ -100,10 +105,17 @@ def reversion(args): dist_info_dir = locate_dist_info_dir(workspace) record_file = os.path.join(dist_info_dir, 'RECORD') - # Load metadata for the input whl. - with open(os.path.join(workspace, dist_info_dir, 'metadata.json'), 'r') as info: - metadata = json.load(info) - input_version = metadata['version'] + # Get version from the input whl's metadata. + input_version = None + metadata_file = os.path.join(workspace, dist_info_dir, 'METADATA') + with open(metadata_file, 'r') as info: + for line in info: + mo = _version_re.match(line) + if mo: + input_version = mo.group('version') + break + if not input_version: + raise Exception('Could not find `Version:` line in {}'.format(metadata_file)) # Rewrite and move all files (including the RECORD file), recording which files need to be # re-fingerprinted due to content changes.