From 7e5a259319589bcb63b9ed71e5ee3b7e8acdfe01 Mon Sep 17 00:00:00 2001 From: default Date: Tue, 22 Dec 2020 09:27:47 +0000 Subject: [PATCH] [REM] rem cert hash --- pos_hash_cert/__init__.py | 1 - pos_hash_cert/__manifest__.py | 14 ------ pos_hash_cert/models/__init__.py | 1 - pos_hash_cert/models/pos_hash_cert.py | 63 --------------------------- pos_hash_cert/views/ir_module.xml | 15 ------- 5 files changed, 94 deletions(-) delete mode 100644 pos_hash_cert/__init__.py delete mode 100644 pos_hash_cert/__manifest__.py delete mode 100644 pos_hash_cert/models/__init__.py delete mode 100644 pos_hash_cert/models/pos_hash_cert.py delete mode 100644 pos_hash_cert/views/ir_module.xml diff --git a/pos_hash_cert/__init__.py b/pos_hash_cert/__init__.py deleted file mode 100644 index 0650744f..00000000 --- a/pos_hash_cert/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import models diff --git a/pos_hash_cert/__manifest__.py b/pos_hash_cert/__manifest__.py deleted file mode 100644 index 7c5e8db4..00000000 --- a/pos_hash_cert/__manifest__.py +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "POS Hash Certification", - "summary": "Module de certification ", - "version": "12.0.1.0.1", - "category": "POS", - "website": "https://vracoop.fr/", - "author": " Coop IT Easy SCRLfs", - "license": "AGPL-3", - "application": False, - "installable": True, - "external_dependencies": {"python": ["checksumdir"]}, - "depends": [], - "data": ["views/ir_module.xml"], -} diff --git a/pos_hash_cert/models/__init__.py b/pos_hash_cert/models/__init__.py deleted file mode 100644 index eb0aa988..00000000 --- a/pos_hash_cert/models/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import pos_hash_cert diff --git a/pos_hash_cert/models/pos_hash_cert.py b/pos_hash_cert/models/pos_hash_cert.py deleted file mode 100644 index 5a92c92a..00000000 --- a/pos_hash_cert/models/pos_hash_cert.py +++ /dev/null @@ -1,63 +0,0 @@ -import logging -import os - -from odoo import api, fields, models -from odoo.tools.config import config - -from checksumdir import dirhash - -_logger = logging.getLogger(__name__) - -CERT_DIR = config.get('certified_modules_directory', 'pos_certified_modules') -USER_DIR = os.path.expanduser("~") - - -class ModuleHash(models.Model): - _inherit = 'ir.module.module' - - hash = fields.Char(compute='_compute_hash', - help='Module hash') - - @api.multi - def _compute_hash(self): - - _logger.debug("[pos_hash_cert] USER_DIR = %s" % USER_DIR) - start_dir = os.path.dirname(os.path.realpath(__file__)) - _logger.debug("[pos_hash_cert] start_DIR = %s" % start_dir) - - last_root = start_dir - current_root = start_dir - found_cert_dir = None - - while found_cert_dir is None and current_root != os.path.dirname(USER_DIR): - pruned = False - for root, dirs, files in os.walk(current_root): - if not pruned: - try: - # Remove the part of the tree we already searched - del dirs[dirs.index(os.path.basename(last_root))] - pruned = True - except ValueError: - pass - if CERT_DIR in dirs: - # found the directory, stop - found_cert_dir = os.path.join(root, CERT_DIR) - break - # Otherwise, pop up a level, search again - last_root = current_root - current_root = os.path.dirname(last_root) - - if found_cert_dir: - _logger.debug("[pos_hash_cert] found_cert_dir = %s" % found_cert_dir) - certified_modules = [ - name - for name in os.listdir(found_cert_dir) - if os.path.isdir(os.path.join(found_cert_dir, name)) - ] - - for record in self: - if record.name in certified_modules: - record.hash = dirhash(found_cert_dir, 'sha256', excluded_extensions=['pyc']) - else: - _logger.debug("[pos_hash_cert] no certified modules directory found") - pass diff --git a/pos_hash_cert/views/ir_module.xml b/pos_hash_cert/views/ir_module.xml deleted file mode 100644 index db01e303..00000000 --- a/pos_hash_cert/views/ir_module.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - ir.module.module.form.hashview - ir.module.module - - - - - - - - -