pex-tool / pex

A tool for generating .pex (Python EXecutable) files, lock files and venvs.
https://docs.pex-tool.org/
Apache License 2.0
2.5k stars 257 forks source link

Fix tmp dir cleanup. #2367

Closed jsirois closed 5 months ago

jsirois commented 5 months ago

The deploy of v2.2.0 failed, much like v2.1.164, due to tox -epackage ... leaving non-PyPI artifacts in the dist/ dir. This time the issue was dist/.tmp. Fix cleanup of this tmp dir and, finally, fix the PyPI deploy in the release process.

jsirois commented 5 months ago

I fixed this deploy just as in https://github.com/pex-tool/pex/pull/2364#issue-2133749943.

This time, by inspection with ls -la dist/ after tox -e package -- --no-pex --additional-format sdist --additional-format wheel --embed-docs --clean-docs, I'm positive there is nothing in dist/ the PyPI deploy action won't like for the next release:

jsirois@Gill-Windows:~/dev/pex-tool/jsirois-pex (CI/deploy/fix-again) $ tox -e package -- --no-pex --additional-format sdist --additional-format wheel --embed-docs --clean-docs
ROOT: will run in automatically provisioned tox, host /home/jsirois/bin/tox.venv/bin/python3.11 is missing [requires (has)]: tox<4 (4.11.4), virtualenv<20.16 (20.25.0)
ROOT: provision> .tox/.tox/bin/python -m tox -e package -- --no-pex --additional-format sdist --additional-format wheel --embed-docs --clean-docs
package installed: build==1.0.3,packaging==23.2,pyproject_hooks==1.0.0
package run-test-pre: PYTHONHASHSEED='3462761846'
package run-test: commands[0] | python scripts/package.py --no-pex --additional-format sdist --additional-format wheel --embed-docs --clean-docs
Building additional distribution formats to `dist`: 1.) sdist, 2.) wheel ...
Built:
  dist/pex-2.2.0.tar.gz
  dist/pex-2.2.0-py2.py3-none-any.whl
____________________________________________________________________________________________________ summary _____________________________________________________________________________________________________
  package: commands succeeded
  congratulations :)
jsirois@Gill-Windows:~/dev/pex-tool/jsirois-pex (CI/deploy/fix-again) $ ls -la dist/
total 7372
drwxr-xr-x  2 jsirois jsirois    4096 Feb 14 22:27 .
drwxr-xr-x 17 jsirois jsirois    4096 Feb 14 22:26 ..
-rw-------  1 jsirois jsirois 3388282 Feb 14 22:27 pex-2.2.0-py2.py3-none-any.whl
-rw-------  1 jsirois jsirois 4147144 Feb 14 22:26 pex-2.2.0.tar.gz
jsirois commented 5 months ago

The deploy error for v2.2.0 to PyPI is here: https://github.com/pex-tool/pex/actions/runs/7910343214/job/21593020775#step:6:42

/usr/bin/docker run --name bfe176bbf47c40ddae1e285da82dfdde_367127 --label 288507 --workdir /github/workspace --rm -e "pythonLocation" -e "PKG_CONFIG_PATH" -e "Python_ROOT_DIR" -e "Python2_ROOT_DIR" -e "Python3_ROOT_DIR" -e "LD_LIBRARY_PATH" -e "INPUT_PRINT-HASH" -e "INPUT_VERBOSE" -e "INPUT_USER" -e "INPUT_PASSWORD" -e "INPUT_REPOSITORY-URL" -e "INPUT_REPOSITORY_URL" -e "INPUT_PACKAGES-DIR" -e "INPUT_PACKAGES_DIR" -e "INPUT_VERIFY-METADATA" -e "INPUT_VERIFY_METADATA" -e "INPUT_SKIP-EXISTING" -e "INPUT_SKIP_EXISTING" -e "INPUT_PRINT_HASH" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_ID_TOKEN_REQUEST_URL" -e "ACTIONS_ID_TOKEN_REQUEST_TOKEN" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/pex/pex":"/github/workspace" 288507:bfe176bbf47c40ddae1e285da82dfdde  "__token__" "" "" "" "" "" "true" "true"
Notice: Attempting to perform trusted publishing exchange to retrieve a temporary short-lived API token for authentication against https://upload.pypi.org/legacy/ due to __token__ username with no supplied password field
Checking dist/pex-2.2.0-py2.py3-none-any.whl: PASSED
Checking dist/pex-2.2.0.tar.gz: PASSED
Showing hash values of files to be uploaded:
/github/workspace/dist/pex-2.2.0.tar.gz

Traceback (most recent call last):
SHA256: 57aab8605699e1dbe22f1b9114f3b0bdbe2552284bda6a5c3dd6dd45f2770c5f
MD5: c1048b408b8ef684a8790b31eab706fb
  File "/app/print-hash.py", line 17, in <module>
    content = file_object.read_bytes()
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/pathlib.py", line 1050, in read_bytes
BLAKE2-256: 1c4088778dd79d623c8494c6a8723041dd625b6cf3ca4a95d5d2843ce598e084

/github/workspace/dist/.tmp

    with self.open(mode='rb') as f:
         ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/pathlib.py", line 1044, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IsADirectoryError: [Errno 21] Is a directory: '/github/workspace/dist/.tmp'