Project

General

Profile

Tâche #34937

Scénario #34864: EOLE 2.9 : envisager la disparition des modules python "distutils" et "imp"

Étude

Added by Benjamin Bohard 5 months ago. Updated 4 months ago.

Status:
Fermé
Priority:
Normal
Assigned To:
Start date:
10/01/2022
Due date:
% Done:

100%

Remaining (hours):
0.0

History

#1 Updated by Benjamin Bohard 5 months ago

  • Status changed from Nouveau to En cours

#2 Updated by Benjamin Bohard 5 months ago

from distutils.spawn import find_executable

peut être remplacé par
import shutil
shutil.which
from distutils.version import StrictVersion

peut être remplacé par
from packaging.version import Version

Le module packaging ne fait pas partie de la bibliothèque standard et il est nécessaire d’installer python3-packaging en dépendance d’un paquet EOLE.

Le module imp peut être remplacé par le module importlib.

import imp
current_plugin = imp.load_source('current_plugin', plugin_module)

peut être remplacé par
import importlib
def load_source(name, module_path):
    spec = importlib.util.spec_from_file_location(name, module_path)
    module = importlib.util.module_from_spec(spec)
    spec.loader.exec_module(module)
    return module
current_plugin = load_source('current_plugin', plugin_module)

https://peps.python.org/pep-0632/#migration-advice
https://github.com/cuthbertLab/music21/pull/1424/commits/29eddb71430534114a4695f22de791667c6cd81e

#3 Updated by Benjamin Bohard 5 months ago

Le remplacement de imp par importlib a une conséquence curieuse : l’ordre des classes de plugins n’est pas le même.

#4 Updated by Benjamin Bohard 5 months ago

  • Status changed from En cours to À valider

#5 Updated by Ludwig Seys 5 months ago

  • Status changed from À valider to Résolu

#6 Updated by Joël Cuissinat 4 months ago

  • Status changed from Résolu to Fermé
  • % Done changed from 0 to 100
  • Remaining (hours) set to 0.0

Also available in: Atom PDF