Skip to content

Commit 9b4952f

Browse files
q10facebook-github-bot
authored andcommitted
Fix OSS PyPI Publishing (#1619)
Summary: Pull Request resolved: #1619 Reviewed By: shintaro-iwasaki Differential Revision: D43678509 Pulled By: q10 fbshipit-source-id: 1f4d868038890d677fdde6fbc29594e0c2019ab8
1 parent 9493c2c commit 9b4952f

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

.github/scripts/setup_env.bash

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,10 +344,22 @@ create_conda_environment () {
344344
echo ""
345345
fi
346346

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

351+
echo "[SETUP] Upgrading PIP to latest ..."
352+
print_exec conda run -n "${env_name}" pip install --upgrade pip
353+
354+
# The pyOpenSSL and cryptography packages versions need to line up for PyPI publishing to work
355+
# https://stackoverflow.com/questions/74981558/error-updating-python3-pip-attributeerror-module-lib-has-no-attribute-openss
356+
echo "[SETUP] Upgrading pyOpenSSL ..."
357+
print_exec conda run -n "${env_name}" python -m pip install "pyOpenSSL>22.1.0"
358+
359+
# This test fails with load errors if the pyOpenSSL and cryptography package versions don't align
360+
echo "[SETUP] Testing pyOpenSSL import ..."
361+
(test_python_import "${env_name}" OpenSSL) || return 1
362+
351363
echo "[SETUP] Installed Python version: $(conda run -n "${env_name}" python --version)"
352364
echo "[SETUP] Successfully created Conda environment: ${env_name}"
353365
}
@@ -1086,6 +1098,7 @@ publish_to_pypi () {
10861098
echo "[INSTALL] Installing twine ..."
10871099
print_exec conda install -n "${env_name}" -y twine
10881100
(test_python_import "${env_name}" twine) || return 1
1101+
(test_python_import "${env_name}" OpenSSL) || return 1
10891102

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

0 commit comments

Comments
 (0)