The 'stdlib compileall' function writes stage directory into *.pyc files
还没有人认领这个 Issue。
- 主要语言
- 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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先使用 openqasm-pygments 包、--root=/tmp/openqasm-pygments 和 --prefix=/usr/local 重现 pip 安装,然后检查 Python 的 stdlib compileall 行为。验证生成的 .cpython-39.pyc 文件将源路径记录在何处;当已安装字节码的路径不再包含 staging 目录,而是以安装前缀开头时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- build-system
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100