X Tutup
The Wayback Machine - https://web.archive.org/web/20250531203920/https://github.com/python/cpython/issues/95502
Skip to content

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

Open
@yurivict

Description

@yurivict

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: pypa/pip#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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup