Skip to content

Commit

Permalink
Fix OSS PyPI Publishing (#1619)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: #1619

Reviewed By: shintaro-iwasaki

Differential Revision: D43678509

Pulled By: q10

fbshipit-source-id: 1f4d868038890d677fdde6fbc29594e0c2019ab8
  • Loading branch information
q10 authored and facebook-github-bot committed Mar 1, 2023
1 parent 9493c2c commit 9b4952f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion .github/scripts/setup_env.bash
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,22 @@ create_conda_environment () {
echo ""
fi

# -y removes any existing conda environment with the same name
# The `-y` flag removes any existing Conda environment with the same name
echo "[SETUP] Creating new Conda environment (Python ${python_version}) ..."
(exec_with_retries conda create -y --name "${env_name}" python="${python_version}") || return 1

echo "[SETUP] Upgrading PIP to latest ..."
print_exec conda run -n "${env_name}" pip install --upgrade pip

# The pyOpenSSL and cryptography packages versions need to line up for PyPI publishing to work
# https://stackoverflow.com/questions/74981558/error-updating-python3-pip-attributeerror-module-lib-has-no-attribute-openss
echo "[SETUP] Upgrading pyOpenSSL ..."
print_exec conda run -n "${env_name}" python -m pip install "pyOpenSSL>22.1.0"

# This test fails with load errors if the pyOpenSSL and cryptography package versions don't align
echo "[SETUP] Testing pyOpenSSL import ..."
(test_python_import "${env_name}" OpenSSL) || return 1

echo "[SETUP] Installed Python version: $(conda run -n "${env_name}" python --version)"
echo "[SETUP] Successfully created Conda environment: ${env_name}"
}
Expand Down Expand Up @@ -1086,6 +1098,7 @@ publish_to_pypi () {
echo "[INSTALL] Installing twine ..."
print_exec conda install -n "${env_name}" -y twine
(test_python_import "${env_name}" twine) || return 1
(test_python_import "${env_name}" OpenSSL) || return 1

echo "[PUBLISH] Uploading package(s) to PyPI: ${package_name} ..."
conda run -n "${env_name}" \
Expand Down

0 comments on commit 9b4952f

Please sign in to comment.