python / python/cpython

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

Offen
#95,502 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

topic-installation type-bug
Vorherrschende Sprache
Python
Sterne
77.2k
Forks
36k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, die pip-Installation mit dem openqasm-pygments-Paket, --root=/tmp/openqasm-pygments und --prefix=/usr/local zu reproduzieren, und untersuche anschließend das Verhalten von Pythons stdlib compileall. Überprüfe, wo die generierten .cpython-39.pyc-Dateien die Quellpfade speichern; als erledigt gilt die Aufgabe, wenn die Pfade des installierten Bytecodes das Staging-Verzeichnis nicht mehr enthalten, sondern stattdessen mit dem Installationspräfix beginnen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
build-system
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.