-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PYTHON-4485 Use Hatch as Build Backend (#827)
* PYTHON-4485 Use Hatch as Build Backend * lint * fix codeql * remove setup.py * rename test reqs * use fetch depth * fix benchmark * fix codeql
- Loading branch information
Showing
10 changed files
with
59 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,7 @@ | ||
#!/bin/bash -ex | ||
cd /python | ||
|
||
/opt/python/cp37-cp37m/bin/python -m build --wheel | ||
|
||
# Audit wheels and write manylinux tag | ||
for whl in dist/*none-any.whl; do | ||
# Skip already built manylinux wheels. | ||
if [[ "$whl" != *"manylinux"* ]]; then | ||
auditwheel repair $whl -w dist | ||
rm $whl | ||
fi | ||
done | ||
mkdir /tmp/wheelhouse | ||
/opt/python/cp38-cp38/bin/python -m build --wheel --outdir /tmp/wheelhouse | ||
# Audit wheels and repair manylinux tags | ||
auditwheel repair /tmp/wheelhouse/*.whl -w dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""A custom hatch build hook for pymongo.""" | ||
from __future__ import annotations | ||
|
||
import os | ||
import sys | ||
from pathlib import Path | ||
|
||
from hatchling.builders.hooks.plugin.interface import BuildHookInterface | ||
|
||
|
||
class CustomHook(BuildHookInterface): | ||
"""The pymongocrypt build hook.""" | ||
|
||
def initialize(self, version, build_data): | ||
"""Initialize the hook.""" | ||
if self.target_name == "sdist": | ||
return | ||
|
||
# Ensure wheel is marked as binary. | ||
# On linux, we use auditwheel to set the name. | ||
if sys.platform == "darwin": | ||
os.environ["MACOSX_DEPLOYMENT_TARGET"] = "11.0" | ||
build_data["tag"] = "py3-none-macosx_11_0_universal2" | ||
patt = ".dylib" | ||
elif os.name == "nt": | ||
build_data["tag"] = "py3-none-win_amd64" | ||
patt = ".dll" | ||
else: | ||
patt = ".so" | ||
|
||
here = Path(__file__).parent.resolve() | ||
dpath = here / "pymongocrypt" | ||
for fpath in dpath.glob(f"*{patt}"): | ||
relpath = os.path.relpath(fpath, here) | ||
build_data["artifacts"].append(relpath) | ||
build_data["force_include"][relpath] = relpath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.