Skip to content

Commit

Permalink
PYTHON-5016 Update scripts to handle Windows spawn hosts (#2047)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Jan 6, 2025
1 parent a0de09e commit fd5a105
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .evergreen/setup-spawn-host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ if [ -z "$1" ]
fi

target=$1
remote_dir=/home/ec2-user/mongo-python-driver
user=${target%@*}
remote_dir=/home/$user/mongo-python-driver

echo "Copying files to $target..."
rsync -az -e ssh --exclude '.git' --filter=':- .gitignore' -r . $target:$remote_dir
Expand Down
5 changes: 3 additions & 2 deletions .evergreen/sync-spawn-host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ if [ -z "$1" ]
fi

target=$1
user=${target%@*}

echo "Syncing files to $target..."
rsync -haz -e ssh --exclude '.git' --filter=':- .gitignore' -r . $target:/home/ec2-user/mongo-python-driver
rsync -haz -e ssh --exclude '.git' --filter=':- .gitignore' -r . $target:/home/$user/mongo-python-driver
# shellcheck disable=SC2034
fswatch -o . | while read f; do rsync -hazv -e ssh --exclude '.git' --filter=':- .gitignore' -r . $target:/home/ec2-user/mongo-python-driver; done
fswatch -o . | while read f; do rsync -hazv -e ssh --exclude '.git' --filter=':- .gitignore' -r . $target:/home/$user/mongo-python-driver; done
echo "Syncing files to $target... done."
5 changes: 5 additions & 0 deletions _setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ def run(self):
)

def build_extension(self, ext):
# "ProgramFiles(x86)" is not a valid environment variable in Cygwin but is needed for
# the MSVCCompiler in distutils.
if os.name == "nt":
if "ProgramFiles" in os.environ and "ProgramFiles(x86)" not in os.environ:
os.environ["ProgramFiles(x86)"] = os.environ["ProgramFiles"] + " (x86)"
name = ext.name
try:
build_ext.build_extension(self, ext)
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?)|dummy.*)$"
"tools/*.py" = ["T201"]
"green_framework_test.py" = ["T201"]
"hatch_build.py" = ["S"]
"_setup.py" = ["SIM112"]

[tool.coverage.run]
branch = true
Expand Down

0 comments on commit fd5a105

Please sign in to comment.