-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-2345 Ensure release files can be installed #487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
eb563af
PYTHON-2345 Refactor windows release script
ShaneHarvey f06dad2
PYTHON-2345 Ensure release files can be installed
ShaneHarvey dcf931f
comment git_tag_only: true for testing
ShaneHarvey cedc392
Fix for mac python 2.7 without wheel
ShaneHarvey 0baf3e0
Revert "comment git_tag_only: true for testing"
ShaneHarvey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,25 +1,42 @@ | ||
#!/bin/bash -ex | ||
cd /pymongo | ||
cd /src | ||
|
||
# Get access to testinstall. | ||
. .evergreen/utils.sh | ||
|
||
# Create temp directory for validated files. | ||
rm -rf validdist | ||
mkdir -p validdist | ||
mv dist/* validdist || true | ||
|
||
# Compile wheels | ||
for PYBIN in /opt/python/*/bin; do | ||
for PYTHON in /opt/python/*/bin/python; do | ||
# Skip Python 3.3 and 3.9. | ||
if [[ "$PYBIN" == *"cp33"* || "$PYBIN" == *"cp39"* ]]; then | ||
if [[ "$PYTHON" == *"cp33"* || "$PYTHON" == *"cp39"* ]]; then | ||
continue | ||
fi | ||
# https://github.com/pypa/manylinux/issues/49 | ||
rm -rf build | ||
${PYBIN}/python setup.py bdist_wheel | ||
done | ||
$PYTHON setup.py bdist_wheel | ||
rm -rf build | ||
|
||
# https://github.com/pypa/manylinux/issues/49 | ||
rm -rf build | ||
# Audit wheels and write multilinux tag | ||
for whl in dist/*.whl; do | ||
# Skip already built manylinux1 wheels. | ||
if [[ "$whl" != *"manylinux"* ]]; then | ||
auditwheel repair $whl -w dist | ||
rm $whl | ||
fi | ||
done | ||
|
||
# Audit wheels and write multilinux1 tag | ||
for whl in dist/*.whl; do | ||
# Skip already built manylinux1 wheels. | ||
if [[ "$whl" != *"manylinux"* ]]; then | ||
auditwheel repair $whl -w dist | ||
rm $whl | ||
fi | ||
# Test that each wheel is installable. | ||
# Test without virtualenv because it's not present on manylinux containers. | ||
for release in dist/*; do | ||
testinstall $PYTHON $release "without-virtualenv" | ||
mv $release validdist/ | ||
done | ||
done | ||
|
||
mv validdist/* dist | ||
rm -rf validdist | ||
ls dist |
This file contains hidden or 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 hidden or 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,18 +1,32 @@ | ||
#!/bin/bash -ex | ||
|
||
# Get access to testinstall. | ||
. .evergreen/utils.sh | ||
|
||
# Create temp directory for validated files. | ||
rm -rf validdist | ||
mkdir -p validdist | ||
mv dist/* validdist || true | ||
|
||
for VERSION in 27 34 35 36 37 38; do | ||
PYTHON=C:/Python/Python${VERSION}/python.exe | ||
PYTHON32=C:/Python/32/Python${VERSION}/python.exe | ||
if [[ $VERSION == "2.7" ]]; then | ||
_pythons=(C:/Python/Python${VERSION}/python.exe \ | ||
C:/Python/32/Python${VERSION}/python.exe) | ||
for PYTHON in "${_pythons[@]}"; do | ||
if [[ $VERSION == "2.7" ]]; then | ||
rm -rf build | ||
$PYTHON setup.py bdist_egg | ||
fi | ||
rm -rf build | ||
$PYTHON setup.py bdist_egg | ||
rm -rf build | ||
$PYTHON32 setup.py bdist_egg | ||
fi | ||
rm -rf build | ||
$PYTHON setup.py bdist_wheel | ||
rm -rf build | ||
$PYTHON32 setup.py bdist_wheel | ||
$PYTHON setup.py bdist_wheel | ||
|
||
# Test that each wheel is installable. | ||
for release in dist/*; do | ||
testinstall $PYTHON $release | ||
mv $release validdist/ | ||
done | ||
done | ||
done | ||
|
||
mv validdist/* dist | ||
rm -rf validdist | ||
ls dist |
This file contains hidden or 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,55 @@ | ||
#!/bin/bash -ex | ||
|
||
# Usage: | ||
# createvirtualenv /path/to/python /output/path/for/venv | ||
# * param1: Python binary to use for the virtualenv | ||
# * param2: Path to the virtualenv to create | ||
function createvirtualenv { | ||
PYTHON=$1 | ||
VENVPATH=$2 | ||
if $PYTHON -m virtualenv --version; then | ||
VIRTUALENV="$PYTHON -m virtualenv" | ||
elif command -v virtualenv; then | ||
VIRTUALENV="$(command -v virtualenv) -p $PYTHON" | ||
else | ||
echo "Cannot test without virtualenv" | ||
exit 1 | ||
fi | ||
$VIRTUALENV --system-site-packages --never-download $VENVPATH | ||
if [ "Windows_NT" = "$OS" ]; then | ||
. $VENVPATH/Scripts/activate | ||
else | ||
. $VENVPATH/bin/activate | ||
fi | ||
} | ||
|
||
# Usage: | ||
# testinstall /path/to/python /path/to/.whl/or/.egg ["no-virtualenv"] | ||
# * param1: Python binary to test | ||
# * param2: Path to the wheel or egg file to install | ||
# * param3 (optional): If set to a non-empty string, don't create a virtualenv. Used in manylinux containers. | ||
function testinstall { | ||
PYTHON=$1 | ||
RELEASE=$2 | ||
NO_VIRTUALENV=$3 | ||
|
||
if [ -z "$NO_VIRTUALENV" ]; then | ||
createvirtualenv $PYTHON venvtestinstall | ||
PYTHON=python | ||
fi | ||
|
||
if [[ $RELEASE == *.egg ]]; then | ||
$PYTHON -m easy_install $RELEASE | ||
else | ||
$PYTHON -m pip install --upgrade $RELEASE | ||
fi | ||
cd tools | ||
$PYTHON fail_if_no_c.py | ||
$PYTHON -m pip uninstall -y pymongo | ||
cd .. | ||
|
||
if [ -z "$NO_VIRTUALENV" ]; then | ||
deactivate | ||
rm -rf venvtestinstall | ||
fi | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was needed to fix this error:
https://evergreen.mongodb.com/task/mongo_python_driver_Release__platform~macos_1014_release_patch_e1915fc89ba01f4f22f2a3ad1074978ff0fdf5b4_5f6145e1562343460ae4523e_20_09_15_22_53_41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a FIXME/TODO in case this is expected to be fixed by an upcoming BUILD ticket?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I opened https://jira.mongodb.org/browse/PYTHON-2375 and https://jira.mongodb.org/browse/BUILD-11842. Since it's tracked in Jira I don't think we need to add a TODO in code.