Skip to content

Commit

Permalink
Merge pull request #371 from carstencodes/contrib/carstencodes/newpyt…
Browse files Browse the repository at this point in the history
…honwheelname

fix!: New python wheel name
  • Loading branch information
yoheimuta authored Mar 16, 2024
2 parents 42b453f + b09583c commit 19a2198
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ If you want to get an output that matches the TSC compiler, use reporter `tsc`.

### Within Python projects

You can use `protolint` as a linter within your python projects. Just add the desired version to
You can use `protolint` as a linter within your python projects, the wheel `protolint-bin` on [pypi](https://pypi.org) contains the pre-compiled binaries for various platforms. Just add the desired version to
your `pyproject.toml` or `requirements.txt`.

The wheels downloaded will contain the compiled go binaries for `protolint` and `protoc-gen-protolint`. Your platform must
Expand Down
13 changes: 8 additions & 5 deletions bdist/py/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ def clear_dir(path):
PY_TAG = "py2.py3"
ABI_TAG = "none"

package_name = "protolint-bin"


for arch_platform in ap_map.keys():
tag = f"{PY_TAG}-{ABI_TAG}-{ap_map[arch_platform]}"
logger.info("Packing files for %s using tag %s", arch_platform, tag)
Expand All @@ -93,9 +96,9 @@ def clear_dir(path):
p_executables = [dist / f"{exe}_{arch_platform}" / f"{exe}{suffix}" for exe in executables]

logger.debug("Creating wheel data folder")
dataFolder = pdir / f"protolint-{version_id}.data"
dataFolder = pdir / f"{package_name}-{version_id}.data"
logger.debug("Creating wheel data folder")
distInfoFolder = pdir / f"protolint-{version_id}.dist-info"
distInfoFolder = pdir / f"{package_name}-{version_id}.dist-info"

dataFolder.mkdir(parents=True, exist_ok=True)
distInfoFolder.mkdir(parents=True, exist_ok=True)
Expand Down Expand Up @@ -124,8 +127,8 @@ def clear_dir(path):
logger.debug("Writing METADATA file")
ml.writelines([
"Metadata-Version: 2.1\n",
"Name: protolint\n",
"Summary: A pluggable linter and fixer to enforce Protocol Buffer style and conventions.\n",
f"Name: {package_name}\n",
"Summary: A pluggable linter and fixer to enforce Protocol Buffer style and conventions.\nThis package contains the pre-compiled binaries.\n",
"Description-Content-Type: text/markdown\n",
"Author: yohei yoshimuta\n",
"Maintainer: yohei yoshimuta\n",
Expand Down Expand Up @@ -166,7 +169,7 @@ def clear_dir(path):
rl.write(distInfoFolder.name + "/RECORD,,\n")
wheel_content.append(distInfoFolder / "RECORD")

whl_file = wheel / f"protolint-{version_id}-{tag}.whl"
whl_file = wheel / f"{package_name}-{version_id}-{tag}.whl"
if whl_file.is_file():
logger.debug("Removing existing wheel file")
whl_file.unlink()
Expand Down

0 comments on commit 19a2198

Please sign in to comment.