python / python/cpython

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

オープン
#95,502 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

topic-installation type-bug
主要言語
Python
スター
77.2k
フォーク
36k
PR マージ指標
PR 指標を取得中

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、openqasm-pygments パッケージ、--root=/tmp/openqasm-pygments、--prefix=/usr/local を使って pip のインストールを再現し、その後 Python の stdlib にある compileall の動作を調べます。生成された .cpython-39.pyc ファイルがソースパスをどこに記録するかを確認します。インストールされたバイトコードのパスにステージングディレクトリが含まれず、代わりにインストールプレフィックスで始まるようになれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
build-system
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。