Commit 3b03f468 authored by Xavier Thompson's avatar Xavier Thompson

Release 0.21: Adapt to python 3.12

See merge request !18
parents a957650d 48ce1af8
Pipeline #35286 passed with stage
in 0 seconds
Changes
=======
0.21 (2024-06-13)
-----------------
- Adapt to python 3.12
0.20 (2024-03-19)
-----------------
......
from setuptools import setup, find_packages
import os
version = '0.20'
version = '0.21'
name = 'slapos.recipe.cmmi'
......
import errno
import imp
import logging
import os
import re
......@@ -17,6 +16,20 @@ from ..utils import (
# from slapos.recipe.build
from .. import downloadunpacked
if sys.version_info >= (3, 5):
# See https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly
import importlib.util
def module_from_file_location(name, path):
spec = importlib.util.spec_from_file_location(name, path)
module = importlib.util.module_from_spec(spec)
sys.modules[name] = module
spec.loader.exec_module(module)
return module
else:
# BBB Python2, Python < 3.5
from imp import load_source as module_from_file_location
startup_environ = os.environ.copy()
# backport of shlex.quote from Python 3.3
......@@ -132,7 +145,7 @@ class Recipe(EnvironMixin):
try:
if not is_temp:
filename = os.path.abspath(filename)
module = imp.load_source('script', filename)
module = module_from_file_location('<script>', filename)
script = getattr(module, callable.strip())
try:
script(self.options, self.buildout, self.environ)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment