actions / actions/setup-python

Update PY_PYTHON env var on windows with installed version if update-environment is true

Đang mở
#1,027 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

feature request
Ngôn ngữ chính
TypeScript
Star
2.2k
Fork
739
Merge trung bình
6 ngày 18 giờ
Pull request đã merge (30 ngày)
1

Mô tả

Description:
The update-environment flag updates seems to update a bunch of env variables to point at the newly installed version (cypthon example: https://github.com/actions/setup-python/blob/main/src/find-python.ts#L111).

Could it also add the PY_PYTHON=<version> on Windows whenever update-environment is true? This will make the default version for the Windows py launcher match the one requested - even if the runner has another version already installed.

Justification:
In short: make sure that py <script.py> runs on the version of python that you just installed with setup-python.

I bumped into this because we had some scripts running on a windows runner using py <script.py> in an action. The runner updated, everything broke, and we noticed that even though setup-python is installing everything correctly - if another version is there (in this case a newer version) running anything with py can use the other version instead of the one that was just installed by setup-python.

Are you willing to submit a PR?
Happy to! I just didn't want to to put time into it if the feature is not a good idea / I'm missing something. Setting the PY_PYTHON env var in the actions worked for my specific case, though I'm wondering if to do it in general it should set any other py launcher related variables to match the newly installed python too.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu trong src/find-python.ts, tại phần xử lý update-environment được đề cập trong issue, và theo dõi cách các biến môi trường của các phiên bản đã cài đặt được cập nhật trên Windows. Thay đổi hoàn tất khi update-environment cũng đặt PY_PYTHON thành phiên bản đã cài đặt được yêu cầu để trình khởi chạy py của Windows chọn phiên bản đó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
github-actions, python, typescript
Lĩnh vực
devops, operating-systems
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.