summaryrefslogtreecommitdiff
path: root/addons/base_import_module/models
diff options
context:
space:
mode:
authorXavier Morel <xmo@odoo.com>2019-10-30 11:02:41 +0000
committerXavier Morel <xmo@odoo.com>2019-10-30 11:02:41 +0000
commit355e3609732bdc1ef0563edadb8634a322d7d5af (patch)
treef4ddc3978ddb5fd8567e3cd6dcbc45a6cd6d116c /addons/base_import_module/models
parent8ef1be2e42f3c060db61a1a5d6b463a1cf1a1fd5 (diff)
[IMP] core: mark a few osutil functions as deprecated
* walksymlinks is useless, os.walk got followlinks in 2.6 * tempdir is redundant with tempfile.TemporaryDirectory added in 3.2 * listdir(recursive=False) is just os.listdir (I guess recursive=True is somewhat useful) * zip_dir is *not* redundant with shutil.make_archive: - zip_dir handles the archived root differently - zip_dir sorts files, make_archive sorts directories - make_archive explicitly adds entries for directories (including empty), sorts directories, doesn't sort files; zip_dir sorts files (including with a custom key function) but ignores directories - zip_dir filters out a bunch of trash files closes odoo/odoo#39573 Signed-off-by: Christophe Simonis <chs@odoo.com>
Diffstat (limited to 'addons/base_import_module/models')
-rw-r--r--addons/base_import_module/models/ir_module.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/base_import_module/models/ir_module.py b/addons/base_import_module/models/ir_module.py
index eda9562fd65..a9d064ad23a 100644
--- a/addons/base_import_module/models/ir_module.py
+++ b/addons/base_import_module/models/ir_module.py
@@ -5,6 +5,7 @@ import logging
import lxml
import os
import sys
+import tempfile
import zipfile
from os.path import join as opj
@@ -13,7 +14,6 @@ from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.modules import load_information_from_description_file
from odoo.tools import convert_file, exception_to_unicode
-from odoo.tools.osutil import tempdir
_logger = logging.getLogger(__name__)
@@ -123,7 +123,7 @@ class IrModule(models.Model):
if zf.file_size > MAX_FILE_SIZE:
raise UserError(_("File '%s' exceed maximum allowed file size") % zf.filename)
- with tempdir() as module_dir:
+ with tempfile.TemporaryDirectory() as module_dir:
import odoo.modules.module as module
try:
odoo.addons.__path__.append(module_dir)