python / python/cpython

The 'stdlib compileall' function writes stage directory into *.pyc files

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

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

topic-installation type-bug
Ngôn ngữ chính
Python
Star
77.2k
Fork
36k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

Description

I need to install a python package into a stage directory.

The command I run from the source directory is:

pip install {my-pkg-name} --isolated --root=/tmp/stage/dir --prefix=/usr/local --ignore-installed --no-deps

This command installs the package into the right location, but *.cpython-39.pyc files have full paths to *.py files in the stage directory.

If paths of *.py are needed they should be adjusted so that they should begin with prefix (/usr/local). This is because the source directory will be deleted before the package is run.

Pip uses cpython's stdlib compileall function that inserts stage directory paths.

See the original but report for pip: https://github.com/pypa/pip/issues/11317

pip-22.1.2
Python-3.9
FreeBSD 13.1

How to Reproduce

git clone https://github.com/openqasm/openqasm-pygments.git
cd openqasm-pygments
pip install openqasm-pygments --isolated --root=/tmp/openqasm-pygments --prefix=/usr/local --ignore-installed --no-deps

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

Mở hướng dẫn đóng góp

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 bằng cách tái hiện quá trình cài đặt pip bằng gói openqasm-pygments, --root=/tmp/openqasm-pygments và --prefix=/usr/local, sau đó kiểm tra hành vi của compileall trong stdlib của Python. Xác minh các tệp .cpython-39.pyc được tạo ghi lại các đường dẫn nguồn ở đâu; công việc được xem là hoàn tất khi các đường dẫn bytecode đã cài đặt không còn bao gồm thư mục staging mà thay vào đó bắt đầu bằng tiền tố cài đặt.

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

Đánh giá

Công nghệ
python
Lĩnh vực
build-system
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 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
35/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.